r83536 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83535‎ | r83536 | r83537 >
Date:18:12, 8 March 2011
Author:mah
Status:ok (Comments)
Tags:
Comment:
misc w/s cleanups, “svn diff -x-w” clean
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Html.php (modified) (history)
  • /trunk/phase3/includes/HttpFunctions.php (modified) (history)
  • /trunk/phase3/includes/Import.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/WatchlistEditor.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadBase.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadStash.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadBase.php
@@ -148,12 +148,12 @@
149149 }
150150
151151 public function __construct() {}
152 -
 152+
153153 /**
154154 * Returns the upload type. Should be overridden by child classes
155 - *
 155+ *
156156 * @since 1.18
157 - * @return string
 157+ * @return string
158158 */
159159 public function getSourceType() { return null; }
160160
@@ -242,7 +242,7 @@
243243 */
244244 $maxSize = self::getMaxUploadSize( $this->getSourceType() );
245245 if( $this->mFileSize > $maxSize ) {
246 - return array(
 246+ return array(
247247 'status' => self::FILE_TOO_LARGE,
248248 'max' => $maxSize,
249249 );
@@ -350,9 +350,9 @@
351351 protected function verifyFile() {
352352 global $wgAllowJavaUploads;
353353 # get the title, even though we are doing nothing with it, because
354 - # we need to populate mFinalExtension
 354+ # we need to populate mFinalExtension
355355 $this->getTitle();
356 -
 356+
357357 $this->mFileProps = File::getPropsFromPath( $this->mTempPath, $this->mFinalExtension );
358358 $this->checkMacBinary();
359359
@@ -373,11 +373,11 @@
374374 }
375375 }
376376
377 - # Check for Java applets, which if uploaded can bypass cross-site
 377+ # Check for Java applets, which if uploaded can bypass cross-site
378378 # restrictions.
379379 if ( !$wgAllowJavaUploads ) {
380380 $this->mJavaDetected = false;
381 - $zipStatus = ZipDirectoryReader::read( $this->mTempPath,
 381+ $zipStatus = ZipDirectoryReader::read( $this->mTempPath,
382382 array( $this, 'zipEntryCallback' ) );
383383 if ( !$zipStatus->isOK() ) {
384384 $errors = $zipStatus->getErrorsArray();
@@ -422,16 +422,16 @@
423423 $names = array( $entry['name'] );
424424
425425 // If there is a null character, cut off the name at it, because JDK's
426 - // ZIP_GetEntry() uses strcmp() if the name hashes match. If a file name
427 - // were constructed which had ".class\0" followed by a string chosen to
428 - // make the hash collide with the truncated name, that file could be
 426+ // ZIP_GetEntry() uses strcmp() if the name hashes match. If a file name
 427+ // were constructed which had ".class\0" followed by a string chosen to
 428+ // make the hash collide with the truncated name, that file could be
429429 // returned in response to a request for the .class file.
430430 $nullPos = strpos( $entry['name'], "\000" );
431431 if ( $nullPos !== false ) {
432432 $names[] = substr( $entry['name'], 0, $nullPos );
433433 }
434434
435 - // If there is a trailing slash in the file name, we have to strip it,
 435+ // If there is a trailing slash in the file name, we have to strip it,
436436 // because that's what ZIP_GetEntry() does.
437437 if ( preg_grep( '!\.class/?$!', $names ) ) {
438438 $this->mJavaDetected = true;
@@ -470,12 +470,12 @@
471471 $permErrors = array_merge( $permErrors, wfArrayDiff2( $permErrorsCreate, $permErrors ) );
472472 return $permErrors;
473473 }
474 -
 474+
475475 $overwriteError = $this->checkOverwrite( $user );
476476 if ( $overwriteError !== true ) {
477477 return array( array( $overwriteError ) );
478478 }
479 -
 479+
480480 return true;
481481 }
482482
@@ -555,14 +555,14 @@
556556 * @return Status indicating the whether the upload succeeded.
557557 */
558558 public function performUpload( $comment, $pageText, $watch, $user ) {
559 - $status = $this->getLocalFile()->upload(
560 - $this->mTempPath,
561 - $comment,
 559+ $status = $this->getLocalFile()->upload(
 560+ $this->mTempPath,
 561+ $comment,
562562 $pageText,
563563 File::DELETE_SOURCE,
564 - $this->mFileProps,
565 - false,
566 - $user
 564+ $this->mFileProps,
 565+ false,
 566+ $user
567567 );
568568
569569 if( $status->isGood() ) {
@@ -611,7 +611,7 @@
612612 $this->mFinalExtension = trim( $ext[count( $ext ) - 1] );
613613 } else {
614614 $this->mFinalExtension = '';
615 -
 615+
616616 # No extension, try guessing one
617617 $magic = MimeMagic::singleton();
618618 $mime = $magic->guessMimeType( $this->mTempPath );
@@ -621,22 +621,22 @@
622622 if ( $extList ) {
623623 # Set the extension to the canonical extension
624624 $this->mFinalExtension = strtok( $extList, ' ' );
625 -
 625+
626626 # Fix up the other variables
627627 $this->mFilteredName .= ".{$this->mFinalExtension}";
628628 $nt = Title::makeTitleSafe( NS_FILE, $this->mFilteredName );
629629 $ext = array( $this->mFinalExtension );
630630 }
631631 }
632 -
 632+
633633 }
634634
635635 /* Don't allow users to override the blacklist (check file extension) */
636636 global $wgCheckFileExtensions, $wgStrictFileExtensions;
637637 global $wgFileExtensions, $wgFileBlacklist;
638 -
 638+
639639 $blackListedExtensions = $this->checkFileExtensionList( $ext, $wgFileBlacklist );
640 -
 640+
641641 if ( $this->mFinalExtension == '' ) {
642642 $this->mTitleError = self::FILETYPE_MISSING;
643643 return $this->mTitle = null;
@@ -703,15 +703,15 @@
704704 *
705705 * This method will stash a file in a temporary directory for later processing, and save the necessary descriptive info
706706 * into the user's session.
707 - * This method returns the file object, which also has a 'sessionKey' property which can be passed through a form or
 707+ * This method returns the file object, which also has a 'sessionKey' property which can be passed through a form or
708708 * API request to find this stashed file again.
709709 *
710710 * @param $key String: (optional) the session key used to find the file info again. If not supplied, a key will be autogenerated.
711711 * @return UploadStashFile stashed file
712712 */
713 - public function stashSessionFile( $key = null ) {
 713+ public function stashSessionFile( $key = null ) {
714714 $stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash();
715 - $data = array(
 715+ $data = array(
716716 'mFileProps' => $this->mFileProps,
717717 'mSourceType' => $this->getSourceType(),
718718 );
@@ -1276,18 +1276,18 @@
12771277 }
12781278
12791279 /**
1280 - * Gets image info about the file just uploaded.
 1280+ * Gets image info about the file just uploaded.
12811281 *
1282 - * Also has the effect of setting metadata to be an 'indexed tag name' in returned API result if
 1282+ * Also has the effect of setting metadata to be an 'indexed tag name' in returned API result if
12831283 * 'metadata' was requested. Oddly, we have to pass the "result" object down just so it can do that
1284 - * with the appropriate format, presumably.
 1284+ * with the appropriate format, presumably.
12851285 *
12861286 * @param $result ApiResult:
12871287 * @return Array: image info
12881288 */
12891289 public function getImageInfo( $result ) {
12901290 $file = $this->getLocalFile();
1291 - // TODO This cries out for refactoring. We really want to say $file->getAllInfo(); here.
 1291+ // TODO This cries out for refactoring. We really want to say $file->getAllInfo(); here.
12921292 // Perhaps "info" methods should be moved into files, and the API should just wrap them in queries.
12931293 if ( $file instanceof UploadStashFile ) {
12941294 $imParam = ApiQueryStashImageInfo::getPropertyNames();
@@ -1305,12 +1305,12 @@
13061306 unset( $code['status'] );
13071307 return Status::newFatal( $this->getVerificationErrorCode( $code ), $error );
13081308 }
1309 -
 1309+
13101310 public static function getMaxUploadSize( $forType = null ) {
13111311 global $wgMaxUploadSize;
1312 -
 1312+
13131313 if ( is_array( $wgMaxUploadSize ) ) {
1314 - if ( !is_null( $forType ) && isset( $wgMaxUploadSize[$forType] ) ) {
 1314+ if ( !is_null( $forType) && isset( $wgMaxUploadSize[$forType] ) ) {
13151315 return $wgMaxUploadSize[$forType];
13161316 } else {
13171317 return $wgMaxUploadSize['*'];
@@ -1318,6 +1318,6 @@
13191319 } else {
13201320 return intval( $wgMaxUploadSize );
13211321 }
1322 -
 1322+
13231323 }
13241324 }
Index: trunk/phase3/includes/upload/UploadStash.php
@@ -1,13 +1,13 @@
22 <?php
3 -/**
 3+/**
44 * UploadStash is intended to accomplish a few things:
55 * - enable applications to temporarily stash files without publishing them to the wiki.
66 * - Several parts of MediaWiki do this in similar ways: UploadBase, UploadWizard, and FirefoggChunkedExtension
77 * And there are several that reimplement stashing from scratch, in idiosyncratic ways. The idea is to unify them all here.
88 * Mostly all of them are the same except for storing some custom fields, which we subsume into the data array.
9 - * - enable applications to find said files later, as long as the session or temp files haven't been purged.
 9+ * - enable applications to find said files later, as long as the session or temp files haven't been purged.
1010 * - enable the uploading user (and *ONLY* the uploading user) to access said files, and thumbnails of said files, via a URL.
11 - * We accomplish this by making the session serve as a URL->file mapping, on the assumption that nobody else can access
 11+ * We accomplish this by making the session serve as a URL->file mapping, on the assumption that nobody else can access
1212 * the session, even the uploading user. See SpecialUploadStash, which implements a web interface to some files stored this way.
1313 *
1414 */
@@ -18,8 +18,8 @@
1919
2020 // repository that this uses to store temp files
2121 // public because we sometimes need to get a LocalFile within the same repo.
22 - public $repo;
23 -
 22+ public $repo;
 23+
2424 // array of initialized objects obtained from session (lazily initialized upon getFile())
2525 private $files = array();
2626
@@ -31,7 +31,7 @@
3232 * Represents the session which contains temporarily stored files.
3333 * Designed to be compatible with the session stashing code in UploadBase (should replace it eventually)
3434 */
35 - public function __construct( $repo ) {
 35+ public function __construct( $repo ) {
3636
3737 // this might change based on wiki's configuration.
3838 $this->repo = $repo;
@@ -43,7 +43,7 @@
4444 if ( !isset( $_SESSION[UploadBase::SESSION_KEYNAME] ) ) {
4545 $_SESSION[UploadBase::SESSION_KEYNAME] = array();
4646 }
47 -
 47+
4848 }
4949
5050 /**
@@ -58,8 +58,8 @@
5959 public function getFile( $key ) {
6060 if ( ! preg_match( self::KEY_FORMAT_REGEX, $key ) ) {
6161 throw new UploadStashBadPathException( "key '$key' is not in a proper format" );
62 - }
63 -
 62+ }
 63+
6464 if ( !isset( $this->files[$key] ) ) {
6565 if ( !isset( $_SESSION[UploadBase::SESSION_KEYNAME][$key] ) ) {
6666 throw new UploadStashFileNotFoundException( "key '$key' not found in stash" );
@@ -70,7 +70,7 @@
7171 if ($data['version'] !== UploadBase::SESSION_VERSION ) {
7272 throw new UploadStashBadVersionException( $data['version'] . " does not match current version " . UploadBase::SESSION_VERSION );
7373 }
74 -
 74+
7575 // separate the stashData into the path, and then the rest of the data
7676 $path = $data['mTempPath'];
7777 unset( $data['mTempPath'] );
@@ -102,7 +102,7 @@
103103 wfDebug( "UploadStash: tried to stash file at '$path', but it doesn't exist\n" );
104104 throw new UploadStashBadPathException( "path doesn't exist" );
105105 }
106 - $fileProps = File::getPropsFromPath( $path );
 106+ $fileProps = File::getPropsFromPath( $path );
107107
108108 // we will be initializing from some tmpnam files that don't have extensions.
109109 // most of MediaWiki assumes all uploaded files have good extensions. So, we fix this.
@@ -113,7 +113,7 @@
114114 throw new UploadStashFileException( "couldn't rename $path to have a better extension at $pathWithGoodExtension" );
115115 }
116116 $path = $pathWithGoodExtension;
117 - }
 117+ }
118118
119119 // If no key was supplied, use content hash. Also has the nice property of collapsing multiple identical files
120120 // uploaded this session, which could happen if uploads had failed.
@@ -123,7 +123,7 @@
124124
125125 if ( ! preg_match( self::KEY_FORMAT_REGEX, $key ) ) {
126126 throw new UploadStashBadPathException( "key '$key' is not in a proper format" );
127 - }
 127+ }
128128
129129 // if not already in a temporary area, put it there
130130 $status = $this->repo->storeTemp( basename( $path ), $path );
@@ -148,7 +148,7 @@
149149 // required info we always store. Must trump any other application info in $data
150150 // 'mTempPath', 'mFileSize', and 'mFileProps' are arbitrary names
151151 // chosen for compatibility with UploadBase's way of doing this.
152 - $requiredData = array(
 152+ $requiredData = array(
153153 'mTempPath' => $stashPath,
154154 'mFileSize' => $fileProps['size'],
155155 'mFileProps' => $fileProps,
@@ -159,7 +159,7 @@
160160 // UploadWizard wants different things than say FirefoggChunkedUpload.)
161161 wfDebug( __METHOD__ . " storing under $key\n" );
162162 $_SESSION[UploadBase::SESSION_KEYNAME][$key] = array_merge( $data, $requiredData );
163 -
 163+
164164 return $this->getFile( $key );
165165 }
166166
@@ -193,12 +193,12 @@
194194
195195 /**
196196 * Find or guess extension -- ensuring that our extension matches our mime type.
197 - * Since these files are constructed from php tempnames they may not start off
 197+ * Since these files are constructed from php tempnames they may not start off
198198 * with an extension.
199 - * XXX this is somewhat redundant with the checks that ApiUpload.php does with incoming
 199+ * XXX this is somewhat redundant with the checks that ApiUpload.php does with incoming
200200 * uploads versus the desired filename. Maybe we can get that passed to us...
201201 */
202 - public static function getExtensionForPath( $path ) {
 202+ public static function getExtensionForPath( $path ) {
203203 // Does this have an extension?
204204 $n = strrpos( $path, '.' );
205205 $extension = null;
@@ -209,8 +209,8 @@
210210 $magic = MimeMagic::singleton();
211211 $mimeType = $magic->guessMimeType( $path );
212212 $extensions = explode( ' ', MimeMagic::singleton()->getExtensionsForType( $mimeType ) );
213 - if ( count( $extensions ) ) {
214 - $extension = $extensions[0];
 213+ if ( count( $extensions ) ) {
 214+ $extension = $extensions[0];
215215 }
216216 }
217217
@@ -242,19 +242,19 @@
243243 * @throws UploadStashBadPathException
244244 * @throws UploadStashFileNotFoundException
245245 */
246 - public function __construct( $stash, $repo, $path, $key, $data ) {
 246+ public function __construct( $stash, $repo, $path, $key, $data ) {
247247 $this->sessionStash = $stash;
248248 $this->sessionKey = $key;
249249 $this->sessionData = $data;
250250
251251 // resolve mwrepo:// urls
252252 if ( $repo->isVirtualUrl( $path ) ) {
253 - $path = $repo->resolveVirtualUrl( $path );
 253+ $path = $repo->resolveVirtualUrl( $path );
254254 }
255255
256256 // check if path appears to be sane, no parent traversals, and is in this repo's temp zone.
257257 $repoTempPath = $repo->getZonePath( 'temp' );
258 - if ( ( ! $repo->validateFilename( $path ) ) ||
 258+ if ( ( ! $repo->validateFilename( $path ) ) ||
259259 ( strpos( $path, $repoTempPath ) !== 0 ) ) {
260260 wfDebug( "UploadStash: tried to construct an UploadStashFile from a file that should already exist at '$path', but path is not valid\n" );
261261 throw new UploadStashBadPathException( 'path is not valid' );
@@ -285,13 +285,13 @@
286286
287287 /**
288288 * Get the path for the thumbnail (actually any transformation of this file)
289 - * The actual argument is the result of thumbName although we seem to have
 289+ * The actual argument is the result of thumbName although we seem to have
290290 * buggy code elsewhere that expects a boolean 'suffix'
291291 *
292292 * @param $thumbName String: name of thumbnail (e.g. "120px-123456.jpg" ), or false to just get the path
293293 * @return String: path thumbnail should take on filesystem, or containing directory if thumbname is false
294294 */
295 - public function getThumbPath( $thumbName = false ) {
 295+ public function getThumbPath( $thumbName = false ) {
296296 $path = dirname( $this->path );
297297 if ( $thumbName !== false ) {
298298 $path .= "/$thumbName";
@@ -300,8 +300,8 @@
301301 }
302302
303303 /**
304 - * Return the file/url base name of a thumbnail with the specified parameters.
305 - * We override this because we want to use the pretty url name instead of the
 304+ * Return the file/url base name of a thumbnail with the specified parameters.
 305+ * We override this because we want to use the pretty url name instead of the
306306 * ugly file name.
307307 *
308308 * @param $params Array: handler-specific parameters
@@ -314,33 +314,33 @@
315315 /**
316316 * Helper function -- given a 'subpage', return the local URL e.g. /wiki/Special:UploadStash/subpage
317317 * @param {String} $subPage
318 - * @return {String} local URL for this subpage in the Special:UploadStash space.
 318+ * @return {String} local URL for this subpage in the Special:UploadStash space.
319319 */
320320 private function getSpecialUrl( $subPage ) {
321321 return SpecialPage::getTitleFor( 'UploadStash', $subPage )->getLocalURL();
322322 }
323323
324 - /**
325 - * Get a URL to access the thumbnail
326 - * This is required because the model of how files work requires that
 324+ /**
 325+ * Get a URL to access the thumbnail
 326+ * This is required because the model of how files work requires that
327327 * the thumbnail urls be predictable. However, in our model the URL is not based on the filename
328328 * (that's hidden in the session)
329329 *
330330 * @param $thumbName String: basename of thumbnail file -- however, we don't want to use the file exactly
331331 * @return String: URL to access thumbnail, or URL with partial path
332332 */
333 - public function getThumbUrl( $thumbName = false ) {
 333+ public function getThumbUrl( $thumbName = false ) {
334334 wfDebug( __METHOD__ . " getting for $thumbName \n" );
335335 return $this->getSpecialUrl( 'thumb/' . $this->getUrlName() . '/' . $thumbName );
336336 }
337337
338 - /**
 338+ /**
339339 * The basename for the URL, which we want to not be related to the filename.
340340 * Will also be used as the lookup key for a thumbnail file.
341341 *
342342 * @return String: base url name, like '120px-123456.jpg'
343343 */
344 - public function getUrlName() {
 344+ public function getUrlName() {
345345 if ( ! $this->urlName ) {
346346 $this->urlName = $this->sessionKey;
347347 }
@@ -361,12 +361,12 @@
362362 }
363363
364364 /**
365 - * Parent classes use this method, for no obvious reason, to return the path (relative to wiki root, I assume).
 365+ * Parent classes use this method, for no obvious reason, to return the path (relative to wiki root, I assume).
366366 * But with this class, the URL is unrelated to the path.
367367 *
368368 * @return String: url
369369 */
370 - public function getFullUrl() {
 370+ public function getFullUrl() {
371371 return $this->getUrl();
372372 }
373373
Index: trunk/phase3/includes/User.php
@@ -2831,7 +2831,7 @@
28322832 # Some wikis were converted from ISO 8859-1 to UTF-8, the passwords can't be converted
28332833 # Check for this with iconv
28342834 $cp1252Password = iconv( 'UTF-8', 'WINDOWS-1252//TRANSLIT', $password );
2835 - if ( $cp1252Password != $password &&
 2835+ if ( $cp1252Password != $password &&
28362836 self::comparePasswords( $this->mPassword, $cp1252Password, $this->mId ) )
28372837 {
28382838 return true;
Index: trunk/phase3/includes/Article.php
@@ -1834,7 +1834,7 @@
18351835 if ( !$isRedirect && !is_null( $lastRevIsRedirect ) && $lastRevIsRedirect === $isRedirect ) {
18361836 return true;
18371837 }
1838 -
 1838+
18391839 wfProfileIn( __METHOD__ );
18401840 if ( $isRedirect ) {
18411841 $this->insertRedirectEntry( $redirectTitle );
Index: trunk/phase3/includes/WatchlistEditor.php
@@ -60,7 +60,7 @@
6161 } else {
6262 $this->clearWatchlist( $user );
6363 $user->invalidateCache();
64 - $output->addHTML( wfMsgExt( 'watchlistedit-raw-removed', 'parse',
 64+ $output->addHTML( wfMsgExt( 'watchlistedit-raw-removed', 'parse',
6565 $wgLang->formatNum( count( $current ) ) ) );
6666 $this->showTitles( $current, $output, $wgUser->getSkin() );
6767 }
Index: trunk/phase3/includes/Html.php
@@ -200,7 +200,7 @@
201201 /**
202202 * Returns "</$element>", except if $wgWellFormedXml is off, in which case
203203 * it returns the empty string when that's guaranteed to be safe.
204 - *
 204+ *
205205 * @since 1.17
206206 * @param $element string Name of the element, e.g., 'a'
207207 * @return string A closing tag, if required
Index: trunk/phase3/includes/HttpFunctions.php
@@ -141,7 +141,7 @@
142142 */
143143 class MWHttpRequest {
144144 const SUPPORTS_FILE_POSTS = false;
145 -
 145+
146146 protected $content;
147147 protected $timeout = 'default';
148148 protected $headersOnly = null;
@@ -205,7 +205,7 @@
206206
207207 /**
208208 * Generate a new request object
209 - * @param $url String: url to use
 209+ * @param $url String: url to use
210210 * @param $options Array: (optional) extra params to pass (see Http::request())
211211 * @see MWHttpRequest::__construct
212212 */
@@ -565,7 +565,7 @@
566566 */
567567 class CurlHttpRequest extends MWHttpRequest {
568568 const SUPPORTS_FILE_POSTS = true;
569 -
 569+
570570 static $curlMessageMap = array(
571571 6 => 'http-host-unreachable',
572572 28 => 'http-timed-out'
@@ -692,7 +692,7 @@
693693
694694 if ( is_array( $this->postData ) ) {
695695 $this->postData = wfArrayToCGI( $this->postData );
696 - }
 696+ }
697697
698698 // At least on Centos 4.8 with PHP 5.1.6, using max_redirects to follow redirects
699699 // causes a segfault
Index: trunk/phase3/includes/Import.php
@@ -192,7 +192,7 @@
193193 * Dummy for now...
194194 */
195195 public function importUpload( $revision ) {
196 - $revision->importUpload();
 196+ $revision->importUpload();
197197 //$dbw = wfGetDB( DB_MASTER );
198198 //return $dbw->deadlockLoop( array( $revision, 'importUpload' ) );
199199 return false;
@@ -604,12 +604,12 @@
605605
606606 private function processUpload( $pageInfo, $uploadInfo ) {
607607 $revision = new WikiRevision;
608 - $text = isset( $uploadInfo['text'] ) ? $uploadInfo['text'] : '';
 608+ $text = isset( $uploadInfo['text'] ) ? $uploadInfo['text'] : '';
609609
610610 $revision->setTitle( $pageInfo['_title'] );
611 - $revision->setID( $pageInfo['id'] );
 611+ $revision->setID( $pageInfo['id'] );
612612 $revision->setTimestamp( $uploadInfo['timestamp'] );
613 - $revision->setText( $text );
 613+ $revision->setText( $text );
614614 $revision->setFilename( $uploadInfo['filename'] );
615615 $revision->setSrc( $uploadInfo['src'] );
616616 $revision->setSize( intval( $uploadInfo['size'] ) );
@@ -622,7 +622,7 @@
623623 $revision->setUserName( $uploadInfo['contributor']['username'] );
624624 }
625625
626 - return call_user_func( $this->mUploadCallback, $revision );
 626+ return call_user_func( $this->mUploadCallback, $revision );
627627 }
628628
629629 private function handleContributor() {
@@ -1057,7 +1057,7 @@
10581058 $resultDetails = array( 'internal' => $status->getWikiText() );
10591059 */
10601060
1061 - // @todo Fixme: it may create a page without our desire, also wrong potentially.
 1061+ // @todo Fixme: it may create a page without our desire, also wrong potentially.
10621062 // and, it will record a *current* upload, but we might want an archive version here
10631063
10641064 $file = wfLocalFile( $this->getTitle() );
@@ -1072,15 +1072,15 @@
10731073 return false;
10741074 }
10751075
1076 - $user = User::newFromName( $this->user_text );
 1076+ $user = User::newFromName( $this->user_text );
10771077
10781078 $status = $file->upload( $source,
10791079 $this->getComment(),
10801080 $this->getComment(), // Initial page, if none present...
10811081 File::DELETE_SOURCE,
10821082 false, // props...
1083 - $this->getTimestamp(),
1084 - is_object( $user ) ? ( $user->isLoggedIn() ? $user : null ) : null );
 1083+ $this->getTimestamp(),
 1084+ is_object( $user ) ? ( $user->isLoggedIn() ? $user : null ) : null );
10851085
10861086 if( $status->isGood() ) {
10871087 // yay?
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2963,10 +2963,10 @@
29642964 'undelete-show-file-submit' => 'Yes',
29652965
29662966 # Namespace form on various pages
2967 -'namespace' => 'Namespace:',
2968 -'invert' => 'Invert selection',
 2967+'namespace' => 'Namespace:',
 2968+'invert' => 'Invert selection',
29692969 'namespace_association' => 'Associated namespace',
2970 -'blanknamespace' => '(Main)',
 2970+'blanknamespace' => '(Main)',
29712971
29722972 # Contributions
29732973 'contributions' => 'User contributions',

Follow-up revisions

RevisionCommit summaryAuthorDate
r84265Followup r83536 to address Jack Phoenix's comments about the bogus w/s “cle...mah20:58, 18 March 2011

Comments

#Comment by Jack Phoenix (talk | contribs)   19:24, 8 March 2011
Index: trunk/phase3/includes/upload/UploadBase.php
===================================================================
--- trunk/phase3/includes/upload/UploadBase.php	(revision 83535)
+++ trunk/phase3/includes/upload/UploadBase.php	(revision 83536)
[snip]
 		if ( is_array( $wgMaxUploadSize ) ) {
-			if ( !is_null( $forType ) && isset( $wgMaxUploadSize[$forType] ) ) {
+			if ( !is_null( $forType) && isset( $wgMaxUploadSize[$forType] ) ) {
 				return $wgMaxUploadSize[$forType];
 			} else {
 				return $wgMaxUploadSize['*'];

This is wrong, the spacing in the original version was correct.

Index: trunk/phase3/includes/upload/UploadStash.php
===================================================================
--- trunk/phase3/includes/upload/UploadStash.php	(revision 83535)
+++ trunk/phase3/includes/upload/UploadStash.php	(revision 83536)
[snip]
@@ -102,7 +102,7 @@
 			wfDebug( "UploadStash: tried to stash file at '$path', but it doesn't exist\n" );
 			throw new UploadStashBadPathException( "path doesn't exist" );
 		}
-                $fileProps = File::getPropsFromPath( $path );
+				$fileProps = File::getPropsFromPath( $path );
 
 		// we will be initializing from some tmpnam files that don't have extensions.
 		// most of MediaWiki assumes all uploaded files have good extensions. So, we fix this.

The change to tabs is good, but there seems to be two tabs too much.

Index: trunk/phase3/includes/HttpFunctions.php
===================================================================
--- trunk/phase3/includes/HttpFunctions.php	(revision 83535)
+++ trunk/phase3/includes/HttpFunctions.php	(revision 83536)
@@ -141,7 +141,7 @@
  */
 class MWHttpRequest {
 	const SUPPORTS_FILE_POSTS = false;
-	
+
 	protected $content;
 	protected $timeout = 'default';
 	protected $headersOnly = null;
@@ -205,7 +205,7 @@
 
 	/**
 	 * Generate a new request object
-        * @param $url String: url to use
+		* @param $url String: url to use
 	 * @param $options Array: (optional) extra params to pass (see Http::request())
 	 * @see MWHttpRequest::__construct
 	 */

The second tab should be just a space.

The Import.php changes also look a bit wonky, seems that the incorrect space indentation was not removed. For example:

-               $user = User::newFromName( $this->user_text );
+			   $user = User::newFromName( $this->user_text );

It should be indented with two tabs, but currently it is indented with three tabs and three spaces.

People can have different opinions about indentation in Messages*.php files, but IMO they need no indentation, just 'key' => 'value', is fine, so I'm going to say that those changes are OK.

#Comment by MarkAHershberger (talk | contribs)   00:11, 9 March 2011

thanks for looking over these changes!

Status & tagging log