Hashar has uploaded a new change for review.
https://gerrit.wikimedia.org/r/61425
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(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config
refs/changes/25/61425/1
diff --git a/multiversion/MWMultiVersion.php b/multiversion/MWMultiVersion.php
index 13db7cb..d6dc043 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: newchange
Gerrit-Change-Id: Id6f4e33f88d036823d2c3a2ea3a085b25a7fd082
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits