r104359 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104358‎ | r104359 | r104360 >
Date:19:27, 27 November 2011
Author:aaron
Status:deferred
Tags:
Comment:
* Optimized getFileProps() in FSFileBackend and moved code to "default" implementation code in FileBackend
* Marked public functions in FileRepo
* Added FileBackend::getFileTimestamp()
* Simplified TempFSFile code
* Removed some LocalFile FS access
* Various minor cleanups
* Documentation tweaks
Modified paths:
  • /branches/FileBackend/phase3/includes/filerepo/FileRepo.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/backend/FSFileBackend.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/backend/FileBackend.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/backend/FileBackendMultiWrite.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/file/FSFile.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/file/LocalFile.php (modified) (history)
  • /branches/FileBackend/phase3/includes/filerepo/file/TempFSFile.php (modified) (history)

Diff [purge]

Index: branches/FileBackend/phase3/includes/filerepo/file/LocalFile.php
@@ -234,7 +234,8 @@
235235 * Load metadata from the file itself
236236 */
237237 function loadFromFile() {
238 - $this->setProps( self::getPropsFromPath( $this->getPath() ) );
 238+ $props = $this->repo->getFileProps( $this->getVirtualUrl() );
 239+ $this->setProps( $props );
239240 }
240241
241242 function getCacheFields( $prefix = 'img_' ) {
@@ -748,9 +749,8 @@
749750 # Check that the base file name is part of the thumb name
750751 # This is a basic sanity check to avoid erasing unrelated directories
751752 if ( strpos( $file, $this->getName() ) !== false ) {
752 - wfSuppressWarnings();
753 - unlink( "$dir/$file" );
754 - wfRestoreWarnings();
 753+ $op = array( 'operation' => 'delete', 'source' => "$dir/$file" );
 754+ $this->repo->getBackend()->doOperations( array( $op ) );
755755 }
756756 }
757757 }
Index: branches/FileBackend/phase3/includes/filerepo/file/TempFSFile.php
@@ -2,24 +2,26 @@
33 /**
44 * @file
55 * @ingroup FileRepo
 6+ * @ingroup FileBackend
67 */
78
89 /**
910 * This class is used to hold the location and do limited manipulation
1011 * of files stored temporarily (usually this will be $wgTmpDirectory)
 12+ *
 13+ * @ingroup FileRepo
 14+ * @ingroup FileBackend
1115 */
1216 class TempFSFile extends FSFile {
13 - protected $canDelete; // whether this object should garbage collect the temp file
 17+ protected $canDelete = true; // garbage collect the temp file
1418
1519 /**
16 - * Sets up the temporary file object
 20+ * Flag to not clean up after the temporary file
1721 *
18 - * @param String $path Path to temporary file on local disk
19 - * @param Boolean $canDelete Whether this object should garbage collect the temp file
 22+ * @return void
2023 */
21 - public function __construct( $path, $canDelete = true ) {
22 - $this->path = $path;
23 - $this->canDelete = $canDelete;
 24+ public function preserve() {
 25+ $this->canDelete = false;
2426 }
2527
2628 /**
Index: branches/FileBackend/phase3/includes/filerepo/file/FSFile.php
@@ -2,10 +2,14 @@
33 /**
44 * @file
55 * @ingroup FileRepo
 6+ * @ingroup FileBackend
67 */
78
89 /**
910 * Class representing a non-directory file on the file system
 11+ *
 12+ * @ingroup FileRepo
 13+ * @ingroup FileBackend
1014 */
1115 class FSFile {
1216 protected $path; // path to file
@@ -38,6 +42,19 @@
3943 }
4044
4145 /**
 46+ * Get the file's last-modified timestamp
 47+ *
 48+ * @return string|false TS_MW timestamp or false on failure
 49+ */
 50+ public function getTimestamp() {
 51+ $timestamp = filemtime( $this->path );
 52+ if ( $timestamp !== false ) {
 53+ $timestamp = wfTimestamp( TS_MW, $ts );
 54+ }
 55+ return $timestamp;
 56+ }
 57+
 58+ /**
4259 * Get an associative array containing information about
4360 * a file with the given storage path.
4461 *
Index: branches/FileBackend/phase3/includes/filerepo/backend/FileBackendMultiWrite.php
@@ -2,6 +2,7 @@
33 /**
44 * @file
55 * @ingroup FileRepo
 6+ * @ingroup FileBackend
67 */
78
89 /**
@@ -20,6 +21,9 @@
2122 *
2223 * All write operations are performed on all backends.
2324 * If an operation fails on one backend it will be rolled back from the others.
 25+ *
 26+ * @ingroup FileRepo
 27+ * @ingroup FileBackend
2428 */
2529 class FileBackendMultiWrite extends FileBackendBase {
2630 /** @var Array Prioritized list of FileBackend objects */
Index: branches/FileBackend/phase3/includes/filerepo/backend/FSFileBackend.php
@@ -2,12 +2,16 @@
33 /**
44 * @file
55 * @ingroup FileRepo
 6+ * @ingroup FileBackend
67 */
78
89 /**
910 * Class for a file-system based file backend.
1011 * Status messages should avoid mentioning the internal FS paths.
1112 * Likewise, error suppression should be used to path disclosure.
 13+ *
 14+ * @ingroup FileRepo
 15+ * @ingroup FileBackend
1216 */
1317 class FSFileBackend extends FileBackend {
1418 /** @var Array Map of container names to paths */
@@ -307,12 +311,10 @@
308312 if ( !wfMkdirParents( $dir ) ) {
309313 $status->fatal( 'directorycreateerror', $param['directory'] );
310314 return $status;
311 - }
312 - if ( !is_writable( $dir ) ) {
 315+ } elseif ( !is_writable( $dir ) ) {
313316 $status->fatal( 'directoryreadonlyerror', $param['directory'] );
314317 return $status;
315 - }
316 - if ( !is_readable( $dir ) ) {
 318+ } elseif ( !is_readable( $dir ) ) {
317319 $status->fatal( 'directorynotreadableerror', $param['directory'] );
318320 return $status;
319321 }
@@ -373,13 +375,22 @@
374376 return md5_file( $source );
375377 }
376378
 379+ function getFileTimestamp( array $params ) {
 380+ list( $c, $source ) = $this->resolveVirtualPath( $params['source'] );
 381+ if ( $source === null ) {
 382+ return false; // invalid storage path
 383+ }
 384+ $fsFile = new FSFile( $source );
 385+ return $fsFile->getTimestamp();
 386+ }
 387+
377388 function getFileProps( array $params ) {
378 - $tmpFile = $this->getLocalCopy( $params );
379 - if ( !$tmpFile ) {
380 - return FSFile::placeholderProps();
381 - } else {
382 - return $tmpFile->getProps();
 389+ list( $c, $source ) = $this->resolveVirtualPath( $params['source'] );
 390+ if ( $source === null ) {
 391+ return FSFile::placeholderProps(); // invalid storage path
383392 }
 393+ $fsFile = new FSFile( $source );
 394+ return $fsFile->getProps();
384395 }
385396
386397 function getFileList( array $params ) {
Index: branches/FileBackend/phase3/includes/filerepo/backend/FileBackend.php
@@ -2,6 +2,7 @@
33 /**
44 * @file
55 * @ingroup FileRepo
 6+ * @ingroup FileBackend
67 */
78
89 /**
@@ -16,6 +17,9 @@
1718 *
1819 * Methods should avoid throwing exceptions at all costs.
1920 * As a corollary, external dependencies should be kept to a minimum.
 21+ *
 22+ * @ingroup FileRepo
 23+ * @ingroup FileBackend
2024 */
2125 abstract class FileBackendBase {
2226 protected $name; // unique backend name
@@ -111,13 +115,13 @@
112116 abstract public function fileExists( array $params );
113117
114118 /**
115 - * Get a hash of the file that exists at a storage path in the backend.
 119+ * Get a hash of the file at a storage path in the backend.
116120 * Typically this will be a SHA-1 hash, MD5 hash, or something similar.
117121 * $params include:
118122 * source : source storage path
119123 *
120124 * @param Array $params
121 - * @return string|null Gives null if the file does not exist
 125+ * @return string|false Hash string or false on failure
122126 */
123127 abstract public function getFileHash( array $params );
124128
@@ -129,17 +133,28 @@
130134 abstract public function getHashType();
131135
132136 /**
133 - * Get the properties of the file that exists at a storage path in the backend
 137+ * Get the last-modified timestamp of the file at a storage path.
134138 * $params include:
135139 * source : source storage path
136140 *
137141 * @param Array $params
138 - * @return Array|null Gives null if the file does not exist
 142+ * @return string|false TS_MW timestamp or false on failure
139143 */
 144+ abstract public function getFileTimestamp( array $params );
 145+
 146+ /**
 147+ * Get the properties of the file at a storage path in the backend.
 148+ * Returns FSFile::placeholderProps() on failure.
 149+ * $params include:
 150+ * source : source storage path
 151+ *
 152+ * @param Array $params
 153+ * @return Array
 154+ */
140155 abstract public function getFileProps( array $params );
141156
142157 /**
143 - * Stream the file that exists at a storage path in the backend.
 158+ * Stream the file at a storage path in the backend.
144159 * Appropriate HTTP headers (Status, Content-Type, Content-Length)
145160 * must be sent if streaming began, while none should be sent otherwise.
146161 * Implementations should flush the output buffer before sending data.
@@ -202,6 +217,9 @@
203218 /**
204219 * Base class for all single-write backends.
205220 * This class defines the methods as abstract that subclasses must implement.
 221+ *
 222+ * @ingroup FileRepo
 223+ * @ingroup FileBackend
206224 */
207225 abstract class FileBackend extends FileBackendBase {
208226 /**
@@ -308,6 +326,15 @@
309327 return false; // not implemented
310328 }
311329
 330+ public function getFileProps( array $params ) {
 331+ $tmpFile = $this->getLocalCopy( $params );
 332+ if ( !$tmpFile ) {
 333+ return FSFile::placeholderProps();
 334+ } else {
 335+ return $tmpFile->getProps();
 336+ }
 337+ }
 338+
312339 /**
313340 * Get the list of supported operations and their corresponding FileOp classes.
314341 *
@@ -482,7 +509,7 @@
483510 *
484511 * @param $container string
485512 * @param $relStoragePath string
486 - * @return string|null Null if path is not valid
 513+ * @return string|null Path or null if not valid
487514 */
488515 protected function resolveContainerPath( $container, $relStoragePath ) {
489516 return $relStoragePath;
Index: branches/FileBackend/phase3/includes/filerepo/FileRepo.php
@@ -215,7 +215,7 @@
216216 * @param $url string
217217 * @return bool
218218 */
219 - static function isVirtualUrl( $url ) {
 219+ public static function isVirtualUrl( $url ) {
220220 return substr( $url, 0, 9 ) == 'mwrepo://';
221221 }
222222
@@ -227,7 +227,7 @@
228228 * @param $suffix string
229229 * @return string
230230 */
231 - function getVirtualUrl( $suffix = false ) {
 231+ public function getVirtualUrl( $suffix = false ) {
232232 $path = 'mwrepo://' . $this->name;
233233 if ( $suffix !== false ) {
234234 $path .= '/' . rawurlencode( $suffix );
@@ -241,7 +241,7 @@
242242 * @param $zone String: one of: public, deleted, temp, thumb
243243 * @return String or false
244244 */
245 - function getZoneUrl( $zone ) {
 245+ public function getZoneUrl( $zone ) {
246246 switch ( $zone ) {
247247 case 'public':
248248 return $this->url;
@@ -300,7 +300,7 @@
301301 * @param $zone string
302302 * @return string|null
303303 */
304 - function getZonePath( $zone ) {
 304+ public function getZonePath( $zone ) {
305305 list( $container, $base ) = $this->getZoneLocation( $zone );
306306 if ( $container === null || $base === null ) {
307307 return null;
@@ -320,7 +320,7 @@
321321 * should return false if this parameter is set.
322322 * @return File|null A File, or null if passed an invalid Title
323323 */
324 - function newFile( $title, $time = false ) {
 324+ public function newFile( $title, $time = false ) {
325325 $title = File::normalizeTitle( $title );
326326 if ( !$title ) {
327327 return null;
@@ -354,7 +354,7 @@
355355 * be found.
356356 * @return File|false
357357 */
358 - function findFile( $title, $options = array() ) {
 358+ public function findFile( $title, $options = array() ) {
359359 $title = File::normalizeTitle( $title );
360360 if ( !$title ) {
361361 return false;
@@ -409,7 +409,7 @@
410410 * $repo->findFiles( $findBatch );
411411 * @return array
412412 */
413 - function findFiles( $items ) {
 413+ public function findFiles( $items ) {
414414 $result = array();
415415 foreach ( $items as $item ) {
416416 if ( is_array( $item ) ) {
@@ -437,7 +437,7 @@
438438 * @param $options Option array, same as findFile().
439439 * @return File|false
440440 */
441 - function findFileFromKey( $sha1, $options = array() ) {
 441+ public function findFileFromKey( $sha1, $options = array() ) {
442442 $time = isset( $options['time'] ) ? $options['time'] : false;
443443
444444 # First try to find a matching current version of a file...
@@ -468,7 +468,7 @@
469469 *
470470 * @return string
471471 */
472 - function getRootUrl() {
 472+ public function getRootUrl() {
473473 return $this->url;
474474 }
475475
@@ -477,7 +477,7 @@
478478 *
479479 * @return string
480480 */
481 - function isHashed() {
 481+ public function isHashed() {
482482 return (bool)$this->hashLevels;
483483 }
484484
@@ -486,7 +486,7 @@
487487 *
488488 * @return string
489489 */
490 - function getThumbScriptUrl() {
 490+ public function getThumbScriptUrl() {
491491 return $this->thumbScriptUrl;
492492 }
493493
@@ -495,7 +495,7 @@
496496 *
497497 * @return bool
498498 */
499 - function canTransformVia404() {
 499+ public function canTransformVia404() {
500500 return $this->transformVia404;
501501 }
502502
@@ -504,9 +504,9 @@
505505 *
506506 * @param $title Title
507507 */
508 - function getNameFromTitle( Title $title ) {
 508+ public function getNameFromTitle( Title $title ) {
 509+ global $wgContLang;
509510 if ( $this->initialCapital != MWNamespace::isCapitalized( NS_FILE ) ) {
510 - global $wgContLang;
511511 $name = $title->getUserCaseDBKey();
512512 if ( $this->initialCapital ) {
513513 $name = $wgContLang->ucfirst( $name );
@@ -536,11 +536,11 @@
537537 }
538538
539539 /**
540 - * Get the public root directory of the repository.
 540+ * Get the public zone root directory of the repository.
541541 *
542542 * @return string
543543 */
544 - function getRootDirectory() {
 544+ public function getRootDirectory() {
545545 return $this->getZonePath( 'public' );
546546 }
547547
@@ -551,7 +551,7 @@
552552 * @param $name string
553553 * @return string
554554 */
555 - function getHashPath( $name ) {
 555+ public function getHashPath( $name ) {
556556 return self::getHashPathForLevel( $name, $this->hashLevels );
557557 }
558558
@@ -560,7 +560,7 @@
561561 *
562562 * @return string
563563 */
564 - function getName() {
 564+ public function getName() {
565565 return $this->name;
566566 }
567567
@@ -571,7 +571,7 @@
572572 * @param $entry string Entry point; defaults to index
573573 * @return string
574574 */
575 - function makeUrl( $query = '', $entry = 'index' ) {
 575+ public function makeUrl( $query = '', $entry = 'index' ) {
576576 $ext = isset( $this->scriptExtension ) ? $this->scriptExtension : '.php';
577577 return wfAppendQuery( "{$this->scriptDirUrl}/{$entry}{$ext}", $query );
578578 }
@@ -588,7 +588,7 @@
589589 * @param $name string
590590 * @return string
591591 */
592 - function getDescriptionUrl( $name ) {
 592+ public function getDescriptionUrl( $name ) {
593593 $encName = wfUrlencode( $name );
594594 if ( !is_null( $this->descBaseUrl ) ) {
595595 # "http://example.com/wiki/Image:"
@@ -623,7 +623,7 @@
624624 * @param $lang String: language to fetch it in, if any.
625625 * @return string
626626 */
627 - function getDescriptionRenderUrl( $name, $lang = null ) {
 627+ public function getDescriptionRenderUrl( $name, $lang = null ) {
628628 $query = 'action=render';
629629 if ( !is_null( $lang ) ) {
630630 $query .= '&uselang=' . $lang;
@@ -645,9 +645,10 @@
646646
647647 /**
648648 * Get the URL of the stylesheet to apply to description pages
 649+ *
649650 * @return string
650651 */
651 - function getDescriptionStylesheetUrl() {
 652+ public function getDescriptionStylesheetUrl() {
652653 if ( $this->scriptDirUrl ) {
653654 return $this->makeUrl( 'title=MediaWiki:Filepage.css&' .
654655 wfArrayToCGI( Skin::getDynamicStylesheetQuery() ) );
@@ -667,7 +668,7 @@
668669 * same contents as the source
669670 * @return FileRepoStatus
670671 */
671 - function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
 672+ public function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
672673 $status = $this->storeBatch( array( array( $srcPath, $dstZone, $dstRel ) ), $flags );
673674 if ( $status->successCount == 0 ) {
674675 $status->ok = false;
@@ -686,7 +687,7 @@
687688 * same contents as the source
688689 * @return FileRepoStatus
689690 */
690 - function storeBatch( $triplets, $flags = 0 ) {
 691+ public function storeBatch( $triplets, $flags = 0 ) {
691692 $backend = $this->backend; // convenience
692693
693694 // Try creating directories
@@ -767,7 +768,7 @@
768769 * @param $pairs array List of files to delete
769770 * @return void
770771 */
771 - function cleanupBatch( $files ) {
 772+ public function cleanupBatch( $files ) {
772773 $operations = array();
773774 $sourceFSFilesToDelete = array(); // cleanup for disk source files
774775 foreach ( $files as $file ) {
@@ -815,7 +816,7 @@
816817 * @param $srcPath String: the current location of the file.
817818 * @return FileRepoStatus object with the URL in the value.
818819 */
819 - function storeTemp( $originalName, $srcPath ) {
 820+ public function storeTemp( $originalName, $srcPath ) {
820821 $date = gmdate( "YmdHis" );
821822 $hashPath = $this->getHashPath( $originalName );
822823 $dstRel = "{$hashPath}{$date}!{$originalName}";
@@ -831,7 +832,7 @@
832833 * @param $virtualUrl String: the virtual URL returned by storeTemp
833834 * @return Boolean: true on success, false on failure
834835 */
835 - function freeTemp( $virtualUrl ) {
 836+ public function freeTemp( $virtualUrl ) {
836837 $temp = "mwrepo://{$this->name}/temp";
837838 if ( substr( $virtualUrl, 0, strlen( $temp ) ) != $temp ) {
838839 wfDebug( __METHOD__.": Invalid temp virtual URL\n" );
@@ -857,7 +858,7 @@
858859 * @param $flags Integer: bitfield, may be FileRepo::DELETE_SOURCE to indicate
859860 * that the source file should be deleted if possible
860861 */
861 - function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
 862+ public function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
862863 $status = $this->publishBatch( array( array( $srcPath, $dstRel, $archiveRel ) ), $flags );
863864 if ( $status->successCount == 0 ) {
864865 $status->ok = false;
@@ -878,7 +879,7 @@
879880 * that the source files should be deleted if possible
880881 * @return FileRepoStatus
881882 */
882 - function publishBatch( $triplets, $flags = 0 ) {
 883+ public function publishBatch( $triplets, $flags = 0 ) {
883884 $backend = $this->backend; // convenience
884885
885886 // Try creating directories
@@ -978,7 +979,7 @@
979980 * self::FILES_ONLY Mark file as existing only if it is a file (not directory)
980981 * @return bool
981982 */
982 - function fileExists( $file, $flags = 0 ) {
 983+ public function fileExists( $file, $flags = 0 ) {
983984 $result = $this->fileExistsBatch( array( $file ), $flags );
984985 return $result[0];
985986 }
@@ -991,7 +992,7 @@
992993 * self::FILES_ONLY Mark file as existing only if it is a file (not directory)
993994 * @return Either array of files and existence flags, or false
994995 */
995 - function fileExistsBatch( $files, $flags = 0 ) {
 996+ public function fileExistsBatch( $files, $flags = 0 ) {
996997 if ( !$this->initZones() ) {
997998 return false;
998999 }
@@ -1024,7 +1025,7 @@
10251026 * Relative to a private archive directory.
10261027 * @return FileRepoStatus object
10271028 */
1028 - function delete( $srcRel, $archiveRel ) {
 1029+ public function delete( $srcRel, $archiveRel ) {
10291030 return $this->deleteBatch( array( array( $srcRel, $archiveRel ) ) );
10301031 }
10311032
@@ -1044,7 +1045,7 @@
10451046 * to the deleted zone root in the second element.
10461047 * @return FileRepoStatus
10471048 */
1048 - function deleteBatch( $sourceDestPairs ) {
 1049+ public function deleteBatch( $sourceDestPairs ) {
10491050 $backend = $this->backend; // convenience
10501051
10511052 if ( !isset( $this->zones['deleted'] ) ) {
@@ -1111,7 +1112,7 @@
11121113 *
11131114 * @return string
11141115 */
1115 - function getDeletedHashPath( $key ) {
 1116+ public function getDeletedHashPath( $key ) {
11161117 $path = '';
11171118 for ( $i = 0; $i < $this->deletedHashLevels; $i++ ) {
11181119 $path .= $key[$i] . '/';
@@ -1122,12 +1123,12 @@
11231124 /**
11241125 * Get properties of a file with a given virtual URL
11251126 * The virtual URL must refer to this repo
1126 - * Properties should ultimately be obtained via File::getPropsFromPath()
 1127+ * Properties should ultimately be obtained via FSFile::getProps()
11271128 *
11281129 * @param $virtualUrl string
11291130 * @return Array
11301131 */
1131 - function getFileProps( $virtualUrl ) {
 1132+ public function getFileProps( $virtualUrl ) {
11321133 $path = $this->resolveVirtualUrl( $virtualUrl );
11331134 return $this->backend->getFileProps( $path );
11341135 }
@@ -1139,7 +1140,7 @@
11401141 * @param $callback Array|string
11411142 * @return void
11421143 */
1143 - function enumFiles( $callback ) {
 1144+ public function enumFiles( $callback ) {
11441145 return $this->enumFilesInStorage( $callback );
11451146 }
11461147
@@ -1150,7 +1151,7 @@
11511152 * @param $callback Array|string
11521153 * @return void
11531154 */
1154 - function enumFilesInStorage( $callback ) {
 1155+ protected function enumFilesInStorage( $callback ) {
11551156 $publicRoot = $this->getZonePath( 'public' );
11561157 $numDirs = 1 << ( $this->hashLevels * 4 );
11571158 // Use a priori assumptions about directory structure
@@ -1175,7 +1176,7 @@
11761177 * @param $filename string
11771178 * @return bool
11781179 */
1179 - function validateFilename( $filename ) {
 1180+ public function validateFilename( $filename ) {
11801181 if ( strval( $filename ) == '' ) {
11811182 return false;
11821183 }
@@ -1284,7 +1285,7 @@
12851286 *
12861287 * STUB
12871288 */
1288 - function cleanupDeletedBatch( $storageKeys ) {}
 1289+ public function cleanupDeletedBatch( $storageKeys ) {}
12891290
12901291 /**
12911292 * Checks if there is a redirect named as $title. If there is, return the
@@ -1294,7 +1295,7 @@
12951296 * @param $title Title of image
12961297 * @return Bool
12971298 */
1298 - function checkRedirect( Title $title ) {
 1299+ public function checkRedirect( Title $title ) {
12991300 return false;
13001301 }
13011302
@@ -1305,7 +1306,7 @@
13061307 * STUB
13071308 * @param $title Title of image
13081309 */
1309 - function invalidateImageRedirect( Title $title ) {}
 1310+ public function invalidateImageRedirect( Title $title ) {}
13101311
13111312 /**
13121313 * Get an array or iterator of file objects for files that have a given
@@ -1313,7 +1314,7 @@
13141315 *
13151316 * STUB
13161317 */
1317 - function findBySha1( $hash ) {
 1318+ public function findBySha1( $hash ) {
13181319 return array();
13191320 }
13201321
@@ -1336,7 +1337,7 @@
13371338 *
13381339 * @return bool
13391340 */
1340 - function isLocal() {
 1341+ public function isLocal() {
13411342 return $this->getName() == 'local';
13421343 }
13431344
@@ -1355,6 +1356,8 @@
13561357 * Get a key for this repo in the local cache domain. These cache keys are
13571358 * not shared with remote instances of the repo.
13581359 * The parameters are the parts of the key, as for wfMemcKey().
 1360+ *
 1361+ * @return string
13591362 */
13601363 function getLocalCacheKey( /*...*/ ) {
13611364 $args = func_get_args();
@@ -1367,7 +1370,7 @@
13681371 *
13691372 * @return UploadStash
13701373 */
1371 - function getUploadStash() {
 1374+ public function getUploadStash() {
13721375 return new UploadStash( $this );
13731376 }
13741377 }

Status & tagging log