Linker: Don't use Title::setFragment()
[lhc/web/wiklou.git] / includes / CategoryFinder.php
index 3f0528e..89bf5c7 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use Wikimedia\Rdbms\IDatabase;
+
 /**
  * The "CategoryFinder" class takes a list of articles, creates an internal
  * representation of all their parent categories (as well as parents of
  *
  *     $cf = new CategoryFinder;
  *     $cf->seed(
- *         array( 12345 ),
- *         array( 'Category 1', 'Category 2' ),
+ *         [ 12345 ],
+ *         [ 'Category 1', 'Category 2' ],
  *         'AND'
  *     );
  *     $a = $cf->run();
  *     print implode( ',' , $a );
  * @endcode
- *
  */
 class CategoryFinder {
        /** @var int[] The original article IDs passed to the seed function */
@@ -49,7 +50,7 @@ class CategoryFinder {
        /** @var array Array of DBKEY category names for categories that don't have a page */
        protected $deadend = [];
 
-       /** @var array Array of [ID => array()] */
+       /** @var array Array of [ ID => [] ] */
        protected $parents = [];
 
        /** @var array Array of article/category IDs */
@@ -64,7 +65,7 @@ class CategoryFinder {
        /** @var string "AND" or "OR" */
        protected $mode;
 
-       /** @var IDatabase Read-DB slave */
+       /** @var IDatabase Read-DB replica DB */
        protected $dbr;
 
        /**
@@ -96,7 +97,7 @@ class CategoryFinder {
         * @return array Array of page_ids (those given to seed() that match the conditions)
         */
        public function run() {
-               $this->dbr = wfGetDB( DB_SLAVE );
+               $this->dbr = wfGetDB( DB_REPLICA );
                while ( count( $this->next ) > 0 ) {
                        $this->scanNextLayer();
                }
@@ -185,7 +186,6 @@ class CategoryFinder {
         * Scans a "parent layer" of the articles/categories in $this->next
         */
        private function scanNextLayer() {
-
                # Find all parents of the article currently in $this->next
                $layer = [];
                $res = $this->dbr->select(