Merge "mw.Feedback: If the message is posted remotely, link the title correctly"
[lhc/web/wiklou.git] / maintenance / populateBacklinkNamespace.php
index 901cdaa..23144e9 100644 (file)
@@ -59,39 +59,40 @@ class PopulateBacklinkNamespace extends LoggedUpdateMaintenance {
                        return false;
                }
                $end = $db->selectField( 'page', 'MAX(page_id)', false, __METHOD__ );
+               $batchSize = $this->getBatchSize();
 
                # Do remaining chunk
-               $end += $this->mBatchSize - 1;
+               $end += $batchSize - 1;
                $blockStart = $start;
-               $blockEnd = $start + $this->mBatchSize - 1;
+               $blockEnd = $start + $batchSize - 1;
                while ( $blockEnd <= $end ) {
                        $this->output( "...doing page_id from $blockStart to $blockEnd\n" );
-                       $cond = "page_id BETWEEN $blockStart AND $blockEnd";
-                       $res = $db->select( 'page', array( 'page_id', 'page_namespace' ), $cond, __METHOD__ );
+                       $cond = "page_id BETWEEN " . (int)$blockStart . " AND " . (int)$blockEnd;
+                       $res = $db->select( 'page', [ 'page_id', 'page_namespace' ], $cond, __METHOD__ );
                        foreach ( $res as $row ) {
                                $db->update( 'pagelinks',
-                                       array( 'pl_from_namespace' => $row->page_namespace ),
-                                       array( 'pl_from' => $row->page_id ),
+                                       [ 'pl_from_namespace' => $row->page_namespace ],
+                                       [ 'pl_from' => $row->page_id ],
                                        __METHOD__
                                );
                                $db->update( 'templatelinks',
-                                       array( 'tl_from_namespace' => $row->page_namespace ),
-                                       array( 'tl_from' => $row->page_id ),
+                                       [ 'tl_from_namespace' => $row->page_namespace ],
+                                       [ 'tl_from' => $row->page_id ],
                                        __METHOD__
                                );
                                $db->update( 'imagelinks',
-                                       array( 'il_from_namespace' => $row->page_namespace ),
-                                       array( 'il_from' => $row->page_id ),
+                                       [ 'il_from_namespace' => $row->page_namespace ],
+                                       [ 'il_from' => $row->page_id ],
                                        __METHOD__
                                );
                        }
-                       $blockStart += $this->mBatchSize - 1;
-                       $blockEnd += $this->mBatchSize - 1;
+                       $blockStart += $batchSize - 1;
+                       $blockEnd += $batchSize - 1;
                        wfWaitForSlaves();
                }
                return true;
        }
 }
 
-$maintClass = "PopulateBacklinkNamespace";
+$maintClass = PopulateBacklinkNamespace::class;
 require_once RUN_MAINTENANCE_IF_MAIN;