Index: trunk/phase3/includes/upload/UploadBase.php |
— | — | @@ -1,18 +1,18 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * @file |
| 4 | + * @file |
5 | 5 | * @ingroup upload |
6 | | - * |
| 6 | + * |
7 | 7 | * UploadBase and subclasses are the backend of MediaWiki's file uploads. |
8 | 8 | * The frontends are formed by ApiUpload and SpecialUpload. |
9 | | - * |
| 9 | + * |
10 | 10 | * See also includes/docs/upload.txt |
11 | | - * |
| 11 | + * |
12 | 12 | * @author Brion Vibber |
13 | 13 | * @author Bryan Tong Minh |
14 | 14 | * @author Michael Dale |
15 | 15 | */ |
16 | | - |
| 16 | + |
17 | 17 | abstract class UploadBase { |
18 | 18 | protected $mTempPath; |
19 | 19 | protected $mDesiredDestName, $mDestName, $mRemoveTempFile, $mSourceType; |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | return true; |
63 | 63 | } |
64 | 64 | |
65 | | - // Upload handlers. Should probably just be a global |
| 65 | + // Upload handlers. Should probably just be a global. |
66 | 66 | static $uploadHandlers = array( 'Stash', 'File', 'Url' ); |
67 | 67 | |
68 | 68 | /** |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | |
77 | 77 | // Get the upload class |
78 | 78 | $type = ucfirst( $type ); |
79 | | - |
| 79 | + |
80 | 80 | // Give hooks the chance to handle this request |
81 | 81 | $className = null; |
82 | 82 | wfRunHooks( 'UploadCreateFromRequest', array( $type, &$className ) ); |
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | $this->mFileSize = $fileSize; |
120 | 120 | $this->mRemoveTempFile = $removeTempFile; |
121 | 121 | } |
122 | | - |
| 122 | + |
123 | 123 | /** |
124 | 124 | * Initialize from a WebRequest. Override this in a subclass. |
125 | 125 | */ |
— | — | @@ -137,7 +137,7 @@ |
138 | 138 | public function isEmptyFile(){ |
139 | 139 | return empty( $this->mFileSize ); |
140 | 140 | } |
141 | | - |
| 141 | + |
142 | 142 | /** |
143 | 143 | * getRealPath |
144 | 144 | * @param string $srcPath the source path |
— | — | @@ -161,7 +161,7 @@ |
162 | 162 | */ |
163 | 163 | if( $this->isEmptyFile() ) |
164 | 164 | return array( 'status' => self::EMPTY_FILE ); |
165 | | - |
| 165 | + |
166 | 166 | /** |
167 | 167 | * Look at the contents of the file; if we can recognize the |
168 | 168 | * type but it's corrupt or data of the wrong type, we should |
— | — | @@ -175,7 +175,7 @@ |
176 | 176 | 'details' => $verification ); |
177 | 177 | |
178 | 178 | } |
179 | | - |
| 179 | + |
180 | 180 | $nt = $this->getTitle(); |
181 | 181 | if( is_null( $nt ) ) { |
182 | 182 | $result = array( 'status' => $this->mTitleError ); |
— | — | @@ -222,7 +222,7 @@ |
223 | 223 | |
224 | 224 | #check mime type, if desired |
225 | 225 | global $wgVerifyMimeType; |
226 | | - if ( $wgVerifyMimeType ) { |
| 226 | + if ( $wgVerifyMimeType ) { |
227 | 227 | global $wgMimeTypeBlacklist; |
228 | 228 | if ( $this->checkFileExtension( $mime, $wgMimeTypeBlacklist ) ) |
229 | 229 | return array( 'filetype-badmime', $mime ); |
— | — | @@ -263,7 +263,7 @@ |
264 | 264 | |
265 | 265 | /** |
266 | 266 | * Check whether the user can edit, upload and create the image. |
267 | | - * |
| 267 | + * |
268 | 268 | * @param User $user the user to verify the permissions against |
269 | 269 | * @return mixed An array as returned by getUserPermissionsErrors or true |
270 | 270 | * in case the user has proper permissions. |
— | — | @@ -289,7 +289,7 @@ |
290 | 290 | |
291 | 291 | /** |
292 | 292 | * Check for non fatal problems with the file |
293 | | - * |
| 293 | + * |
294 | 294 | * @return array Array of warnings |
295 | 295 | */ |
296 | 296 | public function checkWarnings() { |
— | — | @@ -350,9 +350,9 @@ |
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
354 | | - * Really perform the upload. Stores the file in the local repo, watches |
| 354 | + * Really perform the upload. Stores the file in the local repo, watches |
355 | 355 | * if necessary and runs the UploadComplete hook. |
356 | | - * |
| 356 | + * |
357 | 357 | * @return mixed Status indicating the whether the upload succeeded. |
358 | 358 | */ |
359 | 359 | public function performUpload( $comment, $pageText, $watch, $user ) { |
— | — | @@ -372,7 +372,7 @@ |
373 | 373 | /** |
374 | 374 | * Returns the title of the file to be uploaded. Sets mTitleError in case |
375 | 375 | * the name was illegal. |
376 | | - * |
| 376 | + * |
377 | 377 | * @return Title The title of the file or null in case the name was illegal |
378 | 378 | */ |
379 | 379 | public function getTitle() { |
— | — | @@ -441,7 +441,7 @@ |
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
445 | | - * Return the local file and initializes if necessary. |
| 445 | + * Return the local file and initializes if necessary. |
446 | 446 | */ |
447 | 447 | public function getLocalFile() { |
448 | 448 | if( is_null( $this->mLocalFile ) ) { |
— | — | @@ -491,7 +491,7 @@ |
492 | 492 | 'mFileSize' => $this->mFileSize, |
493 | 493 | 'mFileProps' => $this->mFileProps, |
494 | 494 | 'version' => self::SESSION_VERSION, |
495 | | - ); |
| 495 | + ); |
496 | 496 | return $key; |
497 | 497 | } |
498 | 498 | |
— | — | @@ -883,9 +883,9 @@ |
884 | 884 | return true; |
885 | 885 | } |
886 | 886 | |
887 | | - /* Check shared conflicts: if the local file does not exist, but |
888 | | - * wfFindFile finds a file, it exists in a shared repository. |
889 | | - */ |
| 887 | + /* Check shared conflicts: if the local file does not exist, but |
| 888 | + * wfFindFile finds a file, it exists in a shared repository. |
| 889 | + */ |
890 | 890 | $file = wfFindFile( $this->getTitle() ); |
891 | 891 | if ( $file && !$wgUser->isAllowed( 'reupload-shared' ) ) |
892 | 892 | return 'fileexists-shared-forbidden'; |
— | — | @@ -915,13 +915,13 @@ |
916 | 916 | |
917 | 917 | /** |
918 | 918 | * Helper function that does various existence checks for a file. |
919 | | - * The following checks are performed: |
| 919 | + * The following checks are performed: |
920 | 920 | * - The file exists |
921 | 921 | * - Article with the same name as the file exists |
922 | 922 | * - File exists with normalized extension |
923 | 923 | * - The file looks like a thumbnail and the original exists |
924 | | - * |
925 | | - * @param File $file The file to check |
| 924 | + * |
| 925 | + * @param File $file The file to check |
926 | 926 | * @return mixed False if the file does not exists, else an array |
927 | 927 | */ |
928 | 928 | public static function getExistsWarning( $file ) { |
— | — | @@ -930,10 +930,10 @@ |
931 | 931 | |
932 | 932 | if( $file->getTitle()->getArticleID() ) |
933 | 933 | return array( 'warning' => 'page-exists', 'file' => $file ); |
934 | | - |
| 934 | + |
935 | 935 | if ( $file->wasDeleted() && !$file->exists() ) |
936 | | - return array( 'warning' => 'was-deleted', 'file' => $file ); |
937 | | - |
| 936 | + return array( 'warning' => 'was-deleted', 'file' => $file ); |
| 937 | + |
938 | 938 | if( strpos( $file->getName(), '.' ) == false ) { |
939 | 939 | $partname = $file->getName(); |
940 | 940 | $extension = ''; |
— | — | @@ -967,15 +967,15 @@ |
968 | 968 | // File does not exist, but we just don't like the name |
969 | 969 | return array( 'warning' => 'thumb-name', 'file' => $file, 'thumbFile' => $file_thb ); |
970 | 970 | } |
971 | | - |
972 | 971 | |
| 972 | + |
973 | 973 | foreach( self::getFilenamePrefixBlacklist() as $prefix ) { |
974 | 974 | if ( substr( $partname, 0, strlen( $prefix ) ) == $prefix ) |
975 | 975 | return array( 'warning' => 'bad-prefix', 'file' => $file, 'prefix' => $prefix ); |
976 | 976 | } |
977 | | - |
978 | 977 | |
979 | 978 | |
| 979 | + |
980 | 980 | return false; |
981 | 981 | } |
982 | 982 | |
Index: trunk/phase3/includes/filerepo/RepoGroup.php |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | * |
72 | 72 | * ignoreRedirect: If true, do not follow file redirects |
73 | 73 | * |
74 | | - * private: If true, return restricted (deleted) files if the current |
| 74 | + * private: If true, return restricted (deleted) files if the current |
75 | 75 | * user is allowed to view them. Otherwise, such files will not |
76 | 76 | * be found. |
77 | 77 | * |
— | — | @@ -93,9 +93,9 @@ |
94 | 94 | } |
95 | 95 | |
96 | 96 | # Check the cache |
97 | | - if ( empty( $options['ignoreRedirect'] ) |
98 | | - && empty( $options['private'] ) |
99 | | - && empty( $options['bypassCache'] ) ) |
| 97 | + if ( empty( $options['ignoreRedirect'] ) |
| 98 | + && empty( $options['private'] ) |
| 99 | + && empty( $options['bypassCache'] ) ) |
100 | 100 | { |
101 | 101 | $useCache = true; |
102 | 102 | $time = isset( $options['time'] ) ? $options['time'] : ''; |
— | — | @@ -164,7 +164,7 @@ |
165 | 165 | foreach ( $images as $name => $image ) { |
166 | 166 | unset( $items[$name] ); |
167 | 167 | } |
168 | | - |
| 168 | + |
169 | 169 | $images = array_merge( $images, $repo->findFiles( $items ) ); |
170 | 170 | } |
171 | 171 | return $images; |
— | — | @@ -190,16 +190,16 @@ |
191 | 191 | } |
192 | 192 | return false; |
193 | 193 | } |
194 | | - |
| 194 | + |
195 | 195 | function findBySha1( $hash ) { |
196 | 196 | if ( !$this->reposInitialised ) { |
197 | 197 | $this->initialiseRepos(); |
198 | 198 | } |
199 | | - |
| 199 | + |
200 | 200 | $result = $this->localRepo->findBySha1( $hash ); |
201 | 201 | foreach ( $this->foreignRepos as $repo ) |
202 | 202 | $result = array_merge( $result, $repo->findBySha1( $hash ) ); |
203 | | - return $result; |
| 203 | + return $result; |
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
— | — | @@ -240,7 +240,7 @@ |
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
244 | | - * Call a function for each foreign repo, with the repo object as the |
| 244 | + * Call a function for each foreign repo, with the repo object as the |
245 | 245 | * first parameter. |
246 | 246 | * |
247 | 247 | * @param $callback callback The function to call |
Index: trunk/phase3/includes/api/ApiMain.php |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | 'dbg' => 'ApiFormatDbg', |
106 | 106 | 'dbgfm' => 'ApiFormatDbg' |
107 | 107 | ); |
108 | | - |
| 108 | + |
109 | 109 | /** |
110 | 110 | * List of user roles that are specifically relevant to the API. |
111 | 111 | * array( 'right' => array ( 'msg' => 'Some message with a $1', |
— | — | @@ -186,12 +186,12 @@ |
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
190 | | - * Get the ApiResult object asscosiated with current request |
| 190 | + * Get the ApiResult object associated with current request |
191 | 191 | */ |
192 | 192 | public function getResult() { |
193 | 193 | return $this->mResult; |
194 | 194 | } |
195 | | - |
| 195 | + |
196 | 196 | /** |
197 | 197 | * Get the API module object. Only works after executeAction() |
198 | 198 | */ |
— | — | @@ -235,7 +235,7 @@ |
236 | 236 | $this->executeAction(); |
237 | 237 | else |
238 | 238 | $this->executeActionWithErrorHandling(); |
239 | | - |
| 239 | + |
240 | 240 | $this->profileOut(); |
241 | 241 | } |
242 | 242 | |
— | — | @@ -460,7 +460,7 @@ |
461 | 461 | $printer->closePrinter(); |
462 | 462 | $printer->profileOut(); |
463 | 463 | } |
464 | | - |
| 464 | + |
465 | 465 | public function isReadMode() { |
466 | 466 | return false; |
467 | 467 | } |
— | — | @@ -576,7 +576,7 @@ |
577 | 577 | $wgMemc->set( $key, $retval, $wgAPICacheHelpTimeout ); |
578 | 578 | return $retval; |
579 | 579 | } |
580 | | - |
| 580 | + |
581 | 581 | public function reallyMakeHelpMsg() { |
582 | 582 | |
583 | 583 | $this->mPrinter->setHelp(); |
Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -629,7 +629,7 @@ |
630 | 630 | // Throw out duplicates if requested |
631 | 631 | if ( is_array( $value ) && !$dupes ) |
632 | 632 | $value = array_unique( $value ); |
633 | | - |
| 633 | + |
634 | 634 | // Set a warning if a deprecated parameter has been passed |
635 | 635 | if ( $deprecated ) { |
636 | 636 | $this->setWarning( "The $encParamName parameter has been deprecated." ); |