r82427 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82426‎ | r82427 | r82428 >
Date:23:56, 18 February 2011
Author:reedy
Status:ok
Tags:
Comment:
More function level documentation
Modified paths:
  • /trunk/phase3/includes/filerepo/ArchivedFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/File.php (modified) (history)
  • /trunk/phase3/includes/filerepo/FileRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/FileRepoStatus.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignAPIFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/OldLocalFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/RepoGroup.php (modified) (history)
  • /trunk/phase3/includes/filerepo/UnregisteredLocalFile.php (modified) (history)
  • /trunk/phase3/includes/media/Generic.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/OldLocalFile.php
@@ -34,7 +34,14 @@
3535 $file->loadFromRow( $row, 'oi_' );
3636 return $file;
3737 }
38 -
 38+
 39+ /**
 40+ * @static
 41+ * @param $sha1
 42+ * @param $repo LocalRepo
 43+ * @param bool $timestamp
 44+ * @return bool|OldLocalFile
 45+ */
3946 static function newFromKey( $sha1, $repo, $timestamp = false ) {
4047 $conds = array( 'oi_sha1' => $sha1 );
4148 if( $timestamp ) {
Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -83,6 +83,9 @@
8484 /**
8585 * Create a LocalFile from a SHA-1 key
8686 * Do not call this except from inside a repo class.
 87+ * @param $sha1
 88+ * @param $repo LocalRepo
 89+ * @param $timestamp
8790 */
8891 static function newFromKey( $sha1, $repo, $timestamp = false ) {
8992 $conds = array( 'img_sha1' => $sha1 );
@@ -1292,7 +1295,13 @@
12931296 * @ingroup FileRepo
12941297 */
12951298 class LocalFileDeleteBatch {
1296 - var $file, $reason, $srcRels = array(), $archiveUrls = array(), $deletionBatch, $suppress;
 1299+
 1300+ /**
 1301+ * @var LocalFile
 1302+ */
 1303+ var $file;
 1304+
 1305+ var $reason, $srcRels = array(), $archiveUrls = array(), $deletionBatch, $suppress;
12971306 var $status;
12981307
12991308 function __construct( File $file, $reason = '', $suppress = false ) {
@@ -1603,8 +1612,13 @@
16041613 * @ingroup FileRepo
16051614 */
16061615 class LocalFileRestoreBatch {
1607 - var $file, $cleanupBatch, $ids, $all, $unsuppress = false;
 1616+ /**
 1617+ * @var LocalFile
 1618+ */
 1619+ var $file;
16081620
 1621+ var $cleanupBatch, $ids, $all, $unsuppress = false;
 1622+
16091623 function __construct( File $file, $unsuppress = false ) {
16101624 $this->file = $file;
16111625 $this->cleanupBatch = $this->ids = array();
Index: trunk/phase3/includes/filerepo/FileRepo.php
@@ -66,6 +66,8 @@
6767 * instance of the repository's old file class instead of a
6868 * current file. Repositories not supporting version control
6969 * should return false if this parameter is set.
 70+ *
 71+ * @return File
7072 */
7173 function newFile( $title, $time = false ) {
7274 if ( !($title instanceof Title) ) {
@@ -140,7 +142,7 @@
141143 return false;
142144 }
143145 $redir = $this->checkRedirect( $title );
144 - if( $redir && $redir->getNamespace() == NS_FILE) {
 146+ if( $redir && $title->getNamespace() == NS_FILE) {
145147 $img = $this->newFile( $redir );
146148 if( !$img ) {
147149 return false;
@@ -189,6 +191,8 @@
190192 * of the repository's old file class instead of a current
191193 * file. Repositories not supporting version control should
192194 * return false if this parameter is set.
 195+ *
 196+ * @return File
193197 */
194198 function newFileFromKey( $sha1, $time = false ) {
195199 if ( $time ) {
@@ -265,6 +269,7 @@
266270
267271 /**
268272 * Get the name of an image from its title object
 273+ * @param $title Title
269274 */
270275 function getNameFromTitle( $title ) {
271276 if ( $this->initialCapital != MWNamespace::isCapitalized( NS_FILE ) ) {
@@ -624,6 +629,7 @@
625630 * STUB
626631 *
627632 * @param $title Title of image
 633+ * @return Bool
628634 */
629635 function checkRedirect( $title ) {
630636 return false;
Index: trunk/phase3/includes/filerepo/FileRepoStatus.php
@@ -28,6 +28,9 @@
2929 return $result;
3030 }
3131
 32+ /**
 33+ * @param $repo FileRepo
 34+ */
3235 function __construct( $repo = false ) {
3336 if ( $repo ) {
3437 $this->cleanCallback = $repo->getErrorCleanupFunction();
Index: trunk/phase3/includes/filerepo/UnregisteredLocalFile.php
@@ -19,8 +19,13 @@
2020 * @ingroup FileRepo
2121 */
2222 class UnregisteredLocalFile extends File {
23 - var $title, $path, $mime, $handler, $dims;
 23+ var $title, $path, $mime, $dims;
2424
 25+ /**
 26+ * @var MediaHandler
 27+ */
 28+ var $handler;
 29+
2530 static function newFromPath( $path, $mime ) {
2631 return new UnregisteredLocalFile( false, false, $path, $mime );
2732 }
@@ -29,6 +34,13 @@
3035 return new UnregisteredLocalFile( $title, $repo, false, false );
3136 }
3237
 38+ /**
 39+ * @throws MWException
 40+ * @param bool $title
 41+ * @param $repo FSRepo
 42+ * @param bool $path
 43+ * @param bool $mime
 44+ */
3345 function __construct( $title = false, $repo = false, $path = false, $mime = false ) {
3446 if ( !( $title && $repo ) && !$path ) {
3547 throw new MWException( __METHOD__.': not enough parameters, must specify title and repo, or a full path' );
Index: trunk/phase3/includes/filerepo/File.php
@@ -52,9 +52,20 @@
5353 /**
5454 * The following member variables are not lazy-initialised
5555 */
56 - var $repo, $title, $lastError, $redirected, $redirectedTitle;
5756
5857 /**
 58+ * @var LocalRepo
 59+ */
 60+ var $repo;
 61+
 62+ /**
 63+ * @var Title
 64+ */
 65+ var $title;
 66+
 67+ var $lastError, $redirected, $redirectedTitle;
 68+
 69+ /**
5970 * Call this constructor from child classes
6071 */
6172 function __construct( $title, $repo ) {
@@ -1117,9 +1128,13 @@
11181129 if( $this->isLocal() ) {
11191130 global $wgParser;
11201131 $revision = Revision::newFromTitle( $this->title );
1121 - if ( !$revision ) return false;
 1132+ if ( !$revision ) {
 1133+ return false;
 1134+ }
11221135 $text = $revision->getText();
1123 - if ( !$text ) return false;
 1136+ if ( !$text ) {
 1137+ return false;
 1138+ }
11241139 $pout = $wgParser->parse( $text, $this->title, new ParserOptions() );
11251140 return $pout->getText();
11261141 }
Index: trunk/phase3/includes/filerepo/LocalRepo.php
@@ -133,6 +133,7 @@
134134 /**
135135 * Function link Title::getArticleID().
136136 * We can't say Title object, what database it should use, so we duplicate that function here.
 137+ * @param $title Title
137138 */
138139 protected function getArticleID( $title ) {
139140 if( !$title instanceof Title ) {
Index: trunk/phase3/includes/filerepo/RepoGroup.php
@@ -16,7 +16,13 @@
1717 * @ingroup FileRepo
1818 */
1919 class RepoGroup {
20 - var $localRepo, $foreignRepos, $reposInitialised = false;
 20+
 21+ /**
 22+ * @var LocalRepo
 23+ */
 24+ var $localRepo;
 25+
 26+ var $foreignRepos, $reposInitialised = false;
2127 var $localInfo, $foreignInfo;
2228 var $cache;
2329
Index: trunk/phase3/includes/filerepo/ForeignAPIFile.php
@@ -15,7 +15,13 @@
1616 class ForeignAPIFile extends File {
1717
1818 private $mExists;
19 -
 19+
 20+ /**
 21+ * @param $title
 22+ * @param $repo ForeignApiRepo
 23+ * @param $info
 24+ * @param bool $exists
 25+ */
2026 function __construct( $title, $repo, $info, $exists = false ) {
2127 parent::__construct( $title, $repo );
2228 $this->mInfo = $info;
Index: trunk/phase3/includes/filerepo/ArchivedFile.php
@@ -16,7 +16,6 @@
1717 * @private
1818 */
1919 var $id, # filearchive row ID
20 - $title, # image title
2120 $name, # image name
2221 $group, # FileStore storage group
2322 $key, # FileStore sha1 key
@@ -34,6 +33,11 @@
3534 $dataLoaded, # Whether or not all this has been loaded from the database (loadFromXxx)
3635 $deleted; # Bitfield akin to rev_deleted
3736
 37+ /**
 38+ * @var Title
 39+ */
 40+ var $title; # image title
 41+
3842 /**#@-*/
3943
4044 function __construct( $title, $id=0, $key='' ) {
Index: trunk/phase3/includes/media/Generic.php
@@ -21,6 +21,8 @@
2222
2323 /**
2424 * Get a MediaHandler for a given MIME type from the instance cache
 25+ *
 26+ * @return MediaHandler
2527 */
2628 static function getHandler( $type ) {
2729 global $wgMediaHandlers;

Status & tagging log