Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/209216
Change subject: [WIP] Allow override of extension directory
......................................................................
[WIP] Allow override of extension directory
TODO: This patch doesn't work as the fallbacks for $wgStyleDirectory
and $wgExtensionDirectory are set in Setup.php by which point
LocalSettings.php has already run and failed to include extension.json
and skin.json files.
Bug: T98319
Change-Id: I41a8aec7a3e9c576ec7344abf51f8106248ade4b
---
M includes/DefaultSettings.php
M includes/GlobalFunctions.php
M includes/Setup.php
3 files changed, 22 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/16/209216/1
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 51e807c..e2b341d 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -222,6 +222,13 @@
/**
* Filesystem stylesheets directory.
+ * Defaults to "{$IP}/extensions".
+ * @since 1.25
+ */
+$wgExtensionDirectory = false;
+
+/**
+ * Filesystem stylesheets directory.
* Defaults to "{$IP}/skins".
* @since 1.3
*/
diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 23a8bbb..6eaeb25 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -170,13 +170,13 @@
* This queues an extension to be loaded through
* the ExtensionRegistry system.
*
- * @param string $name Name of the extension to load
+ * @param string $ext Name of the extension to load
* @param string|null $path Absolute path of where to find the extension.json
file
*/
-function wfLoadExtension( $name, $path = null ) {
+function wfLoadExtension( $ext, $path = null ) {
if ( !$path ) {
- global $IP;
- $path = "$IP/extensions/$name/extension.json";
+ global $wgExtensionDirectory;
+ $path = "$wgExtensionDirectory/$ext/extension.json";
}
ExtensionRegistry::getInstance()->queue( $path );
}
@@ -194,10 +194,10 @@
* @param string[] $exts Array of extension names to load
*/
function wfLoadExtensions( array $exts ) {
- global $IP;
+ global $wgExtensionDirectory;
$registry = ExtensionRegistry::getInstance();
foreach ( $exts as $ext ) {
- $registry->queue( "$IP/extensions/$ext/extension.json" );
+ $registry->queue( "$wgExtensionDirectory/$ext/extension.json" );
}
}
@@ -205,13 +205,13 @@
* Load a skin
*
* @see wfLoadExtension
- * @param string $name Name of the extension to load
+ * @param string $skin Name of the extension to load
* @param string|null $path Absolute path of where to find the skin.json file
*/
-function wfLoadSkin( $name, $path = null ) {
+function wfLoadSkin( $skin, $path = null ) {
if ( !$path ) {
- global $IP;
- $path = "$IP/skins/$name/skin.json";
+ global $wgStyleDirectory;
+ $path = "$wgStyleDirectory/$skin/skin.json";
}
ExtensionRegistry::getInstance()->queue( $path );
}
@@ -223,10 +223,10 @@
* @param string[] $skins Array of extension names to load
*/
function wfLoadSkins( array $skins ) {
- global $IP;
+ global $wgStyleDirectory;
$registry = ExtensionRegistry::getInstance();
foreach ( $skins as $skin ) {
- $registry->queue( "$IP/skins/$skin/skin.json" );
+ $registry->queue( "$wgStyleDirectory/$skin/skin.json" );
}
}
diff --git a/includes/Setup.php b/includes/Setup.php
index 9a91156..48bd10c 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -74,6 +74,9 @@
if ( $wgLocalStylePath === false ) {
$wgLocalStylePath = "$wgScriptPath/skins";
}
+if ( $wgExtensionDirectory === false ) {
+ $wgExtensionDirectory = "$IP/extensions";
+}
if ( $wgStyleDirectory === false ) {
$wgStyleDirectory = "$IP/skins";
}
--
To view, visit https://gerrit.wikimedia.org/r/209216
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I41a8aec7a3e9c576ec7344abf51f8106248ade4b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits