Improved/added parameter documentation
authorReedy <reedy@wikimedia.org>
Fri, 18 May 2012 02:58:15 +0000 (03:58 +0100)
committerReedy <reedy@wikimedia.org>
Fri, 18 May 2012 02:58:15 +0000 (03:58 +0100)
Change-Id: Ie48852acb434f6b62fda0b13b13e076f833d8975

26 files changed:
includes/filerepo/FSRepo.php
includes/filerepo/FileRepo.php
includes/filerepo/ForeignAPIRepo.php
includes/filerepo/ForeignDBRepo.php
includes/filerepo/ForeignDBViaLBRepo.php
includes/filerepo/NullRepo.php
includes/filerepo/RepoGroup.php
includes/filerepo/backend/FSFile.php
includes/filerepo/backend/FSFileBackend.php
includes/filerepo/backend/FileBackend.php
includes/filerepo/backend/FileBackendMultiWrite.php
includes/filerepo/backend/FileBackendStore.php
includes/filerepo/backend/FileOp.php
includes/filerepo/backend/FileOpBatch.php
includes/filerepo/backend/filejournal/DBFileJournal.php
includes/filerepo/backend/filejournal/FileJournal.php
includes/filerepo/backend/lockmanager/DBLockManager.php
includes/filerepo/backend/lockmanager/FSLockManager.php
includes/filerepo/backend/lockmanager/LSLockManager.php
includes/filerepo/backend/lockmanager/LockManager.php
includes/filerepo/backend/lockmanager/LockManagerGroup.php
includes/filerepo/file/File.php
includes/filerepo/file/ForeignAPIFile.php
includes/filerepo/file/ForeignDBFile.php
includes/filerepo/file/OldLocalFile.php
includes/filerepo/file/UnregisteredLocalFile.php

