Brian Wolff has uploaded a new change for review. https://gerrit.wikimedia.org/r/149788
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(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler refs/changes/88/149788/1 diff --git a/SpecialOrphanedTimedText.php b/SpecialOrphanedTimedText.php index 1d3cdb4..3716e2e 100644 --- a/SpecialOrphanedTimedText.php +++ b/SpecialOrphanedTimedText.php @@ -44,10 +44,16 @@ * @param $par String subpage */ public function execute( $par ) { - if ( !$this->canExecute() ) { + global $wgEnableLocalTimedText; + + if ( !$this->canExecuteQuery() ) { $this->setHeaders(); $this->outputHeader(); $this->getOutput()->addWikiMsg( 'orphanedtimedtext-unsupported' ); + return; + } elseif ( !$wgEnableLocalTimedText ) { + $this->setHeaders(); + $this->getOutput()->addWikiMsg( 'orphanedtimedtext-notimedtext' ); return; } return parent::execute( $par ); @@ -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: newchange Gerrit-Change-Id: I23e8fe3a6bf794e78e910c068d50ef10863c2fa4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TimedMediaHandler Gerrit-Branch: master Gerrit-Owner: Brian Wolff <bawolff...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits