<?php
/**
- * Makes the required database updates for Special:ProtectedPages
- * to show all protected pages, even ones before the page restrictions
- * schema change. All remaining page_restriction column values are moved
- * to the new table.
+ * Makes the required database updates for log display in Special:RevisionDelete
*
* Run via update.php or directly through populateLogSearch.php
*
* @ingroup Maintenance
*/
-define( 'LOG_SEARCH_BATCH_SIZE', 100 );
+define( 'LOG_SEARCH_BATCH_SIZE', 300 );
function migrate_log_params( $db ) {
$start = $db->selectField( 'logging', 'MIN(log_id)', false, __FUNCTION__ );
if( !$start ) {
- die("Nothing to do.\n");
+ echo "Nothing to do.\n";
+ return true;
}
$end = $db->selectField( 'logging', 'MAX(log_id)', false, __FUNCTION__ );
$blockEnd = $start + LOG_SEARCH_BATCH_SIZE - 1;
while( $blockEnd <= $end ) {
echo "...doing log_id from $blockStart to $blockEnd\n";
- $cond = "log_id BETWEEN $blockStart AND $blockEnd";
+ $cond = array("log_id BETWEEN $blockStart AND $blockEnd");
+ # Applicable log types
+ $cond['log_type'] = array('delete','suppress');
$res = $db->select( 'logging', '*', $cond, __FUNCTION__ );
$batch = array();
while( $row = $db->fetchObject( $res ) ) {
$field = RevisionDeleter::getRelationType($params[0]);
}
if( $field == null ) {
- echo "Invalid param type for $row->log_id";
+ echo "Invalid param type for $row->log_id\n";
continue; // skip this row
}
$items = explode(',',$params[1]);
}
}
}
- $blockStart += LOG_SEARCH_BATCH_SIZE - 1;
- $blockEnd += LOG_SEARCH_BATCH_SIZE - 1;
+ $blockStart += LOG_SEARCH_BATCH_SIZE;
+ $blockEnd += LOG_SEARCH_BATCH_SIZE;
wfWaitForSlaves( 5 );
}
if( $db->insert(