index 7435ca9..9c8d85d 100644 (file)
  * @deprecated since 1.19
  */
 class FSRepo extends FileRepo {
+
+       /**
+        * @param $info array
+        * @throws MWException
+        */
        function __construct( array $info ) {
                if ( !isset( $info['backend'] ) ) {
                        // B/C settings...
index 6533dae..6278cd7 100644 (file)
@@ -60,6 +60,10 @@ class FileRepo {
        var $oldFileFactory = false;
        var $fileFactoryKey = false, $oldFileFactoryKey = false;
 
+       /**
+        * @param $info array|null
+        * @throws MWException
+        */
        function __construct( array $info = null ) {
                // Verify required settings presence
                if(
@@ -146,6 +150,7 @@ class FileRepo {
         * Check if a single zone or list of zones is defined for usage
         *
         * @param $doZones Array Only do a particular zones
+        * @throws MWException
         * @return Status
         */
        protected function initZones( $doZones = array() ) {
@@ -186,7 +191,7 @@ class FileRepo {
         * The suffix, if supplied, is considered to be unencoded, and will be
         * URL-encoded before being returned.
         *
-        * @param $suffix string
+        * @param $suffix string|bool
         * @return string
         */
        public function getVirtualUrl( $suffix = false ) {
@@ -223,6 +228,7 @@ class FileRepo {
         * Use this function wisely.
         *
         * @param $url string
+        * @throws MWException
         * @return string
         */
        public function resolveVirtualUrl( $url ) {
@@ -433,6 +439,7 @@ class FileRepo {
         * SHA-1 content hash.
         *
         * STUB
+        * @param $hash
         * @return array
         */
        public function findBySha1( $hash ) {
@@ -684,6 +691,7 @@ class FileRepo {
         *     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
         */
        public function storeBatch( array $triplets, $flags = 0 ) {
@@ -762,7 +770,7 @@ class FileRepo {
         * Each file can be a (zone, rel) pair, virtual url, storage path.
         * It will try to delete each file, but ignores any errors that may occur.
         *
-        * @param $pairs array List of files to delete
+        * @param $files array 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
         * @return FileRepoStatus
@@ -841,7 +849,7 @@ class FileRepo {
         * This function can be used to write to otherwise read-only foreign repos.
         * This is intended for copying generated thumbnails into the repo.
         *
-        * @param $src Array List of tuples (file system path, virtual URL or storage path)
+        * @param $pairs Array List of tuples (file system path, virtual URL or storage path)
         * @return FileRepoStatus
         */
        public function quickImportBatch( array $pairs ) {
@@ -869,7 +877,7 @@ class FileRepo {
         * This function can be used to write to otherwise read-only foreign repos.
         * This does no locking nor journaling and is intended for purging thumbnails.
         *
-        * @param $path Array List of virtual URLs or storage paths
+        * @param $paths Array List of virtual URLs or storage paths
         * @return FileRepoStatus
         */
        public function quickPurgeBatch( array $paths ) {
@@ -1013,6 +1021,7 @@ class FileRepo {
         * @param $triplets Array: (source, dest, archive) triplets as per publish()
         * @param $flags Integer: bitfield, may be FileRepo::DELETE_SOURCE to indicate
         *        that the source files should be deleted if possible
+        * @throws MWException
         * @return FileRepoStatus
         */
        public function publishBatch( array $triplets, $flags = 0 ) {
@@ -1188,6 +1197,7 @@ class FileRepo {
         *        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
         */
        public function deleteBatch( array $sourceDestPairs ) {
@@ -1257,6 +1267,7 @@ class FileRepo {
         * Get a relative path for a deletion archive key,
         * e.g. s/z/a/ for sza251lrxrc1jad41h5mgilp8nysje52.jpg
         *
+        * @param $key string
         * @return string
         */
        public function getDeletedHashPath( $key ) {
@@ -1460,6 +1471,7 @@ class FileRepo {
        /**
         * Create a new good result
         *
+        * @param $value null|string
         * @return FileRepoStatus
         */
        public function newGood( $value = null ) {
index 5fab3ab..e9155af 100644 (file)
@@ -51,6 +51,9 @@ class ForeignAPIRepo extends FileRepo {
        protected $mQueryCache = array();
        protected $mFileExists = array();
 
+       /**
+        * @param $info array|null
+        */
        function __construct( $info ) {
                global $wgLocalFileRepo;
                parent::__construct( $info );
@@ -81,6 +84,8 @@ class ForeignAPIRepo extends FileRepo {
         * Per docs in FileRepo, this needs to return false if we don't support versioned
         * files. Well, we don't.
         *
+        * @param $title Title
+        * @param $time string|bool
         * @return File
         */
        function newFile( $title, $time = false ) {
@@ -90,6 +95,10 @@ class ForeignAPIRepo extends FileRepo {
                return parent::newFile( $title, $time );
        }
 
+       /**
+        * @param $files array
+        * @return array
+        */
        function fileExistsBatch( array $files ) {
                $results = array();
                foreach ( $files as $k => $f ) {
@@ -121,10 +130,18 @@ class ForeignAPIRepo extends FileRepo {
                return $results;
        }
 
+       /**
+        * @param $virtualUrl string
+        * @return bool
+        */
        function getFileProps( $virtualUrl ) {
                return false;
        }
 
+       /**
+        * @param $query array
+        * @return string
+        */
        function fetchImageQuery( $query ) {
                global $wgMemc;
 
@@ -160,6 +177,10 @@ class ForeignAPIRepo extends FileRepo {
                return FormatJson::decode( $this->mQueryCache[$url], true );
        }
 
+       /**
+        * @param $data array
+        * @return bool|array
+        */
        function getImageInfo( $data ) {
                if( $data && isset( $data['query']['pages'] ) ) {
                        foreach( $data['query']['pages'] as $info ) {
@@ -171,6 +192,10 @@ class ForeignAPIRepo extends FileRepo {
                return false;
        }
 
+       /**
+        * @param $hash string
+        * @return array
+        */
        function findBySha1( $hash ) {
                $results = $this->fetchImageQuery( array(
                                                                                'aisha1base36' => $hash,
@@ -189,6 +214,14 @@ class ForeignAPIRepo extends FileRepo {
                return $ret;
        }
 
+       /**
+        * @param $name string
+        * @param $width int
+        * @param $height int
+        * @param $result null
+        * @param $otherParams string
+        * @return bool
+        */
        function getThumbUrl( $name, $width = -1, $height = -1, &$result = null, $otherParams = '' ) {
                $data = $this->fetchImageQuery( array(
                        'titles' => 'File:' . $name,
@@ -217,10 +250,10 @@ class ForeignAPIRepo extends FileRepo {
         * @param $name String is a dbkey form of a title
         * @param $width
         * @param $height
-        * @param String $param Other rendering parameters (page number, etc) from handler's makeParamString.
+        * @param String $params Other rendering parameters (page number, etc) from handler's makeParamString.
         * @return bool|string
         */
-       function getThumbUrlFromCache( $name, $width, $height, $params="" ) {
+       function getThumbUrlFromCache( $name, $width, $height, $params = "" ) {
                global $wgMemc;
                // We can't check the local cache using FileRepo functions because
                // we override fileExistsBatch(). We have to use the FileBackend directly.
@@ -303,6 +336,7 @@ class ForeignAPIRepo extends FileRepo {
 
        /**
         * @see FileRepo::getZoneUrl()
+        * @param $zone String
         * @return String
         */
        function getZoneUrl( $zone ) {
@@ -318,6 +352,7 @@ class ForeignAPIRepo extends FileRepo {
 
        /**
         * Get the local directory corresponding to one of the basic zones
+        * @param $zone string
         * @return bool|null|string
         */
        function getZonePath( $zone ) {
@@ -347,6 +382,9 @@ class ForeignAPIRepo extends FileRepo {
        /**
         * Like a Http:get request, but with custom User-Agent.
         * @see Http:get
+        * @param $url string
+        * @param $timeout string
+        * @param $options array
         * @return bool|String
         */
        public static function httpGet( $url, $timeout = 'default', $options = array() ) {
@@ -371,10 +409,17 @@ class ForeignAPIRepo extends FileRepo {
                }
        }
 
+       /**
+        * @param $callback Array|string
+        * @throws MWException
+        */
        function enumFiles( $callback ) {
                throw new MWException( 'enumFiles is not supported by ' . get_class( $this ) );
        }
 
+       /**
+        * @throws MWException
+        */
        protected function assertWritableRepo() {
                throw new MWException( get_class( $this ) . ': write operations are not supported.' );
        }
index 6a1cfaf..4b206c3 100644 (file)
@@ -36,6 +36,9 @@ class ForeignDBRepo extends LocalRepo {
        var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
        var $fileFromRowFactory = array( 'ForeignDBFile', 'newFromRow' );
 
+       /**
+        * @param $info array|null
+        */
        function __construct( $info ) {
                parent::__construct( $info );
                $this->dbType = $info['dbType'];
@@ -48,6 +51,9 @@ class ForeignDBRepo extends LocalRepo {
                $this->hasSharedCache = $info['hasSharedCache'];
        }
 
+       /**
+        * @return DatabaseBase
+        */
        function getMasterDB() {
                if ( !isset( $this->dbConn ) ) {
                        $this->dbConn = DatabaseBase::factory( $this->dbType,
@@ -64,10 +70,16 @@ class ForeignDBRepo extends LocalRepo {
                return $this->dbConn;
        }
 
+       /**
+        * @return DatabaseBase
+        */
        function getSlaveDB() {
                return $this->getMasterDB();
        }
 
+       /**
+        * @return bool
+        */
        function hasSharedCache() {
                return $this->hasSharedCache;
        }
index 2132ba6..bd76fce 100644 (file)
@@ -31,6 +31,9 @@ class ForeignDBViaLBRepo extends LocalRepo {
        var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
        var $fileFromRowFactory = array( 'ForeignDBFile', 'newFromRow' );
 
+       /**
+        * @param $info array|null
+        */
        function __construct( $info ) {
                parent::__construct( $info );
                $this->wiki = $info['wiki'];
@@ -38,10 +41,16 @@ class ForeignDBViaLBRepo extends LocalRepo {
                $this->hasSharedCache = $info['hasSharedCache'];
        }
 
+       /**
+        * @return DatabaseBase
+        */
        function getMasterDB() {
                return wfGetDB( DB_MASTER, array(), $this->wiki );
        }
 
+       /**
+        * @return DatabaseBase
+        */
        function getSlaveDB() {
                return wfGetDB( DB_SLAVE, array(), $this->wiki );
        }
index 3f39f60..dda51ce 100644 (file)
  * @ingroup FileRepo
  */
 class NullRepo extends FileRepo {
+
+       /**
+        * @param $info array|null
+        */
        function __construct( $info ) {}
 
        protected function assertWritableRepo() {
index 0def2d8..709655a 100644 (file)
@@ -165,6 +165,10 @@ class RepoGroup {
                return $image;
        }
 
+       /**
+        * @param $inputItems array
+        * @return array
+        */
        function findFiles( $inputItems ) {
                if ( !$this->reposInitialised ) {
                        $this->initialiseRepos();
@@ -196,6 +200,7 @@ class RepoGroup {
 
        /**
         * Interface for FileRepo::checkRedirect()
+        * @param $title Title
         * @return bool
         */
        function checkRedirect( Title $title ) {
@@ -259,6 +264,7 @@ class RepoGroup {
 
        /**
         * Get the repo instance with a given key.
+        * @param $index string|int
         * @return bool|LocalRepo
         */
        function getRepo( $index ) {
@@ -273,8 +279,10 @@ class RepoGroup {
                        return false;
                }
        }
+
        /**
         * Get the repo instance by its name
+        * @param $name string
         * @return bool
         */
        function getRepoByName( $name ) {
@@ -282,8 +290,9 @@ class RepoGroup {
                        $this->initialiseRepos();
                }
                foreach ( $this->foreignRepos as $repo ) {
-                       if ( $repo->name == $name)
+                       if ( $repo->name == $name ) {
                                return $repo;
+                       }
                }
                return false;
        }
@@ -351,6 +360,7 @@ class RepoGroup {
        /**
         * Split a virtual URL into repo, zone and rel parts
         * @param $url string
+        * @throws MWException
         * @return array containing repo, zone and rel
         */
        function splitVirtualUrl( $url ) {
@@ -365,6 +375,10 @@ class RepoGroup {
                return $bits;
        }
 
+       /**
+        * @param $fileName string
+        * @return array
+        */
        function getFileProps( $fileName ) {
                if ( FileRepo::isVirtualUrl( $fileName ) ) {
                        list( $repoName, /* $zone */, /* $rel */ ) = $this->splitVirtualUrl( $fileName );
index ec21c8f..e07c99d 100644 (file)
@@ -32,7 +32,8 @@ class FSFile {
        /**
         * Sets up the file object
         *
-        * @param String $path Path to temporary file on local disk
+        * @param $path string Path to temporary file on local disk
+        * @throws MWException
         */
        public function __construct( $path ) {
                if ( FileBackend::isStoragePath( $path ) ) {
@@ -169,6 +170,7 @@ class FSFile {
        /**
         * Exract image size information
         *
+        * @param $gis array
         * @return Array
         */
        protected function extractImageSizeInfo( array $gis ) {
index e105730..8157916 100644 (file)
@@ -78,6 +78,8 @@ class FSFileBackend extends FileBackendStore {
 
        /**
         * @see FileBackendStore::resolveContainerPath()
+        * @param $container string
+        * @param $relStoragePath string
         * @return null|string
         */
        protected function resolveContainerPath( $container, $relStoragePath ) {
@@ -745,6 +747,9 @@ class FSFileBackend extends FileBackendStore {
                return array_pop( $this->hadWarningErrors ); // pop from stack
        }
 
+       /**
+        * @return bool
+        */
        private function handleWarning() {
                $this->hadWarningErrors[count( $this->hadWarningErrors ) - 1] = true;
                return true; // suppress from PHP handler
@@ -758,6 +763,13 @@ class FSFileOpHandle extends FileBackendStoreOpHandle {
        public $cmd; // string; shell command
        public $chmodPath; // string; file to chmod
 
+       /**
+        * @param $backend
+        * @param $params array
+        * @param $call
+        * @param $cmd
+        * @param $chmodPath null
+        */
        public function __construct( $backend, array $params, $call, $cmd, $chmodPath = null ) {
                $this->backend = $backend;
                $this->params = $params;
@@ -784,6 +796,7 @@ abstract class FSFileBackendList implements Iterator {
 
        /**
         * @param $dir string file system directory
+        * @param $params array
         */
        public function __construct( $dir, array $params ) {
                $dir = realpath( $dir ); // normalize
index 94e509e..81fbced 100644 (file)
@@ -88,6 +88,7 @@ abstract class FileBackend {
         *     'concurrency' : How many file operations can be done in parallel.
         *
         * @param $config Array
+        * @throws MWException
         */
        public function __construct( array $config ) {
                $this->name = $config['name'];
@@ -663,6 +664,7 @@ abstract class FileBackend {
         * $params include:
         *     dir : storage directory
         *
+        * @param $params array
         * @return bool|null Returns null on failure
         * @since 1.20
         */
@@ -682,6 +684,7 @@ abstract class FileBackend {
         *     dir     : storage directory
         *     topOnly : only return direct child dirs of the directory
         *
+        * @param $params array
         * @return Traversable|Array|null Returns null on failure
         * @since 1.20
         */
@@ -696,6 +699,7 @@ abstract class FileBackend {
         * $params include:
         *     dir : storage directory
         *
+        * @param $params array
         * @return Traversable|Array|null Returns null on failure
         * @since 1.20
         */
@@ -717,6 +721,7 @@ abstract class FileBackend {
         *     dir     : storage directory
         *     topOnly : only return direct child files of the directory (@since 1.20)
         *
+        * @param $params array
         * @return Traversable|Array|null Returns null on failure
         */
        abstract public function getFileList( array $params );
@@ -730,6 +735,7 @@ abstract class FileBackend {
         * $params include:
         *     dir : storage directory
         *
+        * @param $params array
         * @return Traversable|Array|null Returns null on failure
         * @since 1.20
         */
index 1fa23eb..59406d6 100644 (file)
@@ -260,7 +260,7 @@ class FileBackendMultiWrite extends FileBackend {
        /**
         * Same as substOpBatchPaths() but for a single operation
         *
-        * @param $op File operation array
+        * @param $ops array File operation array
         * @param $backend FileBackendStore
         * @return Array
         */
@@ -331,6 +331,7 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::doSecure()
+        * @param $params array
         * @return Status
         */
        protected function doSecure( array $params ) {
@@ -344,6 +345,7 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::doClean()
+        * @param $params array
         * @return Status
         */
        protected function doClean( array $params ) {
@@ -357,6 +359,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::concatenate()
+        * @param $params array
+        * @return Status
         */
        public function concatenate( array $params ) {
                // We are writing to an FS file, so we don't need to do this per-backend
@@ -366,6 +370,7 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::fileExists()
+        * @param $params array
         */
        public function fileExists( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
@@ -374,6 +379,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::getFileTimestamp()
+        * @param $params array
+        * @return bool|string
         */
        public function getFileTimestamp( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
@@ -382,6 +389,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::getFileSize()
+        * @param $params array
+        * @return bool|int
         */
        public function getFileSize( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
@@ -390,6 +399,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::getFileStat()
+        * @param $params array
+        * @return Array|bool|null
         */
        public function getFileStat( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
@@ -398,6 +409,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::getFileContents()
+        * @param $params array
+        * @return bool|string
         */
        public function getFileContents( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
@@ -406,6 +419,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::getFileSha1Base36()
+        * @param $params array
+        * @return bool|string
         */
        public function getFileSha1Base36( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
@@ -414,6 +429,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::getFileProps()
+        * @param $params array
+        * @return Array
         */
        public function getFileProps( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
@@ -422,6 +439,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::streamFile()
+        * @param $params array
+        * @return \Status
         */
        public function streamFile( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
@@ -430,6 +449,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::getLocalReference()
+        * @param $params array
+        * @return FSFile|null
         */
        public function getLocalReference( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
@@ -438,6 +459,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::getLocalCopy()
+        * @param $params array
+        * @return null|TempFSFile
         */
        public function getLocalCopy( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
@@ -446,6 +469,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::directoryExists()
+        * @param $params array
+        * @return bool|null
         */
        public function directoryExists( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
@@ -454,6 +479,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::getSubdirectoryList()
+        * @param $params array
+        * @return Array|null|Traversable
         */
        public function getDirectoryList( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
@@ -462,6 +489,8 @@ class FileBackendMultiWrite extends FileBackend {
 
        /**
         * @see FileBackend::getFileList()
+        * @param $params array
+        * @return Array|null|\Traversable
         */
        public function getFileList( array $params ) {
                $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
index 7d32bec..6c89c45 100644 (file)
@@ -1027,7 +1027,6 @@ abstract class FileBackendStore extends FileBackend {
        /**
         * @see FileBackendStore::executeOpHandlesInternal()
         * @return Array List of corresponding Status objects
-        * @throws MWException
         */
        protected function doExecuteOpHandlesInternal( array $fileOpHandles ) {
                foreach ( $fileOpHandles as $fileOpHandle ) { // OK if empty
@@ -1203,7 +1202,7 @@ abstract class FileBackendStore extends FileBackend {
         * Any empty suffix means the container is not sharded.
         *
         * @param $container string Container name
-        * @param $relStoragePath string Storage path relative to the container
+        * @param $relPath string Storage path relative to the container
         * @return string|null Returns null if shard could not be determined
         */
        final protected function getContainerShard( $container, $relPath ) {
@@ -1342,7 +1341,6 @@ abstract class FileBackendStore extends FileBackend {
         *
         * @param $container string Resolved container name
         * @param $val mixed Information to cache
-        * @return void
         */
        final protected function setContainerCache( $container, $val ) {
                $this->memCache->set( $this->containerCacheKey( $container ), $val, 14*86400 );
@@ -1351,8 +1349,7 @@ abstract class FileBackendStore extends FileBackend {
        /**
         * Delete the cached info for a container
         *
-        * @param $containers string Resolved container name
-        * @return void
+        * @param $container string Resolved container name
         */
        final protected function deleteContainerCache( $container ) {
                if ( !$this->memCache->delete( $this->containerCacheKey( $container ) ) ) {
@@ -1431,7 +1428,6 @@ abstract class FileBackendStore extends FileBackend {
         *
         * @param $path string Storage path
         * @param $val mixed Information to cache
-        * @return void
         */
        final protected function setFileCache( $path, $val ) {
                $this->memCache->set( $this->fileCacheKey( $path ), $val, 7*86400 );
@@ -1441,7 +1437,6 @@ abstract class FileBackendStore extends FileBackend {
         * Delete the cached stat info for a file path
         *
         * @param $path string Storage path
-        * @return void
         */
        final protected function deleteFileCache( $path ) {
                if ( !$this->memCache->delete( $this->fileCacheKey( $path ) ) ) {
@@ -1683,6 +1678,12 @@ abstract class FileBackendStoreShardListIterator implements Iterator {
  * Iterator for listing directories
  */
 class FileBackendStoreShardDirIterator extends FileBackendStoreShardListIterator {
+       /**
+        * @param string $container
+        * @param string $dir
+        * @param array $params
+        * @return Array|null|Traversable
+        */
        protected function listFromShard( $container, $dir, array $params ) {
                return $this->backend->getDirectoryListInternal( $container, $dir, $params );
        }
@@ -1692,6 +1693,12 @@ class FileBackendStoreShardDirIterator extends FileBackendStoreShardListIterator
  * Iterator for listing regular files
  */
 class FileBackendStoreShardFileIterator extends FileBackendStoreShardListIterator {
+       /**
+        * @param string $container
+        * @param string $dir
+        * @param array $params
+        * @return Array|null|Traversable
+        */
        protected function listFromShard( $container, $dir, array $params ) {
                return $this->backend->getFileListInternal( $container, $dir, $params );
        }
index b2b46ed..d9fbafd 100644 (file)
@@ -438,10 +438,18 @@ abstract class FileOp {
  *     overwriteSame : override any existing file at destination
  */
 class StoreFileOp extends FileOp {
+
+       /**
+        * @return array
+        */
        protected function allowedParams() {
                return array( array( 'src', 'dst' ), array( 'overwrite', 'overwriteSame' ) );
        }
 
+       /**
+        * @param $predicates array
+        * @return Status
+        */
        protected function doPrecheck( array &$predicates ) {
                $status = Status::newGood();
                // Check if the source file exists on the file system
@@ -470,6 +478,9 @@ class StoreFileOp extends FileOp {
                return $status; // safe to call attempt()
        }
 
+       /**
+        * @return Status
+        */
        protected function doAttempt() {
                // Store the file at the destination
                if ( !$this->destSameAsSource ) {
@@ -478,6 +489,9 @@ class StoreFileOp extends FileOp {
                return Status::newGood();
        }
 
+       /**
+        * @return bool|string
+        */
        protected function getSourceSha1Base36() {
                wfSuppressWarnings();
                $hash = sha1_file( $this->params['src'] );
@@ -530,6 +544,9 @@ class CreateFileOp extends FileOp {
                return $status; // safe to call attempt()
        }
 
+       /**
+        * @return Status
+        */
        protected function doAttempt() {
                if ( !$this->destSameAsSource ) {
                        // Create the file at the destination
@@ -538,10 +555,16 @@ class CreateFileOp extends FileOp {
                return Status::newGood();
        }
 
+       /**
+        * @return bool|String
+        */
        protected function getSourceSha1Base36() {
                return wfBaseConvert( sha1( $this->params['content'] ), 16, 36, 31 );
        }
 
+       /**
+        * @return array
+        */
        protected function doStoragePathsChanged() {
                return array( $this->params['dst'] );
        }
@@ -556,10 +579,18 @@ class CreateFileOp extends FileOp {
  *     overwriteSame : override any existing file at destination
  */
 class CopyFileOp extends FileOp {
+
+       /**
+        * @return array
+        */
        protected function allowedParams() {
                return array( array( 'src', 'dst' ), array( 'overwrite', 'overwriteSame' ) );
        }
 
+       /**
+        * @param $predicates array
+        * @return Status
+        */
        protected function doPrecheck( array &$predicates ) {
                $status = Status::newGood();
                // Check if the source file exists
@@ -582,6 +613,9 @@ class CopyFileOp extends FileOp {
                return $status; // safe to call attempt()
        }
 
+       /**
+        * @return Status
+        */
        protected function doAttempt() {
                // Do nothing if the src/dst paths are the same
                if ( $this->params['src'] !== $this->params['dst'] ) {
@@ -593,10 +627,16 @@ class CopyFileOp extends FileOp {
                return Status::newGood();
        }
 
+       /**
+        * @return array
+        */
        protected function doStoragePathsRead() {
                return array( $this->params['src'] );
        }
 
+       /**
+        * @return array
+        */
        protected function doStoragePathsChanged() {
                return array( $this->params['dst'] );
        }
@@ -611,10 +651,17 @@ class CopyFileOp extends FileOp {
  *     overwriteSame : override any existing file at destination
  */
 class MoveFileOp extends FileOp {
+       /**
+        * @return array
+        */
        protected function allowedParams() {
                return array( array( 'src', 'dst' ), array( 'overwrite', 'overwriteSame' ) );
        }
 
+       /**
+        * @param $predicates array
+        * @return Status
+        */
        protected function doPrecheck( array &$predicates ) {
                $status = Status::newGood();
                // Check if the source file exists
@@ -639,6 +686,9 @@ class MoveFileOp extends FileOp {
                return $status; // safe to call attempt()
        }
 
+       /**
+        * @return Status
+        */
        protected function doAttempt() {
                // Do nothing if the src/dst paths are the same
                if ( $this->params['src'] !== $this->params['dst'] ) {
@@ -654,10 +704,16 @@ class MoveFileOp extends FileOp {
                return Status::newGood();
        }
 
+       /**
+        * @return array
+        */
        protected function doStoragePathsRead() {
                return array( $this->params['src'] );
        }
 
+       /**
+        * @return array
+        */
        protected function doStoragePathsChanged() {
                return array( $this->params['src'], $this->params['dst'] );
        }
@@ -670,12 +726,19 @@ class MoveFileOp extends FileOp {
  *     ignoreMissingSource : don't return an error if the file does not exist
  */
 class DeleteFileOp extends FileOp {
+       /**
+        * @return array
+        */
        protected function allowedParams() {
                return array( array( 'src' ), array( 'ignoreMissingSource' ) );
        }
 
        protected $needsDelete = true;
 
+       /**
+        * @param array $predicates
+        * @return Status
+        */
        protected function doPrecheck( array &$predicates ) {
                $status = Status::newGood();
                // Check if the source file exists
@@ -692,6 +755,9 @@ class DeleteFileOp extends FileOp {
                return $status; // safe to call attempt()
        }
 
+       /**
+        * @return Status
+        */
        protected function doAttempt() {
                if ( $this->needsDelete ) {
                        // Delete the source file
@@ -700,6 +766,9 @@ class DeleteFileOp extends FileOp {
                return Status::newGood();
        }
 
+       /**
+        * @return array
+        */
        protected function doStoragePathsChanged() {
                return array( $this->params['src'] );
        }
index 9ffe0f2..8dc4cfc 100644 (file)
@@ -169,7 +169,7 @@ class FileOpBatch {
         * within any given sub-batch do not depend on each other.
         * This will abort remaining ops on failure.
         *
-        * @param $performOps Array
+        * @param $pPerformOps Array
         * @param $status Status
         * @return bool Success
         */
@@ -202,7 +202,7 @@ class FileOpBatch {
                        }
                        // Try to do all the operations concurrently...
                        $statuses = $statuses + $backend->executeOpHandlesInternal( $opHandles );
-                       // Marshall and merge all the responses...
+                       // Marshall and merge all the responses (blocking)...
                        foreach ( $performOpsBatch as $i => $fileOp ) {
                                if ( !$fileOp->failed() ) { // failed => already has Status
                                        $subStatus = $statuses[$i];
index 0be9a74..0a09894 100644 (file)
@@ -33,7 +33,7 @@ class DBFileJournal extends FileJournal {
         * Construct a new instance from configuration.
         * $config includes:
         *     'wiki' : wiki name to use for LoadBalancer
-        *
+        * 
         * @param $config Array
         */
        protected function __construct( array $config ) {
index d34b778..234788b 100644 (file)
@@ -43,7 +43,7 @@ abstract class FileJournal {
         * Construct a new instance from configuration.
         * $config includes:
         *     'ttlDays' : days to keep log entries around (false means "forever")
-        *
+        * 
         * @param $config Array
         */
        protected function __construct( array $config ) {
@@ -55,6 +55,7 @@ abstract class FileJournal {
         *
         * @param $config Array
         * @param $backend string A registered file backend name
+        * @throws MWException
         * @return FileJournal
         */
        final public static function factory( array $config, $backend ) {
@@ -69,7 +70,7 @@ abstract class FileJournal {
 
        /**
         * Get a statistically unique ID string
-        *
+        * 
         * @return string <9 char TS_MW timestamp in base 36><22 random base 36 chars>
         */
        final public function getTimestampedUUID() {
@@ -88,7 +89,7 @@ abstract class FileJournal {
         *     path    : The storage path of the file
         *     newSha1 : The final base 36 SHA-1 of the file
         * Note that 'false' should be used as the SHA-1 for non-existing files.
-        *
+        * 
         * @param $entries Array List of file operations (each an array of parameters)
         * @param $batchId string UUID string that identifies the operation batch
         * @return Status
@@ -102,7 +103,7 @@ abstract class FileJournal {
 
        /**
         * @see FileJournal::logChangeBatch()
-        *
+        * 
         * @param $entries Array List of file operations (each an array of parameters)
         * @param $batchId string UUID string that identifies the operation batch
         * @return Status
@@ -169,6 +170,8 @@ abstract class FileJournal {
 class NullFileJournal extends FileJournal {
        /**
         * @see FileJournal::logChangeBatch()
+        * @param $entries array
+        * @param $batchId string
         * @return Status
         */
        protected function doLogChangeBatch( array $entries, $batchId ) {
index 0a0ba54..c2a5085 100644 (file)
@@ -113,6 +113,8 @@ class DBLockManager extends LockManager {
 
        /**
         * @see LockManager::doLock()
+        * @param $paths array
+        * @param $type int
         * @return Status
         */
        protected function doLock( array $paths, $type ) {
@@ -164,6 +166,8 @@ class DBLockManager extends LockManager {
 
        /**
         * @see LockManager::doUnlock()
+        * @param $paths array
+        * @param $type int
         * @return Status
         */
        protected function doUnlock( array $paths, $type ) {
@@ -438,11 +442,21 @@ class MySqlLockManager extends DBLockManager {
                self::LOCK_EX => self::LOCK_EX
        );
 
+       /**
+        * @param $lockDb string
+        * @param $db DatabaseBase
+        */
        protected function initConnection( $lockDb, DatabaseBase $db ) {
                # Let this transaction see lock rows from other transactions
                $db->query( "SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;" );
        }
 
+       /**
+        * @param $lockDb string
+        * @param $paths array
+        * @param $type int
+        * @return bool
+        */
        protected function doLockingQuery( $lockDb, array $paths, $type ) {
                $db = $this->getConnection( $lockDb );
                if ( !$db ) {
index 21a3a4e..4f3b959 100644 (file)
@@ -62,6 +62,8 @@ class FSLockManager extends LockManager {
 
        /**
         * @see LockManager::doLock()
+        * @param $paths array
+        * @param $type int
         * @return Status
         */
        protected function doLock( array $paths, $type ) {
@@ -84,6 +86,8 @@ class FSLockManager extends LockManager {
 
        /**
         * @see LockManager::doUnlock()
+        * @param $paths array
+        * @param $type int
         * @return Status
         */
        protected function doUnlock( array $paths, $type ) {
@@ -190,6 +194,11 @@ class FSLockManager extends LockManager {
                return $status;
        }
 
+       /**
+        * @param $path string
+        * @param $handlesToClose array
+        * @return Status
+        */
        private function closeLockHandles( $path, array $handlesToClose ) {
                $status = Status::newGood();
                foreach ( $handlesToClose as $handle ) {
@@ -203,6 +212,10 @@ class FSLockManager extends LockManager {
                return $status;
        }
 
+       /**
+        * @param $path string
+        * @return Status
+        */
        private function pruneKeyLockFiles( $path ) {
                $status = Status::newGood();
                if ( !count( $this->locksHeld[$path] ) ) {
index 4f78ede..7910285 100644 (file)
@@ -93,6 +93,8 @@ class LSLockManager extends LockManager {
 
        /**
         * @see LockManager::doLock()
+        * @param $paths array
+        * @param $type int
         * @return Status
         */
        protected function doLock( array $paths, $type ) {
@@ -146,6 +148,8 @@ class LSLockManager extends LockManager {
 
        /**
         * @see LockManager::doUnlock()
+        * @param $paths array
+        * @param $type int
         * @return Status
         */
        protected function doUnlock( array $paths, $type ) {
index 8b3e229..e41c777 100644 (file)
@@ -195,6 +195,8 @@ class ScopedLock {
 class NullLockManager extends LockManager {
        /**
         * @see LockManager::doLock()
+        * @param $paths array
+        * @param $type int
         * @return Status
         */
        protected function doLock( array $paths, $type ) {
@@ -203,6 +205,8 @@ class NullLockManager extends LockManager {
 
        /**
         * @see LockManager::doUnlock()
+        * @param $paths array
+        * @param $type int
         * @return Status
         */
        protected function doUnlock( array $paths, $type ) {
index 7caff62..b830855 100644 (file)
@@ -39,6 +39,7 @@ class LockManagerGroup {
        protected $managers = array();
 
        protected function __construct() {}
+
        /**
         * @return LockManagerGroup
         */
index c9395c6..2d6b218 100644 (file)
@@ -109,6 +109,8 @@ abstract class File {
         */
        protected $url, $extension, $name, $path, $hashPath, $pageCount, $transformScript;
 
+       protected $redirectTitle;
+
        /**
         * @var bool
         */
@@ -143,6 +145,7 @@ abstract class File {
         *
         * @param $title Title|string
         * @param $exception string|bool Use 'exception' to throw an error on bad titles
+        * @throws MWException
         * @return Title|null
         */
        static function normalizeTitle( $title, $exception = false ) {
@@ -1017,7 +1020,7 @@ abstract class File {
         *
         * @return array
         */
-       function getHistory($limit = null, $start = null, $end = null, $inc=true) {
+       function getHistory( $limit = null, $start = null, $end = null, $inc=true ) {
                return array();
        }
 
index ef9c3a5..1fcd35b 100644 (file)
@@ -90,14 +90,26 @@ class ForeignAPIFile extends File {
        }
 
        // Dummy functions...
+
+       /**
+        * @return bool
+        */
        public function exists() {
                return $this->mExists;
        }
 
+       /**
+        * @return bool
+        */
        public function getPath() {
                return false;
        }
 
+       /**
+        * @param Array $params
+        * @param int $flags
+        * @return bool|MediaTransformOutput
+        */
        function transform( $params, $flags = 0 ) {
                if( !$this->canRender() ) {
                        // show icon
@@ -117,6 +129,11 @@ class ForeignAPIFile extends File {
        }
 
        // Info we can get from API...
+
+       /**
+        * @param $page int
+        * @return int|number
+        */
        public function getWidth( $page = 1 ) {
                return isset( $this->mInfo['width'] ) ? intval( $this->mInfo['width'] ) : 0;
        }
@@ -129,6 +146,9 @@ class ForeignAPIFile extends File {
                return isset( $this->mInfo['height'] ) ? intval( $this->mInfo['height'] ) : 0;
        }
 
+       /**
+        * @return bool|null|string
+        */
        public function getMetadata() {
                if ( isset( $this->mInfo['metadata'] ) ) {
                        return serialize( self::parseMetadata( $this->mInfo['metadata'] ) );
@@ -136,6 +156,10 @@ class ForeignAPIFile extends File {
                return null;
        }
 
+       /**
+        * @param $metadata array
+        * @return array
+        */
        public static function parseMetadata( $metadata ) {
                if( !is_array( $metadata ) ) {
                        return $metadata;
@@ -147,28 +171,47 @@ class ForeignAPIFile extends File {
                return $ret;
        }
 
+       /**
+        * @return bool|int|null
+        */
        public function getSize() {
                return isset( $this->mInfo['size'] ) ? intval( $this->mInfo['size'] ) : null;
        }
 
+       /**
+        * @return null|string
+        */
        public function getUrl() {
                return isset( $this->mInfo['url'] ) ? strval( $this->mInfo['url'] ) : null;
        }
 
+       /**
+        * @param string $method
+        * @return int|null|string
+        */
        public function getUser( $method='text' ) {
                return isset( $this->mInfo['user'] ) ? strval( $this->mInfo['user'] ) : null;
        }
 
+       /**
+        * @return null|string
+        */
        public function getDescription() {
                return isset( $this->mInfo['comment'] ) ? strval( $this->mInfo['comment'] ) : null;
        }
 
+       /**
+        * @return null|String
+        */
        function getSha1() {
                return isset( $this->mInfo['sha1'] )
                        ? wfBaseConvert( strval( $this->mInfo['sha1'] ), 16, 36, 31 )
                        : null;
        }
 
+       /**
+        * @return bool|Mixed|string
+        */
        function getTimestamp() {
                return wfTimestamp( TS_MW,
                        isset( $this->mInfo['timestamp'] )
@@ -177,6 +220,9 @@ class ForeignAPIFile extends File {
                );
        }
 
+       /**
+        * @return string
+        */
        function getMimeType() {
                if( !isset( $this->mInfo['mime'] ) ) {
                        $magic = MimeMagic::singleton();
@@ -185,12 +231,18 @@ class ForeignAPIFile extends File {
                return $this->mInfo['mime'];
        }
 
-       /// @todo FIXME: May guess wrong on file types that can be eg audio or video
+       /**
+        * @todo FIXME: May guess wrong on file types that can be eg audio or video
+        * @return int|string
+        */
        function getMediaType() {
                $magic = MimeMagic::singleton();
                return $magic->getMediaType( null, $this->getMimeType() );
        }
 
+       /**
+        * @return bool|string
+        */
        function getDescriptionUrl() {
                return isset( $this->mInfo['descriptionurl'] )
                        ? $this->mInfo['descriptionurl']
@@ -199,6 +251,7 @@ class ForeignAPIFile extends File {
 
        /**
         * Only useful if we're locally caching thumbs anyway...
+        * @param $suffix string
         * @return null|string
         */
        function getThumbPath( $suffix = '' ) {
@@ -213,6 +266,9 @@ class ForeignAPIFile extends File {
                }
        }
 
+       /**
+        * @return array
+        */
        function getThumbnails() {
                $dir = $this->getThumbPath( $this->getName() );
                $iter = $this->repo->getBackend()->getFileList( array( 'dir' => $dir ) );
@@ -242,6 +298,9 @@ class ForeignAPIFile extends File {
                $wgMemc->delete( $key );
        }
 
+       /**
+        * @param $options array
+        */
        function purgeThumbnails( $options = array() ) {
                global $wgMemc;
 
index fa7834a..91f6cb6 100644 (file)
@@ -54,23 +54,52 @@ class ForeignDBFile extends LocalFile {
                return $file;
        }
 
+       /**
+        * @param $srcPath String
+        * @param $flags int
+        * @throws MWException
+        */
        function publish( $srcPath, $flags = 0 ) {
                $this->readOnlyError();
        }
 
+       /**
+        * @param $oldver
+        * @param $desc string
+        * @param $license string
+        * @param $copyStatus string
+        * @param $source string
+        * @param $watch bool
+        * @param $timestamp bool|string
+        * @throws MWException
+        */
        function recordUpload( $oldver, $desc, $license = '', $copyStatus = '', $source = '',
                $watch = false, $timestamp = false ) {
                $this->readOnlyError();
        }
 
+       /**
+        * @param $versions array
+        * @param $unsuppress bool
+        * @throws MWException
+        */
        function restore( $versions = array(), $unsuppress = false ) {
                $this->readOnlyError();
        }
 
+       /**
+        * @param $reason string
+        * @param $suppress bool
+        * @throws MWException
+        */
        function delete( $reason, $suppress = false ) {
                $this->readOnlyError();
        }
 
+       /**
+        * @param $target Title
+        * @throws MWException
+        */
        function move( $target ) {
                $this->readOnlyError();
        }
index bd3ff1e..967cb9f 100644 (file)
@@ -32,6 +32,13 @@ class OldLocalFile extends LocalFile {
        const CACHE_VERSION = 1;
        const MAX_CACHE_ROWS = 20;
 
+       /**
+        * @param $title Title
+        * @param $repo FileRepo
+        * @param $time null
+        * @return OldLocalFile
+        * @throws MWException
+        */
        static function newFromTitle( $title, $repo, $time = null ) {
                # The null default value is only here to avoid an E_STRICT
                if ( $time === null ) {
@@ -40,10 +47,21 @@ class OldLocalFile extends LocalFile {
                return new self( $title, $repo, $time, null );
        }
 
+       /**
+        * @param $title Title
+        * @param $repo FileRepo
+        * @param $archiveName
+        * @return OldLocalFile
+        */
        static function newFromArchiveName( $title, $repo, $archiveName ) {
                return new self( $title, $repo, null, $archiveName );
        }
 
+       /**
+        * @param $row
+        * @param $repo FileRepo
+        * @return OldLocalFile
+        */
        static function newFromRow( $row, $repo ) {
                $title = Title::makeTitle( NS_FILE, $row->oi_name );
                $file = new self( $title, $repo, null, $row->oi_archive_name );
@@ -107,6 +125,7 @@ class OldLocalFile extends LocalFile {
         * @param $repo FileRepo
         * @param $time String: timestamp or null to load by archive name
         * @param $archiveName String: archive name or null to load by timestamp
+        * @throws MWException
         */
        function __construct( $title, $repo, $time, $archiveName ) {
                parent::__construct( $title, $repo );
@@ -117,10 +136,16 @@ class OldLocalFile extends LocalFile {
                }
        }
 
+       /**
+        * @return bool
+        */
        function getCacheKey() {
                return false;
        }
 
+       /**
+        * @return String
+        */
        function getArchiveName() {
                if ( !isset( $this->archive_name ) ) {
                        $this->load();
@@ -128,10 +153,16 @@ class OldLocalFile extends LocalFile {
                return $this->archive_name;
        }
 
+       /**
+        * @return bool
+        */
        function isOld() {
                return true;
        }
 
+       /**
+        * @return bool
+        */
        function isVisible() {
                return $this->exists() && !$this->isDeleted(File::DELETED_FILE);
        }
@@ -156,6 +187,10 @@ class OldLocalFile extends LocalFile {
                wfProfileOut( __METHOD__ );
        }
 
+       /**
+        * @param $prefix string
+        * @return array
+        */
        function getCacheFields( $prefix = 'img_' ) {
                $fields = parent::getCacheFields( $prefix );
                $fields[] = $prefix . 'archive_name';
@@ -163,10 +198,16 @@ class OldLocalFile extends LocalFile {
                return $fields;
        }
 
+       /**
+        * @return string
+        */
        function getRel() {
                return 'archive/' . $this->getHashPath() . $this->getArchiveName();
        }
 
+       /**
+        * @return string
+        */
        function getUrlRel() {
                return 'archive/' . $this->getHashPath() . rawurlencode( $this->getArchiveName() );
        }
@@ -235,14 +276,18 @@ class OldLocalFile extends LocalFile {
                $this->load();
                return Revision::userCanBitfield( $this->deleted, $field, $user );
        }
-       
+
        /**
         * Upload a file directly into archive. Generally for Special:Import.
-        * 
+        *
         * @param $srcPath string File system path of the source file
-        * @param $archiveName string Full archive name of the file, in the form 
-        *      $timestamp!$filename, where $filename must match $this->getName()
+        * @param $archiveName string Full archive name of the file, in the form
+        *     $timestamp!$filename, where $filename must match $this->getName()
         *
+        * @param $timestamp string
+        * @param $comment string
+        * @param $user
+        * @param $flags int
         * @return FileRepoStatus
         */
        function uploadOld( $srcPath, $archiveName, $timestamp, $comment, $user, $flags = 0 ) {
@@ -263,12 +308,13 @@ class OldLocalFile extends LocalFile {
                
                return $status;
        }
-       
+
        /**
         * Record a file upload in the oldimage table, without adding log entries.
-        * 
+        *
         * @param $srcPath string File system path to the source file
         * @param $archiveName string The archive name of the file
+        * @param $timestamp string
         * @param $comment string Upload comment
         * @param $user User User who did this upload
         * @return bool
index b217d60..8d4a3f8 100644 (file)
@@ -34,7 +34,7 @@
  * @ingroup FileAbstraction
  */
 class UnregisteredLocalFile extends File {
-       var $title, $path, $mime, $dims;
+       var $title, $path, $mime, $dims, $metadata;
 
        /**
         * @var MediaHandler
@@ -62,12 +62,12 @@ class UnregisteredLocalFile extends File {
        /**
         * Create an UnregisteredLocalFile based on a path or a (title,repo) pair.
         * A FileRepo object is not required here, unlike most other File classes.
-        * 
+        *
         * @throws MWException
         * @param $title Title|bool
-        * @param $repo FileRepo
-        * @param $path string
-        * @param $mime string
+        * @param $repo FileRepo|bool
+        * @param $path string|bool
+        * @param $mime string|bool
         */
        function __construct( $title = false, $repo = false, $path = false, $mime = false ) {
                if ( !( $title && $repo ) && !$path ) {
@@ -94,6 +94,10 @@ class UnregisteredLocalFile extends File {
                $this->dims = array();
        }
 
+       /**
+        * @param $page int
+        * @return bool
+        */
        private function cachePageDimensions( $page = 1 ) {
                if ( !isset( $this->dims[$page] ) ) {
                        if ( !$this->getHandler() ) {
@@ -104,16 +108,27 @@ class UnregisteredLocalFile extends File {
                return $this->dims[$page];
        }
 
+       /**
+        * @param $page int
+        * @return number
+        */
        function getWidth( $page = 1 ) {
                $dim = $this->cachePageDimensions( $page );
                return $dim['width'];
        }
 
+       /**
+        * @param $page int
+        * @return number
+        */
        function getHeight( $page = 1 ) {
                $dim = $this->cachePageDimensions( $page );
                return $dim['height'];
        }
 
+       /**
+        * @return bool|string
+        */
        function getMimeType() {
                if ( !isset( $this->mime ) ) {
                        $magic = MimeMagic::singleton();
@@ -122,6 +137,10 @@ class UnregisteredLocalFile extends File {
                return $this->mime;
        }
 
+       /**
+        * @param $filename String
+        * @return Array|bool
+        */
        function getImageSize( $filename ) {
                if ( !$this->getHandler() ) {
                        return false;
@@ -129,6 +148,9 @@ class UnregisteredLocalFile extends File {
                return $this->handler->getImageSize( $this, $this->getLocalRefPath() );
        }
 
+       /**
+        * @return bool
+        */
        function getMetadata() {
                if ( !isset( $this->metadata ) ) {
                        if ( !$this->getHandler() ) {
@@ -140,6 +162,9 @@ class UnregisteredLocalFile extends File {
                return $this->metadata;
        }
 
+       /**
+        * @return bool|string
+        */
        function getURL() {
                if ( $this->repo ) {
                        return $this->repo->getZoneUrl( 'public' ) . '/' .
@@ -149,6 +174,9 @@ class UnregisteredLocalFile extends File {
                }
        }
 
+       /**
+        * @return bool|int
+        */
        function getSize() {
                $this->assertRepoDefined();
                $props = $this->repo->getFileProps( $this->path );