jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/325080 )
Change subject: registration: Provide credits information to callbacks
......................................................................
registration: Provide credits information to callbacks
Registration callbacks now provide basic credits information (name,
path, type, authors, license-name, version, etc.) as the first argument.
The main use case right now for this is to support extension VERSION
constants for backwards-compatibility.
In addition, callbacks now run *after* attributes are exposed, so
callbacks could use data from them if they wanted to.
Bug: T151136
Change-Id: Ic5965dd4e259e1f46222ac92b8e78750e67b51d6
(cherry picked from commit b54acaf847131fdac9352aa35e4b82327751a3de)
---
M includes/registration/ExtensionProcessor.php
M includes/registration/ExtensionRegistry.php
2 files changed, 11 insertions(+), 6 deletions(-)
Approvals:
Chad: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/registration/ExtensionProcessor.php
b/includes/registration/ExtensionProcessor.php
index 8600851..8b942aa 100644
--- a/includes/registration/ExtensionProcessor.php
+++ b/includes/registration/ExtensionProcessor.php
@@ -138,6 +138,7 @@
/**
* Things to be called once registration of these extensions are done
+ * keyed by the name of the extension that it belongs to
*
* @var callable[]
*/
@@ -172,11 +173,11 @@
$this->extractResourceLoaderModules( $dir, $info );
$this->extractServiceWiringFiles( $dir, $info );
$this->extractParserTestFiles( $dir, $info );
+ $name = $this->extractCredits( $path, $info );
if ( isset( $info['callback'] ) ) {
- $this->callbacks[] = $info['callback'];
+ $this->callbacks[$name] = $info['callback'];
}
- $this->extractCredits( $path, $info );
foreach ( $info as $key => $val ) {
if ( in_array( $key, self::$globalSettings ) ) {
$this->storeToArray( $path, "wg$key", $val,
$this->globals );
@@ -327,6 +328,7 @@
/**
* @param string $path
* @param array $info
+ * @return string Name of thing
* @throws Exception
*/
protected function extractCredits( $path, array $info ) {
@@ -352,6 +354,8 @@
$this->credits[$name] = $credits;
$this->globals['wgExtensionCredits'][$credits['type']][] =
$credits;
+
+ return $name;
}
/**
diff --git a/includes/registration/ExtensionRegistry.php
b/includes/registration/ExtensionRegistry.php
index 5da4be3..c795c23 100644
--- a/includes/registration/ExtensionRegistry.php
+++ b/includes/registration/ExtensionRegistry.php
@@ -31,7 +31,7 @@
/**
* Bump whenever the registration cache needs resetting
*/
- const CACHE_VERSION = 3;
+ const CACHE_VERSION = 4;
/**
* Special key that defines the merge strategy
@@ -281,9 +281,6 @@
foreach ( $info['autoloaderPaths'] as $path ) {
require_once $path;
}
- foreach ( $info['callbacks'] as $cb ) {
- call_user_func( $cb );
- }
$this->loaded += $info['credits'];
if ( $info['attributes'] ) {
@@ -293,6 +290,10 @@
$this->attributes = array_merge_recursive(
$this->attributes, $info['attributes'] );
}
}
+
+ foreach ( $info['callbacks'] as $name => $cb ) {
+ call_user_func( $cb, $info['credits'][$name] );
+ }
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/325080
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic5965dd4e259e1f46222ac92b8e78750e67b51d6
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_28
Gerrit-Owner: Paladox <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Mwjames <[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