jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/327915 )

Change subject: Bug monoversion installation, maintenance
......................................................................


Bug monoversion installation, maintenance

Bugs:
* Monoversion installation was broken because
  architecture was modified (and it was out-of-tests)

Code:
* Document it works with MW >= 1.3 instead of >= 1.6
* Added two classes in extension.json, even if loaded independently
* Rewrote a bit the credits loading for MediaWikiFarm

Change-Id: I906e3b3626077b5af582bb122b52ed9edc60a77f
---
M MediaWikiFarm.php
M extension.json
M src/MediaWikiFarm.php
M tests/phpunit/LoadingTest.php
4 files changed, 26 insertions(+), 18 deletions(-)

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



diff --git a/MediaWikiFarm.php b/MediaWikiFarm.php
index f1c27a4..99e9575 100644
--- a/MediaWikiFarm.php
+++ b/MediaWikiFarm.php
@@ -27,6 +27,6 @@
        MediaWikiFarm::load();
 
        # Load MediaWiki configuration
-       require_once MediaWikiFarm::getInstance()->getConfigFile();
+       require_once $wgMediaWikiFarm->getConfigFile();
 }
 // @codeCoverageIgnoreEnd
diff --git a/extension.json b/extension.json
index 1ad7552..8a2d26f 100644
--- a/extension.json
+++ b/extension.json
@@ -9,7 +9,7 @@
        "url": "https://www.mediawiki.org/wiki/Extension:MediaWikiFarm";,
        "type": "other",
        "requires": {
-               "MediaWiki": ">= 1.6.0"
+               "MediaWiki": ">= 1.3.0"
        },
        "config": {
                "MediaWikiFarmConfigDir": "/etc/mediawiki",
@@ -28,6 +28,8 @@
        },
        "AutoloadClasses": {
                "MediaWikiFarm": "src/MediaWikiFarm.php",
+               "AbstractMediaWikiFarmScript": 
"src/AbstractMediaWikiFarmScript.php",
+               "MediaWikiFarmScript": "src/MediaWikiFarmScript.php",
                "MWFConfigurationException": "src/MediaWikiFarm.php"
        },
        "manifest_version": 1
diff --git a/src/MediaWikiFarm.php b/src/MediaWikiFarm.php
index 18e871a..5f5c309 100644
--- a/src/MediaWikiFarm.php
+++ b/src/MediaWikiFarm.php
@@ -369,11 +369,21 @@
                        }
                }
 
-               # Register this extension MediaWikiFarm to appear in 
Special:Version
-               if( $this->parameters['ExtensionRegistry'] ) {
-                       wfLoadExtension( 'MediaWikiFarm', $this->codeDir ? 
$this->farmDir . '/extension.json' : null );
+               # Load extensions with the wfLoadExtension mechanism
+               foreach( $this->configuration['extensions'] as $extension => 
$value ) {
+
+                       if( $value == 'wfLoadExtension' && ( $extension != 
'MediaWikiFarm' || !$this->codeDir ) ) {
+
+                               wfLoadExtension( $extension );
+                       }
                }
-               else {
+
+               # Register this extension MediaWikiFarm to appear in 
Special:Version
+               if( $this->configuration['extensions']['MediaWikiFarm'] == 
'wfLoadExtension' && $this->codeDir ) {
+
+                       wfLoadExtension( 'MediaWikiFarm', $this->farmDir . 
'/extension.json' );
+               }
+               elseif( $this->configuration['extensions']['MediaWikiFarm'] == 
'require_once' ) {
                        $GLOBALS['wgExtensionCredits']['other'][] = array(
                                'path' => $this->farmDir . '/MediaWikiFarm.php',
                                'name' => 'MediaWikiFarm',
@@ -385,18 +395,11 @@
                        );
 
                        $GLOBALS['wgAutoloadClasses']['MediaWikiFarm'] = 
'src/MediaWikiFarm.php';
+                       
$GLOBALS['wgAutoloadClasses']['AbstractMediaWikiFarmScript'] = 
'src/AbstractMediaWikiFarmScript.php';
+                       $GLOBALS['wgAutoloadClasses']['MediaWikiFarmScript'] = 
'src/MediaWikiFarmScript.php';
                        
$GLOBALS['wgAutoloadClasses']['MWFConfigurationException'] = 
'src/MediaWikiFarm.php';
                        $GLOBALS['wgMessagesDirs']['MediaWikiFarm'] = array( 
'i18n' );
                        $GLOBALS['wgHooks']['UnitTestsList'][] = array( 
'MediaWikiFarm::onUnitTestsList' );
-               }
-
-               # Load extensions with the wfLoadExtension mechanism
-               foreach( $this->configuration['extensions'] as $extension => 
$value ) {
-
-                       if( $value == 'wfLoadExtension' && $extension != 
'MediaWikiFarm' ) {
-
-                               wfLoadExtension( $extension );
-                       }
                }
        }
 
@@ -1193,6 +1196,7 @@
                }
 
                $settings['wgUseExtensionMediaWikiFarm'] = true;
+               $this->configuration['extensions']['MediaWikiFarm'] = 
'require_once';
                if( $this->parameters['ExtensionRegistry'] ) {
                        $this->configuration['extensions']['MediaWikiFarm'] = 
'wfLoadExtension';
                }
@@ -1304,10 +1308,10 @@
                $localSettings .= "\n# Extensions\n";
                foreach( $configuration['extensions'] as $extension => $loading 
) {
                        if( $loading == 'wfLoadExtension' ) {
-                               if( $extension == 'MediaWikiFarm' ) {
-                                       $localSettings .= "wfLoadExtension( 
'MediaWikiFarm'" . ( $this->codeDir ? ', ' . var_export( $this->farmDir . 
'/extension.json', true ) : '' ) ." );\n";
-                               } else {
+                               if( $extension != 'MediaWikiFarm' || 
!$this->codeDir ) {
                                        $localSettings .= "wfLoadExtension( 
'$extension' );\n";
+                               } elseif( $extension == 'MediaWikiFarm' ) {
+                                       $localSettings .= "wfLoadExtension( 
'MediaWikiFarm', " . var_export( $this->farmDir . '/extension.json', true ) . " 
);\n";
                                }
                        }
                }
diff --git a/tests/phpunit/LoadingTest.php b/tests/phpunit/LoadingTest.php
index 06cea11..f35099c 100644
--- a/tests/phpunit/LoadingTest.php
+++ b/tests/phpunit/LoadingTest.php
@@ -247,6 +247,8 @@
                        $result['extensions']['TestExtensionWfLoadExtension'] = 
'wfLoadExtension';
                        $result['extensions']['MediaWikiFarm'] = 
'wfLoadExtension';
                        $result['skins']['TestSkinWfLoadSkin'] = 'wfLoadSkin';
+               } else {
+                       $result['extensions']['MediaWikiFarm'] = 'require_once';
                }
 
                $exists = MediaWikiFarm::load( 'index.php', 
'b.testfarm-multiversion-test-extensions.example.org' );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I906e3b3626077b5af582bb122b52ed9edc60a77f
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MediaWikiFarm
Gerrit-Branch: master
Gerrit-Owner: Seb35 <seb35wikipe...@gmail.com>
Gerrit-Reviewer: Seb35 <seb35wikipe...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to