X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecialpage%2FQueryPage.php;h=b7eb3c0764a1407425b6f0bcaa6611324e1f34c2;hp=700672f12fa05b8ceab3041d0244998b0cff279f;hb=dd71a77512db0b0e9a75724d34ee6878d806b8e9;hpb=a3b4288eacd34869b13f59782b73c9ddb75e3523 diff --git a/includes/specialpage/QueryPage.php b/includes/specialpage/QueryPage.php index 700672f12f..b7eb3c0764 100644 --- a/includes/specialpage/QueryPage.php +++ b/includes/specialpage/QueryPage.php @@ -21,6 +21,7 @@ * @ingroup SpecialPage */ +use MediaWiki\Linker\LinkTarget; use MediaWiki\MediaWikiServices; use Wikimedia\Rdbms\IResultWrapper; use Wikimedia\Rdbms\IDatabase; @@ -76,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 ] ); } @@ -312,7 +313,7 @@ abstract class QueryPage extends SpecialPage { $num = $res->numRows(); # Fetch results $vals = []; - foreach ( $res as $row ) { + foreach ( $res as $i => $row ) { if ( isset( $row->value ) ) { if ( $this->usesTimestamps() ) { $value = wfTimestamp( TS_UNIX, @@ -321,7 +322,7 @@ abstract class QueryPage extends SpecialPage { $value = intval( $row->value ); // T16414 } } else { - $value = 0; + $value = $i; } $vals[] = [ @@ -375,6 +376,23 @@ abstract class QueryPage extends SpecialPage { return wfGetDB( DB_REPLICA, [ $this->getName(), 'QueryPage::recache', 'vslow' ] ); } + /** + * Remove a cached result. + * Useful for interactive backlogs where the user can fix problems in-place. + * @param LinkTarget $title The page to remove. + * @since 1.34 + */ + public function delete( LinkTarget $title ) { + if ( $this->isCached() ) { + $dbw = wfGetDB( DB_MASTER ); + $dbw->delete( 'querycache', [ + 'qc_type' => $this->getName(), + 'qc_namespace' => $title->getNamespace(), + 'qc_title' => $title->getDBkey(), + ], __METHOD__ ); + } + } + /** * Run the query and return the result * @param int|bool $limit Numerical limit or false for no limit @@ -660,7 +678,7 @@ abstract class QueryPage extends SpecialPage { # an OutputPage, and let them get on with it $this->outputResults( $out, $this->getSkin(), - $dbr, # Should use a ResultWrapper for this + $dbr, # Should use IResultWrapper for this $res, min( $this->numRows, $this->limit ), # do not format the one extra row, if exist $this->offset ); @@ -738,13 +756,13 @@ abstract class QueryPage extends SpecialPage { } /** - * Creates a new LinkBatch object, adds all pages from the passed ResultWrapper (MUST include + * Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include * title and optional the namespace field) and executes the batch. This operation will pre-cache * LinkCache information like page existence and information for stub color and redirect hints. * - * @param IResultWrapper $res The ResultWrapper object to process. Needs to include the title + * @param IResultWrapper $res The result wrapper to process. Needs to include the title * field and namespace field, if the $ns parameter isn't set. - * @param null $ns Use this namespace for the given titles in the ResultWrapper object, + * @param null $ns Use this namespace for the given titles in the result wrapper, * instead of the namespace value of $res. */ protected function executeLBFromResultWrapper( IResultWrapper $res, $ns = null ) {