TheDJ has uploaded a new change for review.

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

Change subject: Use CanonicalNamespaces hook instead of SetupAfterCache
......................................................................

Use CanonicalNamespaces hook instead of SetupAfterCache

This seems to be the proper way to do this, so I'm assuming that this
will also work for bug T123695 and T90282

Bug: T90282
Change-Id: If79246653b0c11f9562bf7c40b31f17cfee2689d
---
M TimedMediaHandler.hooks.php
M TimedMediaHandler.php
2 files changed, 8 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/27/270127/1

diff --git a/TimedMediaHandler.hooks.php b/TimedMediaHandler.hooks.php
index 42844ef..b487884 100644
--- a/TimedMediaHandler.hooks.php
+++ b/TimedMediaHandler.hooks.php
@@ -12,14 +12,16 @@
        // Register TimedMediaHandler namespace IDs
        // These are configurable due to Commons history: T123823
        // These need to be before registerhooks due to: T123695
-       public static function onSetupAfterCache() {
+       public static function addCanonicalNamespaces(array &$list) {
                global $wgEnableLocalTimedText, $wgExtraNamespaces, 
$wgTimedTextNS;
                if ( $wgEnableLocalTimedText ) {
-                       define( "NS_TIMEDTEXT", $wgTimedTextNS );
-                       define( "NS_TIMEDTEXT_TALK", $wgTimedTextNS +1 );
+                       if ( !defined( 'NS_TIMEDTEXT' ) ) {
+                               define( 'NS_TIMEDTEXT', $wgTimedTextNS );
+                               define( 'NS_TIMEDTEXT_TALK', $wgTimedTextNS +1 
);
+                       }
 
-                       $wgExtraNamespaces[NS_TIMEDTEXT] = "TimedText";
-                       $wgExtraNamespaces[NS_TIMEDTEXT_TALK] = 
"TimedText_talk";
+                       $list[NS_TIMEDTEXT] = 'TimedText';
+                       $list[NS_TIMEDTEXT_TALK] = 'TimedText_talk';
                } else {
                        $wgTimedTextNS = false;
                }
diff --git a/TimedMediaHandler.php b/TimedMediaHandler.php
index c4cf14d..c278541 100644
--- a/TimedMediaHandler.php
+++ b/TimedMediaHandler.php
@@ -307,7 +307,7 @@
 // This way if you set a variable like $wgTimedTextNS in LocalSettings.php
 // after you include TimedMediaHandler we can still read the variable values
 // See also T123695 and T123823
-$wgHooks['SetupAfterCache'][] = 'TimedMediaHandlerHooks::onSetupAfterCache';
+$wgHooks['CanonicalNamespaces'][] = 
'TimedMediaHandlerHooks::addCanonicalNamespaces';
 
 // Register remaining Timed Media Handler hooks right after initial setup
 $wgExtensionFunctions[] = 'TimedMediaHandlerHooks::register';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If79246653b0c11f9562bf7c40b31f17cfee2689d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: TheDJ <hartman.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to