Automatically deduplicate root jobs on insertion
[lhc/web/wiklou.git] / includes / specialpage / QueryPage.php
index f902acf..92409cd 100644 (file)
@@ -81,7 +81,7 @@ abstract class QueryPage extends SpecialPage {
                                array( 'MostimagesPage', 'Mostimages' ),
                                array( 'MostinterwikisPage', 'Mostinterwikis' ),
                                array( 'MostlinkedCategoriesPage', 'Mostlinkedcategories' ),
-                               array( 'MostlinkedtemplatesPage', 'Mostlinkedtemplates' ),
+                               array( 'MostlinkedTemplatesPage', 'Mostlinkedtemplates' ),
                                array( 'MostlinkedPage', 'Mostlinked' ),
                                array( 'MostrevisionsPage', 'Mostrevisions' ),
                                array( 'FewestrevisionsPage', 'Fewestrevisions' ),
@@ -96,11 +96,11 @@ abstract class QueryPage extends SpecialPage {
                                array( 'WantedFilesPage', 'Wantedfiles' ),
                                array( 'WantedPagesPage', 'Wantedpages' ),
                                array( 'WantedTemplatesPage', 'Wantedtemplates' ),
-                               array( 'UnwatchedPagesPage', 'Unwatchedpages' ),
+                               array( 'UnwatchedpagesPage', 'Unwatchedpages' ),
                                array( 'UnusedtemplatesPage', 'Unusedtemplates' ),
                                array( 'WithoutInterwikiPage', 'Withoutinterwiki' ),
                        );
-                       wfRunHooks( 'wgQueryPages', array( &$qp ) );
+                       Hooks::run( 'wgQueryPages', array( &$qp ) );
                }
 
                return $qp;
@@ -252,6 +252,17 @@ abstract class QueryPage extends SpecialPage {
                return '';
        }
 
+       /**
+        * Outputs some kind of an informative message (via OutputPage) to let the
+        * user know that the query returned nothing and thus there's nothing to
+        * show.
+        *
+        * @since 1.26
+        */
+       protected function showEmptyText() {
+               $this->getOutput()->addWikiMsg( 'specialpage-empty' );
+       }
+
        /**
         * If using extra form wheely-dealies, return a set of parameters here
         * as an associative array. They will be encoded and added to the paging
@@ -527,7 +538,7 @@ abstract class QueryPage extends SpecialPage {
 
                $this->numRows = $res->numRows();
 
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = $this->getRecacheDB();
                $this->preprocessResults( $dbr, $res );
 
                $out->addHTML( Xml::openElement( 'div', array( 'class' => 'mw-spcontent' ) ) );
@@ -546,7 +557,7 @@ abstract class QueryPage extends SpecialPage {
                        } else {
                                # No results to show, so don't bother with "showing X of Y" etc.
                                # -- just let the user know and give up now
-                               $out->addWikiMsg( 'specialpage-empty' );
+                               $this->showEmptyText();
                                $out->addHTML( Xml::closeElement( 'div' ) );
                                return;
                        }