Florianschmidtwelzow has uploaded a new change for review.
https://gerrit.wikimedia.org/r/325117
Change subject: Don't let extensions load other extensions lately
......................................................................
Don't let extensions load other extensions lately
ExtensionRegistry now offers a way to prevent loading any extension
after the queue was marked as finish. This allows us to have a
defined amount of extensions loaded at a specific time, the set of
extensions isn't allowed to be changed later. This is a requirement
for extensions/skins that depends on other extensions, so that
dependencies can't be loaded after the Setup is already finished.
Change-Id: I09b306bd6f6ccf4210f36be0118e7f17f2c3d264
---
M includes/Setup.php
M includes/registration/ExtensionRegistry.php
2 files changed, 24 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/17/325117/1
diff --git a/includes/Setup.php b/includes/Setup.php
index 9f722af..ff948df 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -38,6 +38,8 @@
// If any extensions are still queued, force load them
ExtensionRegistry::getInstance()->loadFromQueue();
+// Don't let any other extensions load
+ExtensionRegistry::getInstance()->finish();
// Check to see if we are at the file scope
if ( !isset( $wgVersion ) ) {
diff --git a/includes/registration/ExtensionRegistry.php
b/includes/registration/ExtensionRegistry.php
index b5c70e9..0b67b17 100644
--- a/includes/registration/ExtensionRegistry.php
+++ b/includes/registration/ExtensionRegistry.php
@@ -60,6 +60,13 @@
protected $queued = [];
/**
+ * Whether we are done loading things
+ *
+ * @var bool
+ */
+ private $finished = false;
+
+ /**
* Items in the JSON file that aren't being
* set as globals
*
@@ -120,6 +127,12 @@
return;
}
+ if ( $this->finished ) {
+ throw new MWException(
+ "The following paths tried to load late: " .
implode( ', ', $this->queued )
+ );
+ }
+
// A few more things to vary the cache on
$versions = [
'registration' => self::CACHE_VERSION,
@@ -165,6 +178,15 @@
}
/**
+ * After this is called, no more extensions can be loaded
+ *
+ * @since 1.29
+ */
+ public function finish() {
+ $this->finished = true;
+ }
+
+ /**
* Process a queue of extensions and return their extracted data
*
* @param array $queue keys are filenames, values are ignored
--
To view, visit https://gerrit.wikimedia.org/r/325117
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I09b306bd6f6ccf4210f36be0118e7f17f2c3d264
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits