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

Change subject: Eliminate some more system calls
......................................................................


Eliminate some more system calls

Eliminate a few more getRealmSpecificFilename() and file_exists() calls.

Change-Id: If792de0112205adecefdd6f818b98528716fd273
---
M multiversion/MWMultiVersion.php
M wmf-config/CommonSettings.php
2 files changed, 19 insertions(+), 40 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/multiversion/MWMultiVersion.php b/multiversion/MWMultiVersion.php
index 33fe09c..69c26c0 100644
--- a/multiversion/MWMultiVersion.php
+++ b/multiversion/MWMultiVersion.php
@@ -283,14 +283,19 @@
         * The first item is the MW version
         */
        private function loadVersionInfo() {
+               global $wmfRealm;
+
                if ( $this->versionLoaded ) {
                        return;
                }
                $this->versionLoaded = true;
 
-               $phpFilename = getRealmSpecificFilename(
-                       MEDIAWIKI_DEPLOYMENT_DIR . '/wikiversions.php'
-               );
+               if ( $wmfRealm === 'labs' ) {
+                       $phpFilename = MEDIAWIKI_DEPLOYMENT_DIR . 
'/wikiversions-labs.php';
+               } else {
+                       $phpFilename = MEDIAWIKI_DEPLOYMENT_DIR . 
'/wikiversions.php';
+               }
+
                $wikiversions = include( $phpFilename );
 
                if ( !is_array( $wikiversions ) ) {
@@ -304,19 +309,6 @@
                }
 
                $this->version = $version;
-       }
-
-       /**
-        * Sanity check that this wiki actually exists.
-        * @return bool
-        */
-       private function assertNotMissing() {
-               $phpFilename = getRealmSpecificFilename(
-                       MEDIAWIKI_DEPLOYMENT_DIR . '/wikiversions.php'
-               );
-               if ( $this->isMissing() ) {
-                       self::error( "$phpFilename has no version entry for 
`{$this->db}`.\n" );
-               }
        }
 
        /**
@@ -337,7 +329,9 @@
         */
        public function getVersion() {
                $this->loadVersionInfo();
-               $this->assertNotMissing(); // caller should have checked 
isMissing()
+               if ( $this->version === false ) {
+                       self::error( "no version entry for `{$this->db}`.\n" );
+               }
                return $this->version;
        }
 
@@ -349,7 +343,9 @@
         */
        public function getVersionNumber() {
                $this->loadVersionInfo();
-               $this->assertNotMissing(); // caller should have checked 
isMissing()
+               if ( $this->version === false ) {
+                       self::error( "no version entry for `{$this->db}`.\n" );
+               }
                return substr( $this->version, 4 ); // remove "php-"
        }
 
diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index 8dd12d0..7fe8b3b 100755
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -234,13 +234,6 @@
 $wgLocalisationCacheConf['storeDirectory'] = "$IP/cache/l10n";
 $wgLocalisationCacheConf['manualRecache'] = true;
 
-// Temporary hack to facilitate migration of l10n cache implementations.
-// Use LCStoreStaticArray if a magic file is present and if the l10n cache
-// appears to be populated. -- Ori, 2015-07-13
-//if ( file_exists( '/etc/lcstore' ) && file_exists( 
"$IP/cache/l10n/zu.l10n.php" ) ) {
-//     $wgLocalisationCacheConf['storeClass'] = 'LCStoreStaticArray';
-//}
-
 // T29320: skip MessageBlobStore::clear(); handle via refreshMessageBlobs.php 
instead
 $wgHooks['LocalisationCacheRecache'][] = function( $cache, $code, &$allData, 
&$purgeBlobs = true ) {
        $purgeBlobs = false;
@@ -781,9 +774,7 @@
 }
 
 include( $IP . '/extensions/TrustedXFF/TrustedXFF.php' );
-if ( file_exists( "$wmfConfigDir/trusted-xff.cdb" ) ) {
-       $wgTrustedXffFile = "$wmfConfigDir/trusted-xff.cdb";
-}
+$wgTrustedXffFile = "$wmfConfigDir/trusted-xff.cdb";
 
 if ( $wmgUseContactPage ) {
        include( $IP . '/extensions/ContactPage/ContactPage.php' );
@@ -1356,15 +1347,10 @@
        return true;
 };
 
-if ( file_exists( '/etc/wikimedia-image-scaler' ) ) {
-       $wgMaxShellMemory = 512 * 1024;
-       $wgMaxShellFileSize = 512 * 1024;
-       if ( defined( 'HHVM_VERSION' ) ) {
-               $wgMaxShellMemory *= 2;
-               $wgDisableOutputCompression = true;
-       }
-}
-$wgMaxShellTime = 50; // so it times out before PHP and curl and squid
+$wgDisableOutputCompression = true;
+$wgMaxShellFileSize = 512 * 1024;
+$wgMaxShellMemory = 1024 * 1024;
+$wgMaxShellTime = 50;
 
 // Use a cgroup for shell execution.
 // This will cause shell execution to fail if the cgroup is not installed.
@@ -2706,9 +2692,6 @@
        );
 }
 
-// @note getRealmSpecificFilename only works with filenames with .suffix
-// needs to be listed outside of use wikibase check below, as localisation 
cache
-// might be build as "aawikibooks" or something that does not have Wikibase.
 $wgExtensionEntryPointListFiles[] = 
"$IP/extensions/Wikidata/extension-list-wikidata";
 
 if ( $wmgUseWikibaseRepo || $wmgUseWikibaseClient ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If792de0112205adecefdd6f818b98528716fd273
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to