X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecialpage%2FQueryPage.php;h=6ed5e125f0894df62d0dd64dccca6c25a054b18f;hb=9a8a33bd0f18272ef8e865c96c89cc5785ff5c2c;hp=6cc6e4e94d1befb8f29c30d5500a4130c8535141;hpb=bc2a500b8ec36c32f7451c1f7021e12c4a1da005;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specialpage/QueryPage.php b/includes/specialpage/QueryPage.php index 6cc6e4e94d..6ed5e125f0 100644 --- a/includes/specialpage/QueryPage.php +++ b/includes/specialpage/QueryPage.php @@ -77,40 +77,40 @@ abstract class QueryPage extends SpecialPage { if ( $qp === null ) { // QueryPage subclass, Special page name $qp = [ - [ AncientPagesPage::class, 'Ancientpages' ], - [ BrokenRedirectsPage::class, 'BrokenRedirects' ], - [ DeadendPagesPage::class, 'Deadendpages' ], - [ DoubleRedirectsPage::class, 'DoubleRedirects' ], - [ FileDuplicateSearchPage::class, 'FileDuplicateSearch' ], - [ ListDuplicatedFilesPage::class, 'ListDuplicatedFiles' ], - [ LinkSearchPage::class, 'LinkSearch' ], - [ ListredirectsPage::class, 'Listredirects' ], - [ LonelyPagesPage::class, 'Lonelypages' ], - [ LongPagesPage::class, 'Longpages' ], - [ MediaStatisticsPage::class, 'MediaStatistics' ], - [ MIMEsearchPage::class, 'MIMEsearch' ], - [ MostcategoriesPage::class, 'Mostcategories' ], + [ SpecialAncientPages::class, 'Ancientpages' ], + [ SpecialBrokenRedirects::class, 'BrokenRedirects' ], + [ SpecialDeadendPages::class, 'Deadendpages' ], + [ SpecialDoubleRedirects::class, 'DoubleRedirects' ], + [ SpecialFileDuplicateSearch::class, 'FileDuplicateSearch' ], + [ SpecialListDuplicatedFiles::class, 'ListDuplicatedFiles' ], + [ SpecialLinkSearch::class, 'LinkSearch' ], + [ SpecialListRedirects::class, 'Listredirects' ], + [ SpecialLonelyPages::class, 'Lonelypages' ], + [ SpecialLongPages::class, 'Longpages' ], + [ SpecialMediaStatistics::class, 'MediaStatistics' ], + [ SpecialMIMESearch::class, 'MIMEsearch' ], + [ SpecialMostCategories::class, 'Mostcategories' ], [ MostimagesPage::class, 'Mostimages' ], - [ MostinterwikisPage::class, 'Mostinterwikis' ], - [ MostlinkedCategoriesPage::class, 'Mostlinkedcategories' ], - [ MostlinkedTemplatesPage::class, 'Mostlinkedtemplates' ], - [ MostlinkedPage::class, 'Mostlinked' ], - [ MostrevisionsPage::class, 'Mostrevisions' ], - [ FewestrevisionsPage::class, 'Fewestrevisions' ], - [ ShortPagesPage::class, 'Shortpages' ], - [ UncategorizedCategoriesPage::class, 'Uncategorizedcategories' ], - [ UncategorizedPagesPage::class, 'Uncategorizedpages' ], - [ UncategorizedImagesPage::class, 'Uncategorizedimages' ], - [ UncategorizedTemplatesPage::class, 'Uncategorizedtemplates' ], - [ UnusedCategoriesPage::class, 'Unusedcategories' ], - [ UnusedimagesPage::class, 'Unusedimages' ], - [ WantedCategoriesPage::class, 'Wantedcategories' ], + [ SpecialMostInterwikis::class, 'Mostinterwikis' ], + [ SpecialMostLinkedCategories::class, 'Mostlinkedcategories' ], + [ SpecialMostLinkedTemplates::class, 'Mostlinkedtemplates' ], + [ SpecialMostLinked::class, 'Mostlinked' ], + [ SpecialMostRevisions::class, 'Mostrevisions' ], + [ SpecialFewestRevisions::class, 'Fewestrevisions' ], + [ SpecialShortPages::class, 'Shortpages' ], + [ SpecialUncategorizedCategories::class, 'Uncategorizedcategories' ], + [ SpecialUncategorizedPages::class, 'Uncategorizedpages' ], + [ SpecialUncategorizedImages::class, 'Uncategorizedimages' ], + [ SpecialUncategorizedTemplates::class, 'Uncategorizedtemplates' ], + [ SpecialUnusedCategories::class, 'Unusedcategories' ], + [ SpecialUnusedImages::class, 'Unusedimages' ], + [ SpecialWantedCategories::class, 'Wantedcategories' ], [ WantedFilesPage::class, 'Wantedfiles' ], [ WantedPagesPage::class, 'Wantedpages' ], - [ WantedTemplatesPage::class, 'Wantedtemplates' ], - [ UnwatchedpagesPage::class, 'Unwatchedpages' ], - [ UnusedtemplatesPage::class, 'Unusedtemplates' ], - [ WithoutInterwikiPage::class, 'Withoutinterwiki' ], + [ SpecialWantedTemplates::class, 'Wantedtemplates' ], + [ SpecialUnwatchedPages::class, 'Unwatchedpages' ], + [ SpecialUnusedTemplates::class, 'Unusedtemplates' ], + [ SpecialWithoutInterwiki::class, 'Withoutinterwiki' ], ]; Hooks::run( 'wgQueryPages', [ &$qp ] ); } @@ -118,6 +118,30 @@ abstract class QueryPage extends SpecialPage { return $qp; } + /** + * Get a list of query pages disabled and with it's run mode + * @param Config $config + * @return string[] + */ + public static function getDisabledQueryPages( Config $config ) { + $disableQueryPageUpdate = $config->get( 'DisableQueryPageUpdate' ); + + if ( !is_array( $disableQueryPageUpdate ) ) { + return []; + } + + $pages = []; + foreach ( $disableQueryPageUpdate as $name => $runMode ) { + if ( is_int( $name ) ) { + // The run mode may be omitted + $pages[$runMode] = 'disabled'; + } else { + $pages[$name] = $runMode; + } + } + return $pages; + } + /** * A mutator for $this->listoutput; * @@ -632,13 +656,21 @@ abstract class QueryPage extends SpecialPage { # If updates on this page have been disabled, let the user know # that the data set won't be refreshed for now - if ( is_array( $this->getConfig()->get( 'DisableQueryPageUpdate' ) ) - && in_array( $this->getName(), $this->getConfig()->get( 'DisableQueryPageUpdate' ) ) - ) { - $out->wrapWikiMsg( - "
\n$1\n
", - 'querypage-no-updates' - ); + $disabledQueryPages = self::getDisabledQueryPages( $this->getConfig() ); + if ( isset( $disabledQueryPages[$this->getName()] ) ) { + $runMode = $disabledQueryPages[$this->getName()]; + if ( $runMode === 'disabled' ) { + $out->wrapWikiMsg( + "
\n$1\n
", + 'querypage-no-updates' + ); + } else { + // Messages used here: querypage-updates-periodical + $out->wrapWikiMsg( + "
\n$1\n
", + 'querypage-updates-' . $runMode + ); + } } } }