jenkins-bot has submitted this change and it was merged.

Change subject: Fix various path inflexibilities and inconsistencies
......................................................................


Fix various path inflexibilities and inconsistencies

- MWVersion.php#getMediaWiki
  The other accesses to $_SERVER in this function have an
  error suppression on it, but this one did not. Messing with
  something locally from the command line threw an E_NOTICE
  on this one.

- multiversion/defines
  Simplify definitions by re-using the same variables instead
  of repeating the same paths. Makes it easier to update when
  testing locally in a different directory structure.

- multiversion/populateWikiversions
  Function populateWikiversionsCDB uses MULTIVER_CDB_DIR_HOME
  (on line 46) but multiversion/defines is not loaded. Not
  sure how this ever worked.

  Warning: file_put_contents(MULTIVER_CDB_DIR_HOME/wikiversions.dat):
  failed to open stream: No such file or directory
  in multiversion/populateWikiversions on line 45

- CommonSettings
  The on-demand loading of Profiler if CommonSettings is used
  outside MediaWiki context was broken since it has moved in
  core and now requires two files to get wfProfileIn and
  ProfileStub.

- Avoid making assumptions that php-X.X ($IP) is a direct
  subdirectory of common (e.g. "$IP/../all.dblist" etc.).
  Instead separating these concerns by having all MediaWiki
  inclusions use $IP, and all mediawiki-config / common
  references use $wmfCommonDir (set relatively based on where
  CommonSettings.php, which is in the same repository as
  all.dblist).

Change-Id: Ia723694e90af8d84182620043fba0563076fde81
---
M multiversion/MWVersion.php
M multiversion/defines.php
M multiversion/populateWikiversions
M wmf-config/CommonSettings.php
M wmf-config/wgConf.php
5 files changed, 17 insertions(+), 13 deletions(-)

Approvals:
  Krinkle: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/multiversion/MWVersion.php b/multiversion/MWVersion.php
index 7236791..943c2ad 100644
--- a/multiversion/MWVersion.php
+++ b/multiversion/MWVersion.php
@@ -43,7 +43,7 @@
 
        # MW_SECURE_HOST set from secure gateway?
        $secure = getenv( 'MW_SECURE_HOST' );
-       $host = $secure ? $secure : $_SERVER['HTTP_HOST'];
+       $host = $secure ? $secure : @$_SERVER['HTTP_HOST'];
 
        # Get the correct MediaWiki path based on this version...
        $IP = MULTIVER_COMMON_APACHE . "/$version";
diff --git a/multiversion/defines.php b/multiversion/defines.php
index 2372eec..905a14e 100644
--- a/multiversion/defines.php
+++ b/multiversion/defines.php
@@ -5,8 +5,8 @@
 define( 'MULTIVER_COMMON_HOME', '/a/common' );
 define( 'MULTIVER_COMMON_APACHE', '/usr/local/apache/common-local' );
 
-define( 'MULTIVER_CDB_DIR_HOME', '/a/common' );
-define( 'MULTIVER_CDB_DIR_APACHE', '/usr/local/apache/common-local' );
+define( 'MULTIVER_CDB_DIR_HOME', MULTIVER_COMMON_HOME );
+define( 'MULTIVER_CDB_DIR_APACHE', MULTIVER_COMMON_APACHE );
 
-define( 'MULTIVER_404SCRIPT_PATH_HOME', '/a/common/wmf-config/missing.php' );
-define( 'MULTIVER_404SCRIPT_PATH_APACHE', 
'/usr/local/apache/common-local/wmf-config/missing.php' );
+define( 'MULTIVER_404SCRIPT_PATH_HOME', MULTIVER_COMMON_HOME . 
'/wmf-config/missing.php' );
+define( 'MULTIVER_404SCRIPT_PATH_APACHE', MULTIVER_COMMON_APACHE . 
'/wmf-config/missing.php' );
diff --git a/multiversion/populateWikiversions 
b/multiversion/populateWikiversions
index b2536a4..323e5a9 100755
--- a/multiversion/populateWikiversions
+++ b/multiversion/populateWikiversions
@@ -2,6 +2,8 @@
 <?php
 
 error_reporting( E_ALL );
+
+require_once( __DIR__ . '/defines.php' );
 require_once( __DIR__ . '/MWRealm.php' );
 /*
  * Populate wikiversions.cdb file using all the items in all.dblist
diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index 97ecb5d..e2128e1 100644
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -39,7 +39,8 @@
 
 # Protection for unusual entry points
 if ( !function_exists( 'wfProfileIn' ) ) {
-       require( './includes/ProfilerStub.php' );
+       require_once( './includes/profiler/Profiler.php' );
+       require_once( './includes/profiler/ProfilerStub.php' );
 }
 
 $fname = 'CommonSettings.php';
@@ -133,7 +134,8 @@
 $wgDBuser = 'wikiuser';
 
 # wmf-config directory (in common/)
-$wmfConfigDir = "$IP/../wmf-config";
+$wmfCommonDir = dirname( __DIR__ );
+$wmfConfigDir = __DIR__;
 
 wfProfileOut( "$fname-host" );
 
@@ -198,7 +200,7 @@
 
        $wikiTags = array();
        foreach ( array( 'private', 'fishbowl', 'special', 'closed', 
'flaggedrevs', 'small', 'medium', 'large', 'wikimania', 'wikidata', 
'wikidataclient', 'visualeditor' ) as $tag ) {
-               $dblist = array_map( 'trim', file( getRealmSpecificFilename( 
"$IP/../$tag.dblist" ) ) );
+               $dblist = array_map( 'trim', file( getRealmSpecificFilename( 
"$wmfCommonDir/$tag.dblist" ) ) );
                if ( in_array( $wgDBname, $dblist ) ) {
                        $wikiTags[] = $tag;
                }
@@ -558,9 +560,9 @@
 
 // Config for sitematrix
 $wgSiteMatrixFile = '/apache/common/langlist';
-$wgSiteMatrixClosedSites = array_map( 'trim', file( getRealmSpecificFilename( 
"$IP/../closed.dblist" ) ) );
-$wgSiteMatrixPrivateSites = array_map( 'trim', file( getRealmSpecificFilename( 
"$IP/../private.dblist" ) ) );
-$wgSiteMatrixFishbowlSites = array_map( 'trim', file( 
getRealmSpecificFilename( "$IP/../fishbowl.dblist" ) ) );
+$wgSiteMatrixClosedSites = array_map( 'trim', file( getRealmSpecificFilename( 
"$wmfCommonDir/closed.dblist" ) ) );
+$wgSiteMatrixPrivateSites = array_map( 'trim', file( getRealmSpecificFilename( 
"$wmfCommonDir/private.dblist" ) ) );
+$wgSiteMatrixFishbowlSites = array_map( 'trim', file( 
getRealmSpecificFilename( "$wmfCommonDir/fishbowl.dblist" ) ) );
 
 include( $IP . '/extensions/CharInsert/CharInsert.php' );
 
@@ -2490,7 +2492,7 @@
 
        $wgWBRepoSettings['clientDbList'] = array_merge(
                array( 'test2wiki' => 'test2wiki' ),
-               array_map( 'trim', file( getRealmSpecificFilename( 
"$IP/../wikipedia.dblist" ) ) )
+               array_map( 'trim', file( getRealmSpecificFilename( 
"$wmfCommonDir/wikipedia.dblist" ) ) )
        );
 
        $wgWBRepoSettings['localClientDatabases'] = array_combine(
diff --git a/wmf-config/wgConf.php b/wmf-config/wgConf.php
index dd2e29a..0f6ed30 100644
--- a/wmf-config/wgConf.php
+++ b/wmf-config/wgConf.php
@@ -22,7 +22,7 @@
 
 $wgConf->localVHosts = require( getRealmSpecificFilename( 
"$wmfConfigDir/wgConfVHosts.php" ) );
 
-$wgConf->wikis = array_map( 'trim', file( getRealmSpecificFilename( 
"$IP/../all.dblist" ) ) );
+$wgConf->wikis = array_map( 'trim', file( getRealmSpecificFilename( 
"$wmfCommonDir/all.dblist" ) ) );
 
 $wgConf->fullLoadCallback = 'wmfLoadInitialiseSettings';
 

-- 
To view, visit https://gerrit.wikimedia.org/r/62923
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia723694e90af8d84182620043fba0563076fde81
Gerrit-PatchSet: 6
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to