r75725 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75724‎ | r75725 | r75726 >
Date:17:23, 31 October 2010
Author:hashar
Status:ok (Comments)
Tags:
Comment:
* Use MW_INSTALL_PATH environment variable as a base path, default to previous '/../../phase3' if env not set.
* Adds a few PHP Extensions globals
* Die out with usage message when called without parameter
Modified paths:
  • /trunk/tools/code-utils/check-vars.php (modified) (history)

Diff [purge]

Index: trunk/tools/code-utils/check-vars.php
@@ -6,10 +6,12 @@
77 * Run as:
88 * find phase3/ \( -name \*.php -or -name \*.inc \) -not \( -name importUseModWiki.php -o -name diffLanguage.php -o -name LocalSettings.php -o -name Parser?????.php \) -exec php tools/code-utils/check-vars.php \{\} +
99 */
 10+if( ! $IP = getenv( 'MW_INSTALL_PATH' ) ) {
 11+ $IP = dirname( __FILE__ ) . "/../../phase3/";
 12+}
 13+require_once( "$IP/includes/Defines.php" ); # Faster than parsing
 14+require_once( "$IP/includes/AutoLoader.php" );
1015
11 -require_once( dirname( __FILE__ ) . "/../../phase3/includes/Defines.php" ); # Faster than parsing
12 -require_once( dirname( __FILE__ ) . "/../../phase3/includes/AutoLoader.php" );
13 -
1416 $mwDeprecatedFunctions = false;
1517 @include( dirname( __FILE__ ) . "/deprecated.functions" );
1618
@@ -69,8 +71,8 @@
7072
7173 function __construct() {
7274 if ( self::$mDefaultSettingsGlobals == null ) {
73 - $this->load( dirname( dirname( dirname( __FILE__ ) ) ) . "/phase3/includes/DefaultSettings.php", false );
74 -
 75+ global $IP;
 76+ $this->load( "$IP/includes/DefaultSettings.php", false );
7577 if ( count( $this->mTokens ) > 0 ) {
7678 $globals = array (
7779 '$wgArticle', # Setup.php
@@ -178,9 +180,17 @@
179181 $this->mFunctionQualifiers = array();
180182
181183
 184+ // Predefine constant that might not be defined by this file source code
182185 $this->mConstants = array( 'PARSEKIT_SIMPLE', 'UNORM_NFC', # Extensions
183186 /* Defined in Title.php and GlobalFunctions.php */
184 - 'GAID_FOR_UPDATE', 'TC_MYSQL', 'TS_UNIX', 'TS_MW', 'TS_DB', 'TS_RFC2822', 'TS_ISO_8601', 'TS_EXIF', 'TS_ORACLE', 'TS_POSTGRES', 'TS_DB2' ) ;
 187+ 'GAID_FOR_UPDATE', 'TC_MYSQL', 'TS_UNIX', 'TS_MW', 'TS_DB', 'TS_RFC2822',
 188+ 'TS_ISO_8601', 'TS_EXIF', 'TS_ORACLE', 'TS_POSTGRES', 'TS_DB2',
 189+ 'TS_ISO_8601_BASIC',
 190+ /* PHP extensions */
 191+ 'FILEINFO_MIME', 'FILEINFO_MIME_TYPE', 'MHASH_ADLER32',
 192+ 'SIGTERM', 'SIG_DFL',
 193+ 'SVN_REVISION_HEAD', 'SVN_REVISION_INITIAL',
 194+ ) ;
185195 }
186196
187197 static $functionQualifiers = array( T_ABSTRACT, T_PRIVATE, T_PUBLIC, T_PROTECTED, T_STATIC );
@@ -520,12 +530,16 @@
521531 $requirePath .= trim( $token[1], '\'"' );
522532 } else if ( $token[0] == T_VARIABLE ) {
523533 if ( $token[1] == '$IP' || $token[1] == '$mwPath' ) {
524 - $requirePath .= dirname( __FILE__ ) . '/../../phase3';
 534+ #$requirePath .= dirname( __FILE__ ) . '/../../phase3';
 535+ global $IP;
 536+ $requirePath .= $IP ;
525537 } elseif ( $token[1] == '$dir' ) {
526538 // Scripts at phase3/maintenance/language/
527539 $requirePath .= dirname( $this->mFilename );
528540 } elseif ( $token[1] == '$wgStyleDirectory' ) {
529 - $requirePath .= dirname( __FILE__ ) . '/../../phase3/skins';
 541+ #$requirePath .= dirname( __FILE__ ) . '/../../phase3/skins';
 542+ global $IP;
 543+ $requirePath .= "$IP/skins/";
530544 } elseif ( in_array( $token[1], array( '$classFile', '$file', '$_fileName', '$fileName', '$filename' ) ) ) {
531545 /* Maintenance.php lines 374 and 894 */
532546 /* LocalisationCache.php, MessageCache.php, AutoLoader.php */
@@ -534,7 +548,9 @@
535549 $requirePath .= $token[1];
536550 }
537551 } elseif ( $token[0] == T_STRING && $token[1] == 'DO_MAINTENANCE' ) {
538 - $requirePath .= dirname( __FILE__ ) . '/../../phase3/maintenance/doMaintenance.php';
 552+ #$requirePath .= dirname( __FILE__ ) . '/../../phase3/maintenance/doMaintenance.php';
 553+ global $IP;
 554+ $requirePath .= "$IP/maintenance/doMaintenance.php";
539555 } else {
540556 $requirePath .= $token[1];
541557 }
@@ -758,7 +774,9 @@
759775
760776 $cv = new CheckVars();
761777 // $cv->mDebug = true;
762 -
 778+if( $argc < 2 ) {
 779+ die ("Usage: $argv[0] <PHP_source_file> [--generate-deprecated-list]\n");
 780+}
763781 array_shift( $argv );
764782 if ( $argv[0] == '--generate-deprecated-list' ) {
765783 $cv->setGenerateDeprecatedList( true );

Follow-up revisions

RevisionCommit summaryAuthorDate
r75729Merge my WC changes....platonides18:22, 31 October 2010

Comments

#Comment by Platonides (talk | contribs)   18:09, 31 October 2010

The PHP extension constants shouldn't be needed (as far as the extension is loaded).

#Comment by Hashar (talk | contribs)   08:02, 13 November 2010

I use the PHP version provided by Apple, it does not come with a SVN module for example.

Status & tagging log