Index: trunk/phase3/includes/filerepo/OldLocalFile.php |
— | — | @@ -11,15 +11,15 @@ |
12 | 12 | const CACHE_VERSION = 1; |
13 | 13 | const MAX_CACHE_ROWS = 20; |
14 | 14 | |
15 | | - function newFromTitle( $title, $repo, $time ) { |
| 15 | + static function newFromTitle( $title, $repo, $time ) { |
16 | 16 | return new self( $title, $repo, $time, null ); |
17 | 17 | } |
18 | 18 | |
19 | | - function newFromArchiveName( $title, $repo, $archiveName ) { |
| 19 | + static function newFromArchiveName( $title, $repo, $archiveName ) { |
20 | 20 | return new self( $title, $repo, null, $archiveName ); |
21 | 21 | } |
22 | 22 | |
23 | | - function newFromRow( $row, $repo ) { |
| 23 | + static function newFromRow( $row, $repo ) { |
24 | 24 | $title = Title::makeTitle( NS_IMAGE, $row->oi_name ); |
25 | 25 | $file = new self( $title, $repo, null, $row->oi_archive_name ); |
26 | 26 | $file->loadFromRow( $row, 'oi_' ); |
Index: trunk/phase3/includes/filerepo/LocalFile.php |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | * Create a LocalFile from a title |
54 | 54 | * Do not call this except from inside a repo class. |
55 | 55 | */ |
56 | | - function newFromTitle( $title, $repo ) { |
| 56 | + static function newFromTitle( $title, $repo ) { |
57 | 57 | return new self( $title, $repo ); |
58 | 58 | } |
59 | 59 | |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | * Create a LocalFile from a title |
62 | 62 | * Do not call this except from inside a repo class. |
63 | 63 | */ |
64 | | - function newFromRow( $row, $repo ) { |
| 64 | + static function newFromRow( $row, $repo ) { |
65 | 65 | $title = Title::makeTitle( NS_IMAGE, $row->img_name ); |
66 | 66 | $file = new self( $title, $repo ); |
67 | 67 | $file->loadFromRow( $row ); |
— | — | @@ -1333,7 +1333,7 @@ |
1334 | 1334 | * Do not use in core code. |
1335 | 1335 | * @deprecated |
1336 | 1336 | */ |
1337 | | - function newFromTitle( $title, $time = false ) { |
| 1337 | + static function newFromTitle( $title, $time = false ) { |
1338 | 1338 | $img = wfFindFile( $title, $time ); |
1339 | 1339 | if ( !$img ) { |
1340 | 1340 | $img = wfLocalFile( $title ); |
— | — | @@ -1342,6 +1342,27 @@ |
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | /** |
| 1346 | + * Wrapper for wfFindFile(), for backwards-compatibility only. |
| 1347 | + * Do not use in core code. |
| 1348 | + * |
| 1349 | + * @param string $name name of the image, used to create a title object using Title::makeTitleSafe |
| 1350 | + * @return image object or null if invalid title |
| 1351 | + * @deprecated |
| 1352 | + */ |
| 1353 | + static function newFromName( $name ) { |
| 1354 | + $title = Title::makeTitleSafe( NS_IMAGE, $name ); |
| 1355 | + if ( is_object( $title ) ) { |
| 1356 | + $img = wfFindFile( $title ); |
| 1357 | + if ( !$img ) { |
| 1358 | + $img = wfLocalFile( $title ); |
| 1359 | + } |
| 1360 | + return $img; |
| 1361 | + } else { |
| 1362 | + return NULL; |
| 1363 | + } |
| 1364 | + } |
| 1365 | + |
| 1366 | + /** |
1346 | 1367 | * Return the URL of an image, provided its name. |
1347 | 1368 | * |
1348 | 1369 | * Backwards-compatibility for extensions. |
Index: trunk/phase3/includes/filerepo/UnregisteredLocalFile.php |
— | — | @@ -13,11 +13,11 @@ |
14 | 14 | class UnregisteredLocalFile extends File { |
15 | 15 | var $title, $path, $mime, $handler, $dims; |
16 | 16 | |
17 | | - function newFromPath( $path, $mime ) { |
| 17 | + static function newFromPath( $path, $mime ) { |
18 | 18 | return new UnregisteredLocalFile( false, false, $path, $mime ); |
19 | 19 | } |
20 | 20 | |
21 | | - function newFromTitle( $title, $repo ) { |
| 21 | + static function newFromTitle( $title, $repo ) { |
22 | 22 | return new UnregisteredLocalFile( $title, $repo, false, false ); |
23 | 23 | } |
24 | 24 | |
Index: trunk/phase3/includes/filerepo/ForeignDBFile.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class ForeignDBFile extends LocalFile { |
5 | | - function newFromTitle( $title, $repo ) { |
| 5 | + static function newFromTitle( $title, $repo ) { |
6 | 6 | return new self( $title, $repo ); |
7 | 7 | } |
8 | 8 | |