Index: trunk/phase3/includes/filerepo/OldLocalFile.php |
— | — | @@ -11,7 +11,10 @@ |
12 | 12 | const CACHE_VERSION = 1; |
13 | 13 | const MAX_CACHE_ROWS = 20; |
14 | 14 | |
15 | | - static function newFromTitle( $title, $repo, $time ) { |
| 15 | + static function newFromTitle( $title, $repo, $time = null ) { |
| 16 | + # The null default value is only here to avoid an E_STRICT |
| 17 | + if( $time === null ) |
| 18 | + throw new MWException( __METHOD__.' got null for $time parameter' ); |
16 | 19 | return new self( $title, $repo, $time, null ); |
17 | 20 | } |
18 | 21 | |
Index: trunk/phase3/includes/filerepo/LocalFile.php |
— | — | @@ -56,8 +56,10 @@ |
57 | 57 | /** |
58 | 58 | * Create a LocalFile from a title |
59 | 59 | * Do not call this except from inside a repo class. |
| 60 | + * |
| 61 | + * Note: $unused param is only here to avoid an E_STRICT |
60 | 62 | */ |
61 | | - static function newFromTitle( $title, $repo ) { |
| 63 | + static function newFromTitle( $title, $repo, $unused = null ) { |
62 | 64 | return new self( $title, $repo ); |
63 | 65 | } |
64 | 66 | |
— | — | @@ -1091,75 +1093,6 @@ |
1092 | 1094 | #------------------------------------------------------------------------------ |
1093 | 1095 | |
1094 | 1096 | /** |
1095 | | - * Backwards compatibility class |
1096 | | - */ |
1097 | | -class Image extends LocalFile { |
1098 | | - function __construct( $title ) { |
1099 | | - $repo = RepoGroup::singleton()->getLocalRepo(); |
1100 | | - parent::__construct( $title, $repo ); |
1101 | | - } |
1102 | | - |
1103 | | - /** |
1104 | | - * Wrapper for wfFindFile(), for backwards-compatibility only |
1105 | | - * Do not use in core code. |
1106 | | - * @deprecated |
1107 | | - */ |
1108 | | - static function newFromTitle( $title, $time = false ) { |
1109 | | - $img = wfFindFile( $title, $time ); |
1110 | | - if ( !$img ) { |
1111 | | - $img = wfLocalFile( $title ); |
1112 | | - } |
1113 | | - return $img; |
1114 | | - } |
1115 | | - |
1116 | | - /** |
1117 | | - * Wrapper for wfFindFile(), for backwards-compatibility only. |
1118 | | - * Do not use in core code. |
1119 | | - * |
1120 | | - * @param string $name name of the image, used to create a title object using Title::makeTitleSafe |
1121 | | - * @return image object or null if invalid title |
1122 | | - * @deprecated |
1123 | | - */ |
1124 | | - static function newFromName( $name ) { |
1125 | | - $title = Title::makeTitleSafe( NS_IMAGE, $name ); |
1126 | | - if ( is_object( $title ) ) { |
1127 | | - $img = wfFindFile( $title ); |
1128 | | - if ( !$img ) { |
1129 | | - $img = wfLocalFile( $title ); |
1130 | | - } |
1131 | | - return $img; |
1132 | | - } else { |
1133 | | - return NULL; |
1134 | | - } |
1135 | | - } |
1136 | | - |
1137 | | - /** |
1138 | | - * Return the URL of an image, provided its name. |
1139 | | - * |
1140 | | - * Backwards-compatibility for extensions. |
1141 | | - * Note that fromSharedDirectory will only use the shared path for files |
1142 | | - * that actually exist there now, and will return local paths otherwise. |
1143 | | - * |
1144 | | - * @param string $name Name of the image, without the leading "Image:" |
1145 | | - * @param boolean $fromSharedDirectory Should this be in $wgSharedUploadPath? |
1146 | | - * @return string URL of $name image |
1147 | | - * @deprecated |
1148 | | - */ |
1149 | | - static function imageUrl( $name, $fromSharedDirectory = false ) { |
1150 | | - $image = null; |
1151 | | - if( $fromSharedDirectory ) { |
1152 | | - $image = wfFindFile( $name ); |
1153 | | - } |
1154 | | - if( !$image ) { |
1155 | | - $image = wfLocalFile( $name ); |
1156 | | - } |
1157 | | - return $image->getUrl(); |
1158 | | - } |
1159 | | -} |
1160 | | - |
1161 | | -#------------------------------------------------------------------------------ |
1162 | | - |
1163 | | -/** |
1164 | 1097 | * Helper class for file deletion |
1165 | 1098 | */ |
1166 | 1099 | class LocalFileDeleteBatch { |
Index: trunk/phase3/includes/filerepo/File.php |
— | — | @@ -723,7 +723,7 @@ |
724 | 724 | |
725 | 725 | /** Get the path of the archive directory, or a particular file if $suffix is specified */ |
726 | 726 | function getArchivePath( $suffix = false ) { |
727 | | - return $this->repo->getZonePath('public') . '/' . $this->getArchiveRel(); |
| 727 | + return $this->repo->getZonePath('public') . '/' . $this->getArchiveRel( $suffix ); |
728 | 728 | } |
729 | 729 | |
730 | 730 | /** Get the path of the thumbnail directory, or a particular file if $suffix is specified */ |
Index: trunk/phase3/includes/filerepo/Image.php |
— | — | @@ -0,0 +1,69 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Backwards compatibility class |
| 6 | + * @deprecated |
| 7 | + */ |
| 8 | +class Image extends LocalFile { |
| 9 | + function __construct( $title ) { |
| 10 | + $repo = RepoGroup::singleton()->getLocalRepo(); |
| 11 | + parent::__construct( $title, $repo ); |
| 12 | + } |
| 13 | + |
| 14 | + /** |
| 15 | + * Wrapper for wfFindFile(), for backwards-compatibility only |
| 16 | + * Do not use in core code. |
| 17 | + * @deprecated |
| 18 | + */ |
| 19 | + static function newFromTitle( $title, $time = false ) { |
| 20 | + $img = wfFindFile( $title, $time ); |
| 21 | + if ( !$img ) { |
| 22 | + $img = wfLocalFile( $title ); |
| 23 | + } |
| 24 | + return $img; |
| 25 | + } |
| 26 | + |
| 27 | + /** |
| 28 | + * Wrapper for wfFindFile(), for backwards-compatibility only. |
| 29 | + * Do not use in core code. |
| 30 | + * |
| 31 | + * @param string $name name of the image, used to create a title object using Title::makeTitleSafe |
| 32 | + * @return image object or null if invalid title |
| 33 | + * @deprecated |
| 34 | + */ |
| 35 | + static function newFromName( $name ) { |
| 36 | + $title = Title::makeTitleSafe( NS_IMAGE, $name ); |
| 37 | + if ( is_object( $title ) ) { |
| 38 | + $img = wfFindFile( $title ); |
| 39 | + if ( !$img ) { |
| 40 | + $img = wfLocalFile( $title ); |
| 41 | + } |
| 42 | + return $img; |
| 43 | + } else { |
| 44 | + return NULL; |
| 45 | + } |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * Return the URL of an image, provided its name. |
| 50 | + * |
| 51 | + * Backwards-compatibility for extensions. |
| 52 | + * Note that fromSharedDirectory will only use the shared path for files |
| 53 | + * that actually exist there now, and will return local paths otherwise. |
| 54 | + * |
| 55 | + * @param string $name Name of the image, without the leading "Image:" |
| 56 | + * @param boolean $fromSharedDirectory Should this be in $wgSharedUploadPath? |
| 57 | + * @return string URL of $name image |
| 58 | + * @deprecated |
| 59 | + */ |
| 60 | + static function imageUrl( $name, $fromSharedDirectory = false ) { |
| 61 | + $image = null; |
| 62 | + if( $fromSharedDirectory ) { |
| 63 | + $image = wfFindFile( $name ); |
| 64 | + } |
| 65 | + if( !$image ) { |
| 66 | + $image = wfLocalFile( $name ); |
| 67 | + } |
| 68 | + return $image->getUrl(); |
| 69 | + } |
| 70 | +} |
\ No newline at end of file |
Property changes on: trunk/phase3/includes/filerepo/Image.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 71 | + native |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -297,7 +297,7 @@ |
298 | 298 | 'ForeignDBRepo' => 'includes/filerepo/ForeignDBRepo.php', |
299 | 299 | 'ForeignDBViaLBRepo' => 'includes/filerepo/ForeignDBViaLBRepo.php', |
300 | 300 | 'FSRepo' => 'includes/filerepo/FSRepo.php', |
301 | | - 'Image' => 'includes/filerepo/LocalFile.php', |
| 301 | + 'Image' => 'includes/filerepo/Image.php', |
302 | 302 | 'LocalFileDeleteBatch' => 'includes/filerepo/LocalFile.php', |
303 | 303 | 'LocalFile' => 'includes/filerepo/LocalFile.php', |
304 | 304 | 'LocalFileRestoreBatch' => 'includes/filerepo/LocalFile.php', |