Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/200755

Change subject: registration: Have wfLoadExtension() (and similar) use the queue
......................................................................

registration: Have wfLoadExtension() (and similar) use the queue

Right now wfLoadExtension() and related functions explicitly load
extensions immediately, bypassing the queue. This was done to be
extremely backwards-compatible with the old require_once style of
loading which does the same.

However, for a future configuration database to work, we need to be able
to reliably load extensions after configuration (LocalSettings.php) is
loaded, which is currently at the top of Setup.php. Rather than doing
this later, we should do this now to make sure the registration system
will be able to handle it.

In Wikimedia production, excentions are currently being loaded with
direct calls to:
  ExtensionRegistry::getInstance()->queue(...);
so we know that this should work.

That is not a nice API for sysadmins and developers to be entering into
LocalSettings.php.

If for some reason an extension really needs to be loaded immediately,
they can still call:
  ExtensionRegistry::getInstance()->loadFromQueue();
But that should be the exception, not the norm.

Change-Id: I72672e5c9541ede02d09f548c39ef6c8df0ec78a
---
M includes/GlobalFunctions.php
1 file changed, 4 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/55/200755/1

diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index a9ed60f..bc3a46b 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -166,12 +166,8 @@
 /**
  * Load an extension
  *
- * This is the closest equivalent to:
- *   require_once "$IP/extensions/$name/$name.php";
- * as it will process and load the extension immediately.
- *
- * However, batch loading with wfLoadExtensions will
- * be more performant.
+ * This queues an extension to be loaded through
+ * the ExtensionRegistry system.
  *
  * @param string $name Name of the extension to load
  * @param string|null $path Absolute path of where to find the extension.json 
file
@@ -181,7 +177,7 @@
                global $IP;
                $path = "$IP/extensions/$name/extension.json";
        }
-       ExtensionRegistry::getInstance()->load( $path );
+       ExtensionRegistry::getInstance()->queue( $path );
 }
 
 /**
@@ -202,8 +198,6 @@
        foreach ( $exts as $ext ) {
                $registry->queue( "$IP/extensions/$ext/extension.json" );
        }
-
-       $registry->loadFromQueue();
 }
 
 /**
@@ -218,7 +212,7 @@
                global $IP;
                $path = "$IP/skins/$name/skin.json";
        }
-       ExtensionRegistry::getInstance()->load( $path );
+       ExtensionRegistry::getInstance()->queue( $path );
 }
 
 /**
@@ -233,8 +227,6 @@
        foreach ( $skins as $skin ) {
                $registry->queue( "$IP/skins/$skin/skin.json" );
        }
-
-       $registry->loadFromQueue();
 }
 
 /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I72672e5c9541ede02d09f548c39ef6c8df0ec78a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

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

Reply via email to