r96559 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96558‎ | r96559 | r96560 >
Date:12:49, 8 September 2011
Author:reedy
Status:ok
Tags:
Comment:
MFT r92422, r93520, r93563, r94107, r94433, r95042, r95332, r95451, r96386

Tests excluded (due to movements etc)
Modified paths:
  • /branches/REL1_17/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_17/phase3/docs/hooks.txt (modified) (history)
  • /branches/REL1_17/phase3/includes/IP.php (modified) (history)
  • /branches/REL1_17/phase3/includes/ObjectCache.php (modified) (history)
  • /branches/REL1_17/phase3/includes/installer/Installer.php (modified) (history)
  • /branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php (modified) (history)
  • /branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderFileModule.php (modified) (history)
  • /branches/REL1_17/phase3/maintenance/Maintenance.php (modified) (history)
  • /branches/REL1_17/phase3/resources/mediawiki.util/mediawiki.util.js (modified) (history)

Diff [purge]

Index: branches/REL1_17/phase3/RELEASE-NOTES
@@ -54,6 +54,13 @@
5555 wide pano/timeline/diagram SVGs renderable at saner sizes.
5656 * (bug 29959) Installer fatal when cURL and allow_url_fopen is disabled and user
5757 tries to subsribe to mediawiki-announce.
 58+* Installer checked for magic_quotes_runtime instead of register_globals
 59+* (bug 30131) XCache with variable caching disabled no longer used for variable
 60+ caching (CACHE_ACCEL)
 61+* (bug 30264) Changed installer-generated LocalSettings.php to use require_once()
 62+ instead require() for included extensions.
 63+* (bug 26486) ResourceLoader modules with paths to nonexistent files cause PHP
 64+ warnings/notices to be thrown
5865
5966 === Changes since 1.17.0rc1 ===
6067
Property changes on: branches/REL1_17/phase3/RELEASE-NOTES
___________________________________________________________________
Modified: svn:mergeinfo
6168 Merged /trunk/phase3/RELEASE-NOTES:r92422,93520,93563,94107,94433,95042,95332,95451,96386
Index: branches/REL1_17/phase3/resources/mediawiki.util/mediawiki.util.js
@@ -139,7 +139,9 @@
140140 var re = new RegExp( '[^#]*[&?]' + $.escapeRE( param ) + '=([^&#]*)' );
141141 var m = re.exec( url );
142142 if ( m && m.length > 1 ) {
143 - return decodeURIComponent( m[1] );
 143+ // Beware that decodeURIComponent is not required to understand '+'
 144+ // by spec, as encodeURIComponent does not produce it.
 145+ return decodeURIComponent( m[1].replace( /\+/g, '%20' ) );
144146 }
145147 return null;
146148 },
Index: branches/REL1_17/phase3/maintenance/Maintenance.php
@@ -565,10 +565,14 @@
566566 } elseif ( substr( $arg, 0, 2 ) == '--' ) {
567567 # Long options
568568 $option = substr( $arg, 2 );
 569+ if ( array_key_exists( $option, $options ) ) {
 570+ $this->error( "\nERROR: $option parameter given twice\n" );
 571+ $this->maybeHelp( true );
 572+ }
569573 if ( isset( $this->mParams[$option] ) && $this->mParams[$option]['withArg'] ) {
570574 $param = next( $argv );
571575 if ( $param === false ) {
572 - $this->error( "\nERROR: $option needs a value after it\n" );
 576+ $this->error( "\nERROR: $option parameter needs a value after it\n" );
573577 $this->maybeHelp( true );
574578 }
575579 $options[$option] = $param;
@@ -586,10 +590,14 @@
587591 # Short options
588592 for ( $p = 1; $p < strlen( $arg ); $p++ ) {
589593 $option = $arg { $p } ;
 594+ if ( array_key_exists( $option, $options ) ) {
 595+ $this->error( "\nERROR: $option parameter given twice\n" );
 596+ $this->maybeHelp( true );
 597+ }
590598 if ( isset( $this->mParams[$option]['withArg'] ) && $this->mParams[$option]['withArg'] ) {
591599 $param = next( $argv );
592600 if ( $param === false ) {
593 - $this->error( "\nERROR: $option needs a value after it\n" );
 601+ $this->error( "\nERROR: $option parameter needs a value after it\n" );
594602 $this->maybeHelp( true );
595603 }
596604 $options[$option] = $param;
Index: branches/REL1_17/phase3/docs/hooks.txt
@@ -600,7 +600,7 @@
601601
602602 'ContribsPager::getQueryInfo': Before the contributions query is about to run
603603 &$pager: Pager object for contributions
604 -&queryInfo: The query for the contribs Pager
 604+&$queryInfo: The query for the contribs Pager
605605
606606 'ContributionsLineEnding': Called before a contributions HTML line is finished
607607 $page: SpecialPage object for contributions
Property changes on: branches/REL1_17/phase3/docs/hooks.txt
___________________________________________________________________
Modified: svn:mergeinfo
608608 Merged /trunk/phase3/docs/hooks.txt:r92422,93520,93563,94107,94433,95042,95332,95451,96386
Index: branches/REL1_17/phase3/includes/ObjectCache.php
@@ -66,7 +66,7 @@
6767 $wgCaches[CACHE_ACCEL] = new eAccelBagOStuff;
6868 } elseif ( function_exists( 'apc_fetch') ) {
6969 $wgCaches[CACHE_ACCEL] = new APCBagOStuff;
70 - } elseif( function_exists( 'xcache_get' ) ) {
 70+ } elseif( function_exists( 'xcache_get' ) && wfIniGetBool( 'xcache.var_size' ) ) {
7171 $wgCaches[CACHE_ACCEL] = new XCacheBagOStuff();
7272 } elseif( function_exists( 'wincache_ucache_get' ) ) {
7373 $wgCaches[CACHE_ACCEL] = new WinCacheBagOStuff();
Index: branches/REL1_17/phase3/includes/IP.php
@@ -303,7 +303,7 @@
304304 static $privateRanges = false;
305305 if ( !$privateRanges ) {
306306 $privateRanges = array(
307 - array( 'fc::', 'fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' ), # RFC 4193 (local)
 307+ array( 'fc00::', 'fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' ), # RFC 4193 (local)
308308 array( '0:0:0:0:0:0:0:1', '0:0:0:0:0:0:0:1' ), # loopback
309309 );
310310 }
Property changes on: branches/REL1_17/phase3/includes/IP.php
___________________________________________________________________
Modified: svn:mergeinfo
311311 Merged /trunk/phase3/includes/IP.php:r92422,93520,93563,94107,94433,95042,95332,95451,96386
Index: branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderFileModule.php
@@ -360,7 +360,7 @@
361361 }
362362
363363 wfProfileIn( __METHOD__.'-filemtime' );
364 - $filesMtime = max( array_map( 'filemtime', $files ) );
 364+ $filesMtime = max( array_map( array( __CLASS__, 'safeFilemtime' ), $files ) );
365365 wfProfileOut( __METHOD__.'-filemtime' );
366366 $this->modifiedTime[$context->getHash()] = max(
367367 $filesMtime,
@@ -444,10 +444,16 @@
445445 $js = '';
446446 foreach ( array_unique( $scripts ) as $fileName ) {
447447 $localPath = $this->getLocalPath( $fileName );
448 - $contents = file_get_contents( $localPath );
449 - if ( $contents === false ) {
 448+ if ( !file_exists( $localPath ) ) {
450449 throw new MWException( __METHOD__.": script file not found: \"$localPath\"" );
451450 }
 451+ $contents = file_get_contents( $localPath );
 452+ if ( $wgResourceLoaderValidateStaticJS ) {
 453+ // Static files don't really need to be checked as often; unlike
 454+ // on-wiki module they shouldn't change unexpectedly without
 455+ // admin interference.
 456+ $contents = $this->validateScriptFile( $fileName, $contents );
 457+ }
452458 $js .= $contents . "\n";
453459 }
454460 return $js;
@@ -484,15 +490,16 @@
485491 *
486492 * This method can be used as a callback for array_map()
487493 *
488 - * @param $path String: File path of script file to read
 494+ * @param $path String: File path of style file to read
489495 * @return String: CSS data in script file
 496+ * @throws MWException if the file doesn't exist
490497 */
491498 protected function readStyleFile( $path, $flip ) {
492499 $localPath = $this->getLocalPath( $path );
493 - $style = file_get_contents( $localPath );
494 - if ( $style === false ) {
 500+ if ( !file_exists( $localPath ) ) {
495501 throw new MWException( __METHOD__.": style file not found: \"$localPath\"" );
496502 }
 503+ $style = file_get_contents( $localPath );
497504 if ( $flip ) {
498505 $style = CSSJanus::transform( $style, true, false );
499506 }
@@ -506,4 +513,30 @@
507514 $style, $dir, $remoteDir, true
508515 );
509516 }
 517+
 518+ /**
 519+ * Safe version of filemtime(), which doesn't throw a PHP warning if the file doesn't exist
 520+ * but returns 1 instead.
 521+ * @param $filename string File name
 522+ * @return int UNIX timestamp, or 1 if the file doesn't exist
 523+ */
 524+ protected static function safeFilemtime( $filename ) {
 525+ if ( file_exists( $filename ) ) {
 526+ return filemtime( $filename );
 527+ } else {
 528+ // We only ever map this function on an array if we're gonna call max() after,
 529+ // so return our standard minimum timestamps here. This is 1, not 0, because
 530+ // wfTimestamp(0) == NOW
 531+ return 1;
 532+ }
 533+ }
 534+
 535+ /**
 536+ * Get whether CSS for this module should be flipped
 537+ * @param $context ResourceLoaderContext
 538+ * @return bool
 539+ */
 540+ public function getFlip( $context ) {
 541+ return $context->getDirection() === 'rtl';
 542+ }
510543 }
Index: branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php
@@ -129,7 +129,7 @@
130130
131131 foreach( $this->extensions as $extName ) {
132132 $encExtName = self::escapePhpString( $extName );
133 - $localSettings .= "require( \"extensions/$encExtName/$encExtName.php\" );\n";
 133+ $localSettings .= "require_once( \"extensions/$encExtName/$encExtName.php\" );\n";
134134 }
135135 }
136136
Property changes on: branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php
___________________________________________________________________
Modified: svn:mergeinfo
137137 Merged /trunk/phase3/includes/installer/LocalSettingsGenerator.php:r92422,93520,93563,94107,94433,95042,95332,95451,96386
Index: branches/REL1_17/phase3/includes/installer/Installer.php
@@ -782,6 +782,9 @@
783783 $caches = array();
784784 foreach ( $this->objectCaches as $name => $function ) {
785785 if ( function_exists( $function ) ) {
 786+ if ( $name == 'xcache' && !wfIniGetBool( 'xcache.var_size' ) ) {
 787+ continue;
 788+ }
786789 $caches[$name] = true;
787790 }
788791 }
Property changes on: branches/REL1_17/phase3/includes/installer/Installer.php
___________________________________________________________________
Modified: svn:mergeinfo
789792 Merged /trunk/phase3/includes/installer/Installer.php:r92422,93520,93563,94107,94433,95042,95332,95451,96386

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92422Disallow given options twice (instead of letting the newest one take preceden...aaron03:30, 18 July 2011
r93520:facepalm: Installer checked for magic_quotes_runtime instead of register_glo...maxsem09:52, 30 July 2011
r93563* (bug 30131) XCache with variable caching disabled no longer used for variab...brion01:52, 31 July 2011
r94107(bug 30264) MediaWiki installer uses require, de facto is require_oncedemon13:59, 9 August 2011
r94433(bug 26486) ResourceLoader modules with paths to nonexistent files cause PHP ...catrope21:25, 13 August 2011
r95042Fix a typoraymond20:58, 19 August 2011
r95332* (bug 30441) getParamValue must understand "+" encoding of space...brion20:17, 23 August 2011
r95451Followup r95332 (bug 30441 fix) -- Roan pointed out that I forgot to do a glo...brion22:09, 24 August 2011
r96386Fixed typo in ipv6 private IP range list and added test (bug 30739)aaron23:15, 6 September 2011

Status & tagging log