make sure revision uids are 0 in the xml if missing/0 in the db
[lhc/web/wiklou.git] / maintenance / populateCategory.php
index 5a8ef90..ce1506c 100644 (file)
@@ -71,7 +71,7 @@ TEXT
        public function execute() {
                $begin = $this->getOption( 'begin', '' );
                $throttle = $this->getOption( 'throttle', 0 );
-               $force = $this->getOption( 'force', false );
+               $force = $this->hasOption( 'force' );
 
                $dbw = $this->getDB( DB_MASTER );
 
@@ -79,7 +79,7 @@ TEXT
                        $row = $dbw->selectRow(
                                'updatelog',
                                '1',
-                               array( 'ul_key' => 'populate category' ),
+                               [ 'ul_key' => 'populate category' ],
                                __METHOD__
                        );
                        if ( $row ) {
@@ -93,9 +93,9 @@ TEXT
 
                $throttle = intval( $throttle );
                if ( $begin !== '' ) {
-                       $where = 'cl_to > ' . $dbw->addQuotes( $begin );
+                       $where = [ 'cl_to > ' . $dbw->addQuotes( $begin ) ];
                } else {
-                       $where = null;
+                       $where = [ '1 = 1' ];
                }
                $i = 0;
 
@@ -106,9 +106,9 @@ TEXT
                                'cl_to',
                                $where,
                                __METHOD__,
-                               array(
+                               [
                                        'ORDER BY' => 'cl_to'
-                               )
+                               ]
                        );
                        if ( !$row ) {
                                # Done, hopefully.
@@ -133,22 +133,16 @@ TEXT
                        usleep( $throttle * 1000 );
                }
 
-               if ( $dbw->insert(
+               $dbw->insert(
                        'updatelog',
-                       array( 'ul_key' => 'populate category' ),
+                       [ 'ul_key' => 'populate category' ],
                        __METHOD__,
                        'IGNORE'
-               ) ) {
-                       $this->output( "Category population complete.\n" );
-
-                       return true;
-               } else {
-                       $this->output( "Could not insert category population row.\n" );
+               );
 
-                       return false;
-               }
+               return true;
        }
 }
 
-$maintClass = "PopulateCategory";
+$maintClass = PopulateCategory::class;
 require_once RUN_MAINTENANCE_IF_MAIN;