Move IDatabase/IMaintainableDatabase to Rdbms namespace
[lhc/web/wiklou.git] / includes / specialpage / WantedQueryPage.php
index 9d92cbd..d788f2b 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\IDatabase;
 
 /**
  * Class definition for a wanted query page like
@@ -119,4 +120,37 @@ abstract class WantedQueryPage extends QueryPage {
                $label = $this->msg( 'nlinks' )->numParams( $result->value )->escaped();
                return Linker::link( $wlh, $label );
        }
+
+       /**
+        * Order by title for pages with the same number of links to them
+        *
+        * @return array
+        * @since 1.29
+        */
+       function getOrderFields() {
+               return [ 'value DESC', 'namespace', 'title' ];
+       }
+
+       /**
+        * Do not order descending for all order fields.  We will use DESC only on one field, see
+        * getOrderFields above. This overwrites sortDescending from QueryPage::getOrderFields().
+        * Do NOT change this to true unless you remove the phrase DESC in getOrderFiels above.
+        * If you do a database error will be thrown due to double adding DESC to query!
+        *
+        * @return bool
+        * @since 1.29
+        */
+       function sortDescending() {
+               return false;
+       }
+
+       /**
+        * Also use the order fields returned by getOrderFields when fetching from the cache.
+        * @return array
+        * @since 1.29
+        */
+       function getCacheOrderFields() {
+               return $this->getOrderFields();
+       }
+
 }