X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialRandomInCategory.php;h=adf12d40a650853d67cb3d26bf976e39b3d8aedf;hb=2b51bd1847cddc03fb05b69d353d0f5f9be381dc;hp=efb1748913a9731233d2080f5c5a7f7ac1ffda07;hpb=b5906606e1aa1a795231fb813b766818b1dd6c25;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialRandomInCategory.php b/includes/specials/SpecialRandomInCategory.php index efb1748913..adf12d40a6 100644 --- a/includes/specials/SpecialRandomInCategory.php +++ b/includes/specials/SpecialRandomInCategory.php @@ -47,10 +47,15 @@ * @ingroup SpecialPage */ class SpecialRandomInCategory extends FormSpecialPage { + /** @var string[] */ protected $extra = []; // Extra SQL statements + /** @var Title|false */ protected $category = false; // Title object of category + /** @var int */ protected $maxOffset = 30; // Max amount to fudge randomness by. + /** @var int|null */ private $maxTimestamp = null; + /** @var int|null */ private $minTimestamp = null; public function __construct( $name = 'RandomInCategory' ) { @@ -218,7 +223,7 @@ class SpecialRandomInCategory extends FormSpecialPage { ] ]; - $dbr = wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_REPLICA ); $minClTime = $this->getTimestampOffset( $rand ); if ( $minClTime ) { $qi['conds'][] = 'cl_timestamp ' . $op . ' ' . @@ -259,7 +264,7 @@ class SpecialRandomInCategory extends FormSpecialPage { * @throws MWException If category has no entries. */ protected function getMinAndMaxForCat( Title $category ) { - $dbr = wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_REPLICA ); $res = $dbr->selectRow( 'categorylinks', [ @@ -267,7 +272,7 @@ class SpecialRandomInCategory extends FormSpecialPage { 'high' => 'MAX( cl_timestamp )' ], [ - 'cl_to' => $this->category->getDBKey(), + 'cl_to' => $this->category->getDBkey(), ], __METHOD__, [ @@ -289,7 +294,7 @@ class SpecialRandomInCategory extends FormSpecialPage { * @return array Info for the title selected. */ private function selectRandomPageFromDB( $rand, $offset, $up, $fname = __METHOD__ ) { - $dbr = wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_REPLICA ); $query = $this->getQueryInfo( $rand, $offset, $up ); $res = $dbr->select(