Merge "FauxRequest: don’t override getValues()"
[lhc/web/wiklou.git] / maintenance / populateLogSearch.php
index 979a28a..bb48151 100644 (file)
@@ -60,13 +60,26 @@ class PopulateLogSearch extends LoggedUpdateMaintenance {
 
                        return false;
                }
-               $start = $db->selectField( 'logging', 'MIN(log_id)', false, __FUNCTION__ );
+               $start = $db->selectField( 'logging', 'MIN(log_id)', '', __FUNCTION__ );
                if ( !$start ) {
                        $this->output( "Nothing to do.\n" );
 
                        return true;
                }
-               $end = $db->selectField( 'logging', 'MAX(log_id)', false, __FUNCTION__ );
+               $end = $db->selectField( 'logging', 'MAX(log_id)', '', __FUNCTION__ );
+
+               // This maintenance script is for updating pre-1.16 to 1.16. The target_author_id and
+               // target_author_ip relations it adds will later be migrated to target_author_actor by
+               // migrateActors.php. If the schema is already 1.34, we should have nothing to do.
+               if ( !$db->fieldExists( 'logging', 'log_user' ) ) {
+                       $this->output(
+                               "This does not appear to be an upgrade from MediaWiki pre-1.16 "
+                               . "(logging.log_user does not exist).\n"
+                       );
+                       $this->output( "Nothing to do.\n" );
+
+                       return true;
+               }
 
                # Do remaining chunk
                $end += $batchSize - 1;
@@ -169,5 +182,5 @@ class PopulateLogSearch extends LoggedUpdateMaintenance {
        }
 }
 
-$maintClass = "PopulateLogSearch";
+$maintClass = PopulateLogSearch::class;
 require_once RUN_MAINTENANCE_IF_MAIN;