r61354 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61353‎ | r61354 | r61355 >
Date:03:14, 22 January 2010
Author:mah
Status:ok
Tags:
Comment:
ws only cleanup
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)
  • /trunk/phase3/includes/filerepo/RepoGroup.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadBase.php
@@ -1,18 +1,18 @@
22 <?php
33 /**
4 - * @file
 4+ * @file
55 * @ingroup upload
6 - *
 6+ *
77 * UploadBase and subclasses are the backend of MediaWiki's file uploads.
88 * The frontends are formed by ApiUpload and SpecialUpload.
9 - *
 9+ *
1010 * See also includes/docs/upload.txt
11 - *
 11+ *
1212 * @author Brion Vibber
1313 * @author Bryan Tong Minh
1414 * @author Michael Dale
1515 */
16 -
 16+
1717 abstract class UploadBase {
1818 protected $mTempPath;
1919 protected $mDesiredDestName, $mDestName, $mRemoveTempFile, $mSourceType;
@@ -61,7 +61,7 @@
6262 return true;
6363 }
6464
65 - // Upload handlers. Should probably just be a global
 65+ // Upload handlers. Should probably just be a global.
6666 static $uploadHandlers = array( 'Stash', 'File', 'Url' );
6767
6868 /**
@@ -75,7 +75,7 @@
7676
7777 // Get the upload class
7878 $type = ucfirst( $type );
79 -
 79+
8080 // Give hooks the chance to handle this request
8181 $className = null;
8282 wfRunHooks( 'UploadCreateFromRequest', array( $type, &$className ) );
@@ -118,7 +118,7 @@
119119 $this->mFileSize = $fileSize;
120120 $this->mRemoveTempFile = $removeTempFile;
121121 }
122 -
 122+
123123 /**
124124 * Initialize from a WebRequest. Override this in a subclass.
125125 */
@@ -137,7 +137,7 @@
138138 public function isEmptyFile(){
139139 return empty( $this->mFileSize );
140140 }
141 -
 141+
142142 /**
143143 * getRealPath
144144 * @param string $srcPath the source path
@@ -161,7 +161,7 @@
162162 */
163163 if( $this->isEmptyFile() )
164164 return array( 'status' => self::EMPTY_FILE );
165 -
 165+
166166 /**
167167 * Look at the contents of the file; if we can recognize the
168168 * type but it's corrupt or data of the wrong type, we should
@@ -175,7 +175,7 @@
176176 'details' => $verification );
177177
178178 }
179 -
 179+
180180 $nt = $this->getTitle();
181181 if( is_null( $nt ) ) {
182182 $result = array( 'status' => $this->mTitleError );
@@ -222,7 +222,7 @@
223223
224224 #check mime type, if desired
225225 global $wgVerifyMimeType;
226 - if ( $wgVerifyMimeType ) {
 226+ if ( $wgVerifyMimeType ) {
227227 global $wgMimeTypeBlacklist;
228228 if ( $this->checkFileExtension( $mime, $wgMimeTypeBlacklist ) )
229229 return array( 'filetype-badmime', $mime );
@@ -263,7 +263,7 @@
264264
265265 /**
266266 * Check whether the user can edit, upload and create the image.
267 - *
 267+ *
268268 * @param User $user the user to verify the permissions against
269269 * @return mixed An array as returned by getUserPermissionsErrors or true
270270 * in case the user has proper permissions.
@@ -289,7 +289,7 @@
290290
291291 /**
292292 * Check for non fatal problems with the file
293 - *
 293+ *
294294 * @return array Array of warnings
295295 */
296296 public function checkWarnings() {
@@ -350,9 +350,9 @@
351351 }
352352
353353 /**
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
355355 * if necessary and runs the UploadComplete hook.
356 - *
 356+ *
357357 * @return mixed Status indicating the whether the upload succeeded.
358358 */
359359 public function performUpload( $comment, $pageText, $watch, $user ) {
@@ -372,7 +372,7 @@
373373 /**
374374 * Returns the title of the file to be uploaded. Sets mTitleError in case
375375 * the name was illegal.
376 - *
 376+ *
377377 * @return Title The title of the file or null in case the name was illegal
378378 */
379379 public function getTitle() {
@@ -441,7 +441,7 @@
442442 }
443443
444444 /**
445 - * Return the local file and initializes if necessary.
 445+ * Return the local file and initializes if necessary.
446446 */
447447 public function getLocalFile() {
448448 if( is_null( $this->mLocalFile ) ) {
@@ -491,7 +491,7 @@
492492 'mFileSize' => $this->mFileSize,
493493 'mFileProps' => $this->mFileProps,
494494 'version' => self::SESSION_VERSION,
495 - );
 495+ );
496496 return $key;
497497 }
498498
@@ -883,9 +883,9 @@
884884 return true;
885885 }
886886
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+ */
890890 $file = wfFindFile( $this->getTitle() );
891891 if ( $file && !$wgUser->isAllowed( 'reupload-shared' ) )
892892 return 'fileexists-shared-forbidden';
@@ -915,13 +915,13 @@
916916
917917 /**
918918 * Helper function that does various existence checks for a file.
919 - * The following checks are performed:
 919+ * The following checks are performed:
920920 * - The file exists
921921 * - Article with the same name as the file exists
922922 * - File exists with normalized extension
923923 * - 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
926926 * @return mixed False if the file does not exists, else an array
927927 */
928928 public static function getExistsWarning( $file ) {
@@ -930,10 +930,10 @@
931931
932932 if( $file->getTitle()->getArticleID() )
933933 return array( 'warning' => 'page-exists', 'file' => $file );
934 -
 934+
935935 if ( $file->wasDeleted() && !$file->exists() )
936 - return array( 'warning' => 'was-deleted', 'file' => $file );
937 -
 936+ return array( 'warning' => 'was-deleted', 'file' => $file );
 937+
938938 if( strpos( $file->getName(), '.' ) == false ) {
939939 $partname = $file->getName();
940940 $extension = '';
@@ -967,15 +967,15 @@
968968 // File does not exist, but we just don't like the name
969969 return array( 'warning' => 'thumb-name', 'file' => $file, 'thumbFile' => $file_thb );
970970 }
971 -
972971
 972+
973973 foreach( self::getFilenamePrefixBlacklist() as $prefix ) {
974974 if ( substr( $partname, 0, strlen( $prefix ) ) == $prefix )
975975 return array( 'warning' => 'bad-prefix', 'file' => $file, 'prefix' => $prefix );
976976 }
977 -
978977
979978
 979+
980980 return false;
981981 }
982982
Index: trunk/phase3/includes/filerepo/RepoGroup.php
@@ -70,7 +70,7 @@
7171 *
7272 * ignoreRedirect: If true, do not follow file redirects
7373 *
74 - * private: If true, return restricted (deleted) files if the current
 74+ * private: If true, return restricted (deleted) files if the current
