dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "logging: Start using LinkTarget & UserIdentity in ManualLogEntry"
[lhc/web/wiklou.git]
/
maintenance
/
populateContentTables.php
diff --git
a/maintenance/populateContentTables.php
b/maintenance/populateContentTables.php
index
20d6b8b
..
644ff87
100644
(file)
--- a/
maintenance/populateContentTables.php
+++ b/
maintenance/populateContentTables.php
@@
-20,6
+20,7
@@
*/
use MediaWiki\MediaWikiServices;
*/
use MediaWiki\MediaWikiServices;
+use MediaWiki\Revision\SlotRecord;
use MediaWiki\Storage\NameTableStore;
use MediaWiki\Storage\SqlBlobStore;
use Wikimedia\Assert\Assert;
use MediaWiki\Storage\NameTableStore;
use MediaWiki\Storage\SqlBlobStore;
use Wikimedia\Assert\Assert;
@@
-58,13
+59,16
@@
class PopulateContentTables extends Maintenance {
'Reuse content table rows when the address and model are the same. '
. 'This will increase the script\'s time and memory usage, perhaps significantly.',
false, false );
'Reuse content table rows when the address and model are the same. '
. 'This will increase the script\'s time and memory usage, perhaps significantly.',
false, false );
+ $this->addOption( 'start-revision', 'The rev_id to start at', false, true );
+ $this->addOption( 'start-archive', 'The ar_rev_id to start at', false, true );
$this->setBatchSize( 500 );
}
private function initServices() {
$this->dbw = $this->getDB( DB_MASTER );
$this->contentModelStore = MediaWikiServices::getInstance()->getContentModelStore();
$this->setBatchSize( 500 );
}
private function initServices() {
$this->dbw = $this->getDB( DB_MASTER );
$this->contentModelStore = MediaWikiServices::getInstance()->getContentModelStore();
- $this->mainRoleId = MediaWikiServices::getInstance()->getSlotRoleStore()->acquireId( 'main' );
+ $this->mainRoleId = MediaWikiServices::getInstance()->getSlotRoleStore()
+ ->acquireId( SlotRecord::MAIN );
}
public function execute() {
}
public function execute() {
@@
-165,6
+169,7
@@
class PopulateContentTables extends Maintenance {
'slots' => [ 'LEFT JOIN', 'rev_id=slot_revision_id' ],
'page' => [ 'LEFT JOIN', 'rev_page=page_id' ],
];
'slots' => [ 'LEFT JOIN', 'rev_id=slot_revision_id' ],
'page' => [ 'LEFT JOIN', 'rev_page=page_id' ],
];
+ $startOption = 'start-revision';
} else {
$idField = 'ar_rev_id';
$tables = [ 'archive', 'slots' ];
} else {
$idField = 'ar_rev_id';
$tables = [ 'archive', 'slots' ];
@@
-180,6
+185,7
@@
class PopulateContentTables extends Maintenance {
$joins = [
'slots' => [ 'LEFT JOIN', 'ar_rev_id=slot_revision_id' ],
];
$joins = [
'slots' => [ 'LEFT JOIN', 'ar_rev_id=slot_revision_id' ],
];
+ $startOption = 'start-archive';
}
$minmax = $this->dbw->selectRow(
}
$minmax = $this->dbw->selectRow(
@@
-188,6
+194,9
@@
class PopulateContentTables extends Maintenance {
'',
__METHOD__
);
'',
__METHOD__
);
+ if ( $this->hasOption( $startOption ) ) {
+ $minmax->min = (int)$this->getOption( $startOption );
+ }
if ( !$minmax || !is_numeric( $minmax->min ) || !is_numeric( $minmax->max ) ) {
// No rows?
$minmax = (object)[ 'min' => 1, 'max' => 0 ];
if ( !$minmax || !is_numeric( $minmax->min ) || !is_numeric( $minmax->max ) ) {
// No rows?
$minmax = (object)[ 'min' => 1, 'max' => 0 ];