Update the change_tag table in rebuildrecentchanges.php
[lhc/web/wiklou.git] / maintenance / fetchText.php
index cf12838..bc4fa31 100644 (file)
@@ -24,6 +24,8 @@
 
 require_once __DIR__ . '/Maintenance.php';
 
+use Wikimedia\Rdbms\IDatabase;
+
 /**
  * Maintenance script used to fetch page text in a subprocess.
  *
@@ -32,9 +34,10 @@ require_once __DIR__ . '/Maintenance.php';
 class FetchText extends Maintenance {
        public function __construct() {
                parent::__construct();
-               $this->mDescription = "Fetch the raw revision blob from an old_id.\n" .
+               $this->addDescription( "Fetch the raw revision blob from an old_id.\n" .
                        "NOTE: Export transformations are NOT applied. " .
-                       "This is left to backupTextPass.php";
+                       "This is left to backupTextPass.php"
+               );
        }
 
        /**
@@ -48,7 +51,7 @@ class FetchText extends Maintenance {
         * note that the text string itself is *not* followed by newline
         */
        public function execute() {
-               $db = $this->getDB( DB_SLAVE );
+               $db = $this->getDB( DB_REPLICA );
                $stdin = $this->getStdin();
                while ( !feof( $stdin ) ) {
                        $line = fgets( $stdin );
@@ -70,15 +73,15 @@ class FetchText extends Maintenance {
 
        /**
         * May throw a database error if, say, the server dies during query.
-        * @param DatabaseBase $db
+        * @param IDatabase $db
         * @param int $id The old_id
         * @return string
         */
        private function doGetText( $db, $id ) {
                $id = intval( $id );
                $row = $db->selectRow( 'text',
-                       array( 'old_text', 'old_flags' ),
-                       array( 'old_id' => $id ),
+                       [ 'old_text', 'old_flags' ],
+                       [ 'old_id' => $id ],
                        __METHOD__ );
                $text = Revision::getRevisionText( $row );
                if ( $text === false ) {
@@ -89,5 +92,5 @@ class FetchText extends Maintenance {
        }
 }
 
-$maintClass = "FetchText";
+$maintClass = FetchText::class;
 require_once RUN_MAINTENANCE_IF_MAIN;