7575 * user is allowed to view them. Otherwise, such files will not
7676 * be found.
7777 *
@@ -93,9 +93,9 @@
9494 }
9595
9696 # 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'] ) )
100100 {
101101 $useCache = true;
102102 $time = isset( $options['time'] ) ? $options['time'] : '';
@@ -164,7 +164,7 @@
165165 foreach ( $images as $name => $image ) {
166166 unset( $items[$name] );
167167 }
168 -
 168+
169169 $images = array_merge( $images, $repo->findFiles( $items ) );
170170 }
171171 return $images;
@@ -190,16 +190,16 @@
191191 }
192192 return false;
193193 }
194 -
 194+
195195 function findBySha1( $hash ) {
196196 if ( !$this->reposInitialised ) {
197197 $this->initialiseRepos();
198198 }
199 -
 199+
200200 $result = $this->localRepo->findBySha1( $hash );
201201 foreach ( $this->foreignRepos as $repo )
202202 $result = array_merge( $result, $repo->findBySha1( $hash ) );
203 - return $result;
 203+ return $result;
204204 }
205205
206206 /**
@@ -240,7 +240,7 @@
241241 }
242242
243243 /**
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
245245 * first parameter.
246246 *
247247 * @param $callback callback The function to call
Index: trunk/phase3/includes/api/ApiMain.php
@@ -104,7 +104,7 @@
105105 'dbg' => 'ApiFormatDbg',
106106 'dbgfm' => 'ApiFormatDbg'
107107 );
108 -
 108+
109109 /**
110110 * List of user roles that are specifically relevant to the API.
111111 * array( 'right' => array ( 'msg' => 'Some message with a $1',
@@ -186,12 +186,12 @@
187187 }
188188
189189 /**
190 - * Get the ApiResult object asscosiated with current request
 190+ * Get the ApiResult object associated with current request
191191 */
192192 public function getResult() {
193193 return $this->mResult;
194194 }
195 -
 195+
196196 /**
197197 * Get the API module object. Only works after executeAction()
198198 */
@@ -235,7 +235,7 @@
236236 $this->executeAction();
237237 else
238238 $this->executeActionWithErrorHandling();
239 -
 239+
240240 $this->profileOut();
241241 }
242242
@@ -460,7 +460,7 @@
461461 $printer->closePrinter();
462462 $printer->profileOut();
463463 }
464 -
 464+
465465 public function isReadMode() {
466466 return false;
467467 }
@@ -576,7 +576,7 @@
577577 $wgMemc->set( $key, $retval, $wgAPICacheHelpTimeout );
578578 return $retval;
579579 }
580 -
 580+
581581 public function reallyMakeHelpMsg() {
582582
583583 $this->mPrinter->setHelp();
Index: trunk/phase3/includes/api/ApiBase.php
@@ -629,7 +629,7 @@
630630 // Throw out duplicates if requested
631631 if ( is_array( $value ) && !$dupes )
632632 $value = array_unique( $value );
633 -
 633+
634634 // Set a warning if a deprecated parameter has been passed
635635 if ( $deprecated ) {
636636 $this->setWarning( "The $encParamName parameter has been deprecated." );

Status & tagging log