jenkins-bot has submitted this change and it was merged.

Change subject: Degrade Special:OrphanedTimedText gracefully if 
!$wgEnableLocalTimedText
......................................................................


Degrade Special:OrphanedTimedText gracefully if !$wgEnableLocalTimedText

When I was making the special page originally, I didn't realize it
was an option to disable the TimedText namespace. In such a case it
doesn't really make sense to have this special page listed.

Change-Id: I23e8fe3a6bf794e78e910c068d50ef10863c2fa4
---
M SpecialOrphanedTimedText.php
M i18n/en.json
M i18n/qqq.json
3 files changed, 23 insertions(+), 4 deletions(-)

Approvals:
  Gilles: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/SpecialOrphanedTimedText.php b/SpecialOrphanedTimedText.php
index 1d3cdb4..52e86bf 100644
--- a/SpecialOrphanedTimedText.php
+++ b/SpecialOrphanedTimedText.php
@@ -44,7 +44,13 @@
         * @param $par String subpage
         */
        public function execute( $par ) {
-               if ( !$this->canExecute() ) {
+               global $wgEnableLocalTimedText;
+
+               if ( !$wgEnableLocalTimedText ) {
+                       $this->setHeaders();
+                       $this->getOutput()->addWikiMsg( 
'orphanedtimedtext-notimedtext' );
+                       return;
+               } elseif ( !$this->canExecuteQuery() ) {
                        $this->setHeaders();
                        $this->outputHeader();
                        $this->getOutput()->addWikiMsg( 
'orphanedtimedtext-unsupported' );
@@ -79,12 +85,23 @@
         *
         * @return bool
         */
-       private function canExecute() {
+       private function canExecuteQuery() {
                $dbr = wfGetDB( DB_SLAVE );
                return $dbr->getType() === 'mysql';
        }
 
        /**
+        * Can we execute this special page
+        *
+        * That is, db is mysql, and TimedText namespace enabled.
+        */
+       private function canExecute() {
+               global $wgEnableLocalTimedText;
+
+               return $this->canExecuteQuery() && $wgEnableLocalTimedText;
+       }
+
+       /**
         * Get query info
         *
         * The query here is meant to retrieve all pages in the TimedText 
namespace,
diff --git a/i18n/en.json b/i18n/en.json
index 74ff3f8..63bebfc 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -114,5 +114,6 @@
     "action-transcode-status": "view the current transcoding status",
     "orphanedtimedtext": "Orphaned TimedText pages",
     "orphanedtimedtext-summary": "List of 
[[{{#special:AllPages/TimedText:}}|{{ns:TimedText}}]] pages which do not have a 
corresponding file.",
-    "orphanedtimedtext-unsupported": "This special page is only supported on 
MySQL databases."
+    "orphanedtimedtext-unsupported": "This special page is only supported on 
MySQL databases.",
+    "orphanedtimedtext-notimedtext": "TimedText is not enabled on this wiki."
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 46ddde7..664b3cf 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -117,5 +117,6 @@
        "action-transcode-status": "{{doc-action|transcode-status}}",
        "orphanedtimedtext": "{{doc-special|OrphanedTimedText}}",
        "orphanedtimedtext-summary": "Summary of Special:OrphanedTimedText.",
-       "orphanedtimedtext-unsupported": "Shown if Special:OrphanedTimedText 
isn't supported for the current database back-end."
+       "orphanedtimedtext-unsupported": "Shown if Special:OrphanedTimedText 
isn't supported for the current database back-end.",
+       "orphanedtimedtext-notimedtext": "Shown on Special:OrphanedTimedText if 
the TimedText namespace is disabled on that wiki (i.e. $wgEnableLocalTimedText 
is set to false). Note, do not use <nowiki>{{ns:TimedText}}</nowiki> in this 
message."
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I23e8fe3a6bf794e78e910c068d50ef10863c2fa4
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <bawolff...@gmail.com>
Gerrit-Reviewer: Gilles <gdu...@wikimedia.org>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to