do {
$res = $dbw->select(
'text',
- array( 'old_id', 'old_flags', 'old_text' ),
+ [ 'old_id', 'old_flags', 'old_text' ],
"old_id>=$start",
__METHOD__,
- array( 'ORDER BY' => 'old_id', 'LIMIT' => $chunksize, 'FOR UPDATE' )
+ [ 'ORDER BY' => 'old_id', 'LIMIT' => $chunksize, 'FOR UPDATE' ]
);
if ( $res->numRows() == 0 ) {
# Update text row
$dbw->update( 'text',
- array( /* SET */
+ [ /* SET */
'old_flags' => $flags,
'old_text' => $compress
- ), array( /* WHERE */
+ ], [ /* WHERE */
'old_id' => $row->old_id
- ), __METHOD__,
- array( 'LIMIT' => 1 )
+ ], __METHOD__,
+ [ 'LIMIT' => 1 ]
);
return true;
$maxPageId = $dbr->selectField( 'page', 'max(page_id)', '', __METHOD__ );
}
$this->output( "Starting from $startId of $maxPageId\n" );
- $pageConds = array();
+ $pageConds = [];
/*
if ( $exclude_ns0 ) {
# Don't compress object type entities, because that might produce data loss when
# overwriting bulk storage concat rows. Don't compress external references, because
# the script doesn't yet delete rows from external storage.
- $conds = array(
+ $conds = [
'old_flags NOT ' . $dbr->buildLike( $dbr->anyString(), 'object', $dbr->anyString() )
. ' AND old_flags NOT '
. $dbr->buildLike( $dbr->anyString(), 'external', $dbr->anyString() )
- );
+ ];
if ( $beginDate ) {
if ( !preg_match( '/^\d{14}$/', $beginDate ) ) {
$conds[] = "rev_timestamp<'" . $endDate . "'";
}
if ( $loadStyle == self::LS_CHUNKED ) {
- $tables = array( 'revision', 'text' );
- $fields = array( 'rev_id', 'rev_text_id', 'old_flags', 'old_text' );
+ $tables = [ 'revision', 'text' ];
+ $fields = [ 'rev_id', 'rev_text_id', 'old_flags', 'old_text' ];
$conds[] = 'rev_text_id=old_id';
$revLoadOptions = 'FOR UPDATE';
} else {
- $tables = array( 'revision' );
- $fields = array( 'rev_id', 'rev_text_id' );
- $revLoadOptions = array();
+ $tables = [ 'revision' ];
+ $fields = [ 'rev_id', 'rev_text_id' ];
+ $revLoadOptions = [];
}
# Don't work with current revisions
# Get the page row
$pageRes = $dbr->select( 'page',
- array( 'page_id', 'page_namespace', 'page_title', 'page_latest' ),
- $pageConds + array( 'page_id' => $pageId ), __METHOD__ );
+ [ 'page_id', 'page_namespace', 'page_title', 'page_latest' ],
+ $pageConds + [ 'page_id' => $pageId ], __METHOD__ );
if ( $pageRes->numRows() == 0 ) {
continue;
}
# Load revisions
$revRes = $dbw->select( $tables, $fields,
- array_merge( array(
+ array_merge( [
'rev_page' => $pageRow->page_id,
# Don't operate on the current revision
# Use < instead of <> in case the current revision has changed
# since the page select, which wasn't locking
'rev_id < ' . $pageRow->page_latest
- ), $conds ),
+ ], $conds ),
__METHOD__,
$revLoadOptions
);
- $revs = array();
+ $revs = [];
foreach ( $revRes as $revRow ) {
$revs[] = $revRow;
}
}
$chunk = new ConcatenatedGzipHistoryBlob();
- $stubs = array();
+ $stubs = [];
$this->beginTransaction( $dbw, __METHOD__ );
$usedChunk = false;
$primaryOldid = $revs[$i]->rev_text_id;
# Get text
if ( $loadStyle == self::LS_INDIVIDUAL ) {
$textRow = $dbw->selectRow( 'text',
- array( 'old_flags', 'old_text' ),
- array( 'old_id' => $oldid ),
+ [ 'old_flags', 'old_text' ],
+ [ 'old_id' => $oldid ],
__METHOD__,
'FOR UPDATE'
);
# $stored should provide base path to a BLOB
$url = $stored . "/" . $stub->getHash();
$dbw->update( 'text',
- array( /* SET */
+ [ /* SET */
'old_text' => $url,
'old_flags' => 'external,utf-8',
- ), array( /* WHERE */
+ ], [ /* WHERE */
'old_id' => $stub->getReferrer(),
- )
+ ]
);
}
} else {
# Store the main object locally
$dbw->update( 'text',
- array( /* SET */
+ [ /* SET */
'old_text' => serialize( $chunk ),
'old_flags' => 'object,utf-8',
- ), array( /* WHERE */
+ ], [ /* WHERE */
'old_id' => $primaryOldid
- )
+ ]
);
# Store the stub objects
# Skip if not compressing and don't overwrite the first revision
if ( $stubs[$j] !== false && $revs[$i + $j]->rev_text_id != $primaryOldid ) {
$dbw->update( 'text',
- array( /* SET */
+ [ /* SET */
'old_text' => serialize( $stubs[$j] ),
'old_flags' => 'object,utf-8',
- ), array( /* WHERE */
+ ], [ /* WHERE */
'old_id' => $revs[$i + $j]->rev_text_id
- )
+ ]
);
}
}