MediaWiki  REL1_19
UploadStashFile Class Reference
Inheritance diagram for UploadStashFile:
Collaboration diagram for UploadStashFile:

List of all members.

Public Member Functions

 __construct ($repo, $path, $key)
 A LocalFile wrapper around a file that has been temporarily stashed, so we can do things like create thumbnails for it Arguably UnregisteredLocalFile should be handling its own file repo but that class is a bit retarded currently.
 exists ()
 Returns true if file exists in the repository.
 getDescriptionUrl ()
 A method needed by the file transforming and scaling routines in File.php We do not necessarily care about doing the description at this point However, we also can't return the empty string, as the rest of MediaWiki demands this (and calls to imagemagick convert require it to be there)
 getFileKey ()
 Getter for file key (the unique id by which this file's location & metadata is stored in the db)
 getFullUrl ()
 Parent classes use this method, for no obvious reason, to return the path (relative to wiki root, I assume).
 getThumbPath ($thumbName=false)
 Get the path for the thumbnail (actually any transformation of this file) The actual argument is the result of thumbName although we seem to have buggy code elsewhere that expects a boolean 'suffix'.
 getThumbUrl ($thumbName=false)
 Get a URL to access the thumbnail This is required because the model of how files work requires that the thumbnail urls be predictable.
 getUrl ()
 Return the URL of the file, if for some reason we wanted to download it We tend not to do this for the original file, but we do want thumb icons.
 getUrlName ()
 The basename for the URL, which we want to not be related to the filename.
 remove ()
 Remove the associated temporary file.
 thumbName ($params)
 Return the file/url base name of a thumbnail with the specified parameters.

Protected Attributes

 $url

Private Member Functions

 getSpecialUrl ($subPage)
 Helper function -- given a 'subpage', return the local URL e.g.

Private Attributes

 $fileKey
 $urlName

Detailed Description

Definition at line 478 of file UploadStash.php.


Constructor & Destructor Documentation

UploadStashFile::__construct ( repo,
path,
key 
)

A LocalFile wrapper around a file that has been temporarily stashed, so we can do things like create thumbnails for it Arguably UnregisteredLocalFile should be handling its own file repo but that class is a bit retarded currently.

Parameters:
$repoFileRepo: repository where we should find the path
$pathString: path to file
$keyString: key to store the path and any stashed data under
Exceptions:
UploadStashBadPathException
UploadStashFileNotFoundException

Definition at line 493 of file UploadStash.php.

References UnregisteredLocalFile\$path, File\$repo, FileRepo\FILES_ONLY, and wfDebug().

Here is the call graph for this function:


Member Function Documentation

Returns true if file exists in the repository.

Overridden by LocalFile to avoid unnecessary stat calls.

Returns:
boolean Whether file exists in the repository.

Reimplemented from File.

Definition at line 642 of file UploadStash.php.

References FileRepo\FILES_ONLY.

A method needed by the file transforming and scaling routines in File.php We do not necessarily care about doing the description at this point However, we also can't return the empty string, as the rest of MediaWiki demands this (and calls to imagemagick convert require it to be there)

Returns:
String: dummy value

Reimplemented from File.

Definition at line 529 of file UploadStash.php.

References getUrl().

Here is the call graph for this function:

Getter for file key (the unique id by which this file's location & metadata is stored in the db)

Returns:
String: file key

Definition at line 625 of file UploadStash.php.

Parent classes use this method, for no obvious reason, to return the path (relative to wiki root, I assume).

But with this class, the URL is unrelated to the path.

Returns:
String: url

Reimplemented from File.

Definition at line 616 of file UploadStash.php.

References getUrl().

Here is the call graph for this function:

UploadStashFile::getSpecialUrl ( subPage) [private]

Helper function -- given a 'subpage', return the local URL e.g.

/wiki/Special:UploadStash/subpage

Parameters:
{String}$subPage
Returns:
{String} local URL for this subpage in the Special:UploadStash space.

Definition at line 566 of file UploadStash.php.

References SpecialPage\getTitleFor().

Referenced by getThumbUrl(), and getUrl().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the path for the thumbnail (actually any transformation of this file) The actual argument is the result of thumbName although we seem to have buggy code elsewhere that expects a boolean 'suffix'.

Parameters:
$thumbNameString: name of thumbnail (e.g. "120px-123456.jpg" ), or false to just get the path
Returns:
String: path thumbnail should take on filesystem, or containing directory if thumbname is false

Reimplemented from File.

Definition at line 541 of file UploadStash.php.

References UnregisteredLocalFile\$path.

UploadStashFile::getThumbUrl ( thumbName = false)

Get a URL to access the thumbnail This is required because the model of how files work requires that the thumbnail urls be predictable.

However, in our model the URL is not based on the filename (that's hidden in the db)

Parameters:
$thumbNameString: basename of thumbnail file -- however, we don't want to use the file exactly
Returns:
String: URL to access thumbnail, or URL with partial path

Reimplemented from File.

Definition at line 579 of file UploadStash.php.

References getSpecialUrl(), getUrlName(), and wfDebug().

Here is the call graph for this function:

Return the URL of the file, if for some reason we wanted to download it We tend not to do this for the original file, but we do want thumb icons.

Returns:
String: url

Reimplemented from File.

Definition at line 603 of file UploadStash.php.

References getSpecialUrl(), and getUrlName().

Referenced by getDescriptionUrl(), and getFullUrl().

Here is the call graph for this function:

Here is the caller graph for this function:

The basename for the URL, which we want to not be related to the filename.

Will also be used as the lookup key for a thumbnail file.

Returns:
String: base url name, like '120px-123456.jpg'

Definition at line 590 of file UploadStash.php.

Referenced by getThumbUrl(), getUrl(), and thumbName().

Here is the caller graph for this function:

Remove the associated temporary file.

Returns:
Status: success

Definition at line 633 of file UploadStash.php.

References FileRepo\FILES_ONLY.

Return the file/url base name of a thumbnail with the specified parameters.

We override this because we want to use the pretty url name instead of the ugly file name.

Parameters:
$paramsArray: handler-specific parameters
Returns:
String: base name for URL, like '120px-12345.jpg', or null if there is no handler

Reimplemented from File.

Definition at line 557 of file UploadStash.php.

References File\generateThumbName(), and getUrlName().

Here is the call graph for this function:


Member Data Documentation

UploadStashFile::$fileKey [private]

Definition at line 479 of file UploadStash.php.

UploadStashFile::$url [protected]

Reimplemented from File.

Definition at line 481 of file UploadStash.php.

UploadStashFile::$urlName [private]

Definition at line 480 of file UploadStash.php.


The documentation for this class was generated from the following file: