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;
$delTypes = [ 'delete', 'suppress' ]; // revisiondelete types
while ( $blockEnd <= $end ) {
$this->output( "...doing log_id from $blockStart to $blockEnd\n" );
- $cond = "log_id BETWEEN $blockStart AND $blockEnd";
+ $cond = "log_id BETWEEN " . (int)$blockStart . " AND " . (int)$blockEnd;
$res = $db->select(
'logging', [ 'log_id', 'log_type', 'log_action', 'log_params' ], $cond, __FUNCTION__
);
}
}
-$maintClass = "PopulateLogSearch";
+$maintClass = PopulateLogSearch::class;
require_once RUN_MAINTENANCE_IF_MAIN;