const OVERWRITE_SAME = 4;
const SKIP_LOCKING = 8;
+ /** @var bool Whether to fetch commons image description pages and display
+ * them on the local wiki */
+ public $fetchDescription;
+
+ /** @var int */
+ public $descriptionCacheExpiry;
+
/** @var FileBackend */
protected $backend;
/** @var string Equivalent to $wgArticlePath, e.g. http://en.wikipedia.org/wiki/$1 */
protected $articleUrl;
- /** @var bool Whether to fetch commons image description pages and display them on the local wiki */
- public $fetchDescription;
-
/** @var bool Equivalent to $wgCapitalLinks (or $wgCapitalLinkOverrides[NS_FILE],
* determines whether filenames implicitly start with a capital letter.
* The current implementation may give incorrect description page links
*/
protected $pathDisclosureProtection = 'simple';
- /** @var int */
- public $descriptionCacheExpiry;
-
/** @var bool Public zone URL. */
protected $url;
protected $oldFileFactoryKey = false;
/**
- * @param $info array|null
+ * @param array|null $info
* @throws MWException
*/
public function __construct( array $info = null ) {
/**
* Determine if a string is an mwrepo:// URL
*
- * @param $url string
+ * @param string $url
* @return bool
*/
public static function isVirtualUrl( $url ) {
* The suffix, if supplied, is considered to be unencoded, and will be
* URL-encoded before being returned.
*
- * @param $suffix string|bool
+ * @param string|bool $suffix
* @return string
*/
public function getVirtualUrl( $suffix = false ) {
* same host name as the wiki that is used for viewing thumbnails.
*
* @param string $zone one of: public, deleted, temp, thumb
- * @return String or false
+ * @return string|bool String or false
*/
public function getZoneHandlerUrl( $zone ) {
if ( isset( $this->zones[$zone]['handlerUrl'] )
* Get the backend storage path corresponding to a virtual URL.
* Use this function wisely.
*
- * @param $url string
+ * @param string $url
* @throws MWException
* @return string
*/
/**
* The the storage container and base path of a zone
*
- * @param $zone string
- * @return Array (container, base path) or (null, null)
+ * @param string $zone
+ * @return array (container, base path) or (null, null)
*/
protected function getZoneLocation( $zone ) {
if ( !isset( $this->zones[$zone] ) ) {
/**
* Get the storage path corresponding to one of the zones
*
- * @param $zone string
+ * @param string $zone
* @return string|null Returns null if the zone is not defined
*/
public function getZonePath( $zone ) {
/**
* Create a new File object from the local repository
*
- * @param $title Mixed: Title object or string
- * @param $time Mixed: Time at which the image was uploaded.
- * If this is specified, the returned object will be an
- * instance of the repository's old file class instead of a
- * current file. Repositories not supporting version control
- * should return false if this parameter is set.
+ * @param Title|string $title Title object or string
+ * @param bool|string $time Time at which the image was uploaded. If this
+ * is specified, the returned object will be an instance of the
+ * repository's old file class instead of a current file. Repositories
+ * not supporting version control should return false if this parameter
+ * is set.
* @return File|null A File, or null if passed an invalid Title
*/
public function newFile( $title, $time = false ) {
* Returns false if the file does not exist. Repositories not supporting
* version control should return false if the time is specified.
*
- * @param $title Mixed: Title object or string
+ * @param Title|string $title Title object or string
* @param array $options Associative array of options:
- * time: requested time for a specific file version, or false for the
- * current version. An image object will be returned which was
- * created at the specified time (which may be archived or current).
- *
- * ignoreRedirect: If true, do not follow file redirects
- *
- * private: If true, return restricted (deleted) files if the current
- * user is allowed to view them. Otherwise, such files will not
- * be found.
+ * time: requested time for a specific file version, or false for the
+ * current version. An image object will be returned which was
+ * created at the specified time (which may be archived or current).
+ * ignoreRedirect: If true, do not follow file redirects
+ * private: If true, return restricted (deleted) files if the current
+ * user is allowed to view them. Otherwise, such files will not
+ * be found.
* @return File|bool False on failure
*/
public function findFile( $title, $options = array() ) {
* Returns false if the file does not exist. Repositories not supporting
* version control should return false if the time is specified.
*
- * @param string $sha1 base 36 SHA-1 hash
+ * @param string $sha1 Base 36 SHA-1 hash
* @param array $options Option array, same as findFile().
* @return File|bool False on failure
*/
* SHA-1 content hash.
*
* STUB
- * @param $hash
+ * @param string $hash SHA-1 hash
* @return array
*/
public function findBySha1( $hash ) {
/**
* Get the name of a file from its title object
*
- * @param $title Title
- * @return String
+ * @param Title $title
+ * @return string
*/
public function getNameFromTitle( Title $title ) {
global $wgContLang;
}
/**
- * @param $name
- * @param $levels
+ * @param string $name
+ * @param int $levels
* @return string
*/
protected static function getHashPathForLevel( $name, $levels ) {
/**
* Get the number of hash directory levels
*
- * @return integer
+ * @return int
*/
public function getHashLevels() {
return $this->hashLevels;
/**
* Make an url to this repo
*
- * @param $query mixed Query string to append
+ * @param string $query Query string to append
* @param string $entry Entry point; defaults to index
* @return string|bool False on failure
*/
* In particular, it uses the article paths as specified to the repository
* constructor, whereas local repositories use the local Title functions.
*
- * @param $name string
+ * @param string $name
* @return string
*/
public function getDescriptionUrl( $name ) {
* repository's file class, since it may return invalid results. User code
* should use File::getDescriptionText().
*
- * @param string $name name of image to fetch
- * @param string $lang language to fetch it in, if any.
+ * @param string $name Name of image to fetch
+ * @param string $lang Language to fetch it in, if any.
* @return string
*/
public function getDescriptionRenderUrl( $name, $lang = null ) {
/**
* Store a file to a given destination.
*
- * @param string $srcPath source file system path, storage path, or virtual URL
- * @param string $dstZone destination zone
- * @param string $dstRel destination relative path
- * @param $flags Integer: bitwise combination of the following flags:
- * self::DELETE_SOURCE Delete the source file after upload
- * self::OVERWRITE Overwrite an existing destination file instead of failing
- * self::OVERWRITE_SAME Overwrite the file if the destination exists and has the
- * same contents as the source
- * self::SKIP_LOCKING Skip any file locking when doing the store
+ * @param string $srcPath Source file system path, storage path, or virtual URL
+ * @param string $dstZone Destination zone
+ * @param string $dstRel Destination relative path
+ * @param int $flags Bitwise combination of the following flags:
+ * self::DELETE_SOURCE Delete the source file after upload
+ * self::OVERWRITE Overwrite an existing destination file instead of failing
+ * self::OVERWRITE_SAME Overwrite the file if the destination exists and has the
+ * same contents as the source
+ * self::SKIP_LOCKING Skip any file locking when doing the store
* @return FileRepoStatus
*/
public function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
* Store a batch of files
*
* @param array $triplets (src, dest zone, dest rel) triplets as per store()
- * @param $flags Integer: bitwise combination of the following flags:
- * self::DELETE_SOURCE Delete the source file after upload
- * self::OVERWRITE Overwrite an existing destination file instead of failing
- * self::OVERWRITE_SAME Overwrite the file if the destination exists and has the
- * same contents as the source
- * self::SKIP_LOCKING Skip any file locking when doing the store
+ * @param int $flags Bitwise combination of the following flags:
+ * self::DELETE_SOURCE Delete the source file after upload
+ * self::OVERWRITE Overwrite an existing destination file instead of failing
+ * self::OVERWRITE_SAME Overwrite the file if the destination exists and has the
+ * same contents as the source
+ * self::SKIP_LOCKING Skip any file locking when doing the store
* @throws MWException
* @return FileRepoStatus
*/
* It will try to delete each file, but ignores any errors that may occur.
*
* @param array $files List of files to delete
- * @param $flags Integer: bitwise combination of the following flags:
- * self::SKIP_LOCKING Skip any file locking when doing the deletions
+ * @param int $flags Bitwise combination of the following flags:
+ * self::SKIP_LOCKING Skip any file locking when doing the deletions
* @return FileRepoStatus
*/
public function cleanupBatch( array $files, $flags = 0 ) {
* file can later be disposed using FileRepo::freeTemp().
*
* @param string $originalName the base name of the file as specified
- * by the user. The file extension will be maintained.
- * @param string $srcPath the current location of the file.
- * @return FileRepoStatus object with the URL in the value.
+ * by the user. The file extension will be maintained.
+ * @param string $srcPath The current location of the file.
+ * @return FileRepoStatus Object with the URL in the value.
*/
public function storeTemp( $originalName, $srcPath ) {
$this->assertWritableRepo(); // fail out if read-only
/**
* Remove a temporary file or mark it for garbage collection
*
- * @param string $virtualUrl the virtual URL returned by FileRepo::storeTemp()
- * @return Boolean: true on success, false on failure
+ * @param string $virtualUrl The virtual URL returned by FileRepo::storeTemp()
+ * @return bool True on success, false on failure
*/
public function freeTemp( $virtualUrl ) {
$this->assertWritableRepo(); // fail out if read-only
*
* @param array $srcPaths Ordered list of source virtual URLs/storage paths
* @param string $dstPath Target file system path
- * @param $flags Integer: bitwise combination of the following flags:
- * self::DELETE_SOURCE Delete the source files
+ * @param int $flags Bitwise combination of the following flags:
+ * self::DELETE_SOURCE Delete the source files
* @return FileRepoStatus
*/
public function concatenate( array $srcPaths, $dstPath, $flags = 0 ) {
* Options to $options include:
* - headers : name/value map of HTTP headers to use in response to GET/HEAD requests
*
- * @param string $srcPath the source file system path, storage path, or URL
- * @param string $dstRel the destination relative path
- * @param string $archiveRel the relative path where the existing file is to
- * be archived, if there is one. Relative to the public zone root.
- * @param $flags Integer: bitfield, may be FileRepo::DELETE_SOURCE to indicate
- * that the source file should be deleted if possible
+ * @param string $srcPath The source file system path, storage path, or URL
+ * @param string $dstRel The destination relative path
+ * @param string $archiveRel The relative path where the existing file is to
+ * be archived, if there is one. Relative to the public zone root.
+ * @param int $flags Bitfield, may be FileRepo::DELETE_SOURCE to indicate
+ * that the source file should be deleted if possible
* @param array $options Optional additional parameters
* @return FileRepoStatus
*/
* Publish a batch of files
*
* @param array $ntuples (source, dest, archive) triplets or
- * (source, dest, archive, options) 4-tuples as per publish().
- * @param $flags Integer: bitfield, may be FileRepo::DELETE_SOURCE to indicate
- * that the source files should be deleted if possible
+ * (source, dest, archive, options) 4-tuples as per publish().
+ * @param int $flags Bitfield, may be FileRepo::DELETE_SOURCE to indicate
+ * that the source files should be deleted if possible
* @throws MWException
* @return FileRepoStatus
*/
* If no valid deletion archive exists, this may either delete the file
* or throw an exception, depending on the preference of the repository
*
- * @param $srcRel Mixed: relative path for the file to be deleted
- * @param $archiveRel Mixed: relative path for the archive location.
- * Relative to a private archive directory.
+ * @param mixed $srcRel Relative path for the file to be deleted
+ * @param mixed $archiveRel Relative path for the archive location.
+ * Relative to a private archive directory.
* @return FileRepoStatus object
*/
public function delete( $srcRel, $archiveRel ) {
* assumes a naming scheme in the deleted zone based on content hash, as
* opposed to the public zone which is assumed to be unique.
*
- * @param array $sourceDestPairs of source/destination pairs. Each element
- * is a two-element array containing the source file path relative to the
- * public root in the first element, and the archive file path relative
- * to the deleted zone root in the second element.
+ * @param array $sourceDestPairs Array of source/destination pairs. Each element
+ * is a two-element array containing the source file path relative to the
+ * public root in the first element, and the archive file path relative
+ * to the deleted zone root in the second element.
* @throws MWException
* @return FileRepoStatus
*/
* Get a relative path for a deletion archive key,
* e.g. s/z/a/ for sza251lrxrc1jad41h5mgilp8nysje52.jpg
*
- * @param $key string
+ * @param string $key
* @throws MWException
* @return string
*/
* If a path is a virtual URL, resolve it to a storage path.
* Otherwise, just return the path as it is.
*
- * @param $path string
+ * @param string $path
* @return string
* @throws MWException
*/
* Get a local FS copy of a file with a given virtual URL/storage path.
* Temporary files may be purged when the file object falls out of scope.
*
- * @param $virtualUrl string
+ * @param string $virtualUrl
* @return TempFSFile|null Returns null on failure
*/
public function getLocalCopy( $virtualUrl ) {
* The file is either an original or a copy. It should not be changed.
* Temporary files may be purged when the file object falls out of scope.
*
- * @param $virtualUrl string
+ * @param string $virtualUrl
* @return FSFile|null Returns null on failure.
*/
public function getLocalReference( $virtualUrl ) {
* Get properties of a file with a given virtual URL/storage path.
* Properties should ultimately be obtained via FSFile::getProps().
*
- * @param $virtualUrl string
+ * @param string $virtualUrl
* @return Array
*/
public function getFileProps( $virtualUrl ) {
/**
* Get the timestamp of a file with a given virtual URL/storage path
*
- * @param $virtualUrl string
+ * @param string $virtualUrl
* @return string|bool False on failure
*/
public function getFileTimestamp( $virtualUrl ) {
/**
* Get the size of a file with a given virtual URL/storage path
*
- * @param $virtualUrl string
+ * @param string $virtualUrl
* @return integer|bool False on failure
*/
public function getFileSize( $virtualUrl ) {
/**
* Get the sha1 (base 36) of a file with a given virtual URL/storage path
*
- * @param $virtualUrl string
+ * @param string $virtualUrl
* @return string|bool
*/
public function getFileSha1( $virtualUrl ) {
/**
* Attempt to stream a file with the given virtual URL/storage path
*
- * @param $virtualUrl string
+ * @param string $virtualUrl
* @param array $headers Additional HTTP headers to send on success
* @return bool Success
*/
* This only acts on the current version of files, not any old versions.
* May use either the database or the filesystem.
*
- * @param $callback Array|string
+ * @param array|string $callback
* @return void
*/
public function enumFiles( $callback ) {
* Call a callback function for every public file in the repository.
* May use either the database or the filesystem.
*
- * @param $callback Array|string
+ * @param array|string $callback
* @return void
*/
protected function enumFilesInStorage( $callback ) {
/**
* Get a callback function to use for cleaning error message parameters
*
- * @return Array
+ * @return array
*/
function getErrorCleanupFunction() {
switch ( $this->pathDisclosureProtection ) {
/**
* Path disclosure protection function
*
- * @param $param string
+ * @param string $param
* @return string
*/
function paranoidClean( $param ) {
/**
* Path disclosure protection function
*
- * @param $param string
+ * @param string $param
* @return string
*/
function passThrough( $param ) {
/**
* Create a new fatal error
*
+ * @param $message
* @return FileRepoStatus
*/
public function newFatal( $message /*, parameters...*/ ) {
/**
* Create a new good result
*
- * @param $value null|string
+ * @param null|string $value
* @return FileRepoStatus
*/
public function newGood( $value = null ) {
* title object. If not, return false.
* STUB
*
- * @param $title Title of image
- * @return Bool
+ * @param Title $title Title of image
+ * @return bool
*/
public function checkRedirect( Title $title ) {
return false;
* Doesn't do anything for repositories that don't support image redirects.
*
* STUB
- * @param $title Title of image
+ * @param Title $title Title of image
*/
public function invalidateImageRedirect( Title $title ) {
}
/**
* Get an UploadStash associated with this repo.
*
- * @param $user User
+ * @param User $user
* @return UploadStash
*/
public function getUploadStash( User $user = null ) {