X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FpopulateLogSearch.php;h=bb4815168125453798a66f9f0af09d6ebbdab09a;hb=f8249ea4e2b9009e3bd229d8c0710590b9d1d04d;hp=113cc6395023a4e08f179dc80147a90e045e898f;hpb=0cf636a075b1716916979cc6c3bfead9ef960e01;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateLogSearch.php b/maintenance/populateLogSearch.php index 113cc63950..bb48151681 100644 --- a/maintenance/populateLogSearch.php +++ b/maintenance/populateLogSearch.php @@ -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; @@ -76,7 +89,7 @@ class PopulateLogSearch extends LoggedUpdateMaintenance { $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__ ); @@ -169,5 +182,5 @@ class PopulateLogSearch extends LoggedUpdateMaintenance { } } -$maintClass = "PopulateLogSearch"; +$maintClass = PopulateLogSearch::class; require_once RUN_MAINTENANCE_IF_MAIN;