Aaron Schulz has submitted this change and it was merged.

Change subject: multiversion: ability to destroy singleton
......................................................................


multiversion: ability to destroy singleton

To make the class testable, need the ability to destroy the singleton
instance or we only have one test case.  The method will throw an
exception whenever it is used under non CLI interface.

Change-Id: Id6f4e33f88d036823d2c3a2ea3a085b25a7fd082
---
M multiversion/MWMultiVersion.php
1 file changed, 12 insertions(+), 0 deletions(-)

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



diff --git a/multiversion/MWMultiVersion.php b/multiversion/MWMultiVersion.php
index 13db7cb..3852c46 100644
--- a/multiversion/MWMultiVersion.php
+++ b/multiversion/MWMultiVersion.php
@@ -107,6 +107,18 @@
        }
 
        /**
+        * Destroy the singleton instance to let a subsequent call create a new
+        * one. This should NEVER be used on non CLI interface, that will throw 
an
+        * internal error.
+        */
+       public static function destroySingleton() {
+               if( PHP_SAPI !== 'cli' ) {
+                       self::error('Can not destroy singleton instance when 
used ' .
+                               'with non-CLI interface' );
+               }
+               self::$instance = null;
+       }
+       /**
         * Derives site and lang from the parameters and sets $site and $lang 
on the instance
         * @param $serverName the ServerName for this wiki -- 
$_SERVER['SERVER_NAME']
         * @param $docRoot the DocumentRoot for this wiki -- 
$_SERVER['DOCUMENT_ROOT']

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id6f4e33f88d036823d2c3a2ea3a085b25a7fd082
Gerrit-PatchSet: 2
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to