Brion VIBBER has uploaded a new change for review.

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

Change subject: Work around failure on fetching remote timedtext when no local
......................................................................

Work around failure on fetching remote timedtext when no local

Was trying to use NS_TIMEDTEXT constant when there was no
local timedtext ns. Instead, use the default.

Change-Id: I25bf256f0cbcbf16ac533a9ba1b527530c109bd2
---
M handlers/TextHandler/TextHandler.php
1 file changed, 12 insertions(+), 2 deletions(-)


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

diff --git a/handlers/TextHandler/TextHandler.php 
b/handlers/TextHandler/TextHandler.php
index 3eb284e..9edeeda 100644
--- a/handlers/TextHandler/TextHandler.php
+++ b/handlers/TextHandler/TextHandler.php
@@ -54,7 +54,11 @@
                                return $wgTimedTextForeignNamespaces[ $wikiID ];
                        }
                        // failed to get namespace via ForeignDBViaLBRepo, 
return NS_TIMEDTEXT
-                       return NS_TIMEDTEXT;
+                       if ( $wgEnableLocalTimedText ) {
+                               return NS_TIMEDTEXT;
+                       } else {
+                               return false;
+                       }
                } else {
                        if ( $this->remoteNs !== null ) {
                                return $this->remoteNs;
@@ -289,11 +293,17 @@
        }
 
        function getForeignNamespaceName() {
+               global $wgEnableLocalTimedText;
                if ( $this->remoteNs !== null ) {
                        return $this->remoteNsName;
                }
                /* Else, we use the canonical namespace, since we can't look up 
the actual one */
-               return strtr( MWNamespace::getCanonicalName( NS_TIMEDTEXT ), ' 
', '_' );
+               if ( $wgEnableLocalTimedText ) {
+                       return strtr( MWNamespace::getCanonicalName( 
NS_TIMEDTEXT ), ' ', '_' );
+               } else {
+                       // Assume default.
+                       return 'TimedText';
+               }
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I25bf256f0cbcbf16ac533a9ba1b527530c109bd2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <br...@wikimedia.org>

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

Reply via email to