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 "Update OOUI to v0.31.0"
[lhc/web/wiklou.git]
/
maintenance
/
populateRecentChangesSource.php
diff --git
a/maintenance/populateRecentChangesSource.php
b/maintenance/populateRecentChangesSource.php
index
ac87cf3
..
8a56d7d
100644
(file)
--- a/
maintenance/populateRecentChangesSource.php
+++ b/
maintenance/populateRecentChangesSource.php
@@
-23,6
+23,8
@@
require_once __DIR__ . '/Maintenance.php';
require_once __DIR__ . '/Maintenance.php';
+use Wikimedia\Rdbms\IDatabase;
+
/**
* Maintenance script to populate the rc_source field.
*
/**
* Maintenance script to populate the rc_source field.
*
@@
-39,32
+41,31
@@
class PopulateRecentChangesSource extends LoggedUpdateMaintenance {
protected function doDBUpdates() {
$dbw = $this->getDB( DB_MASTER );
protected function doDBUpdates() {
$dbw = $this->getDB( DB_MASTER );
+ $batchSize = $this->getBatchSize();
if ( !$dbw->fieldExists( 'recentchanges', 'rc_source' ) ) {
$this->error( 'rc_source field in recentchanges table does not exist.' );
}
if ( !$dbw->fieldExists( 'recentchanges', 'rc_source' ) ) {
$this->error( 'rc_source field in recentchanges table does not exist.' );
}
- $start = $dbw->selectField( 'recentchanges', 'MIN(rc_id)',
false
, __METHOD__ );
+ $start = $dbw->selectField( 'recentchanges', 'MIN(rc_id)',
''
, __METHOD__ );
if ( !$start ) {
$this->output( "Nothing to do.\n" );
return true;
}
if ( !$start ) {
$this->output( "Nothing to do.\n" );
return true;
}
- $end = $dbw->selectField( 'recentchanges', 'MAX(rc_id)',
false
, __METHOD__ );
- $end += $
this->mB
atchSize - 1;
+ $end = $dbw->selectField( 'recentchanges', 'MAX(rc_id)',
''
, __METHOD__ );
+ $end += $
b
atchSize - 1;
$blockStart = $start;
$blockStart = $start;
- $blockEnd = $start + $
this->mB
atchSize - 1;
+ $blockEnd = $start + $
b
atchSize - 1;
$updatedValues = $this->buildUpdateCondition( $dbw );
while ( $blockEnd <= $end ) {
$updatedValues = $this->buildUpdateCondition( $dbw );
while ( $blockEnd <= $end ) {
- $cond = "rc_id BETWEEN $blockStart AND $blockEnd";
-
$dbw->update(
'recentchanges',
[ $updatedValues ],
[
"rc_source = ''",
$dbw->update(
'recentchanges',
[ $updatedValues ],
[
"rc_source = ''",
- "rc_id BETWEEN
$blockStart AND $blockEnd"
+ "rc_id BETWEEN
" . (int)$blockStart . " AND " . (int)$blockEnd
],
__METHOD__
);
],
__METHOD__
);
@@
-72,8
+73,8
@@
class PopulateRecentChangesSource extends LoggedUpdateMaintenance {
$this->output( "." );
wfWaitForSlaves();
$this->output( "." );
wfWaitForSlaves();
- $blockStart += $
this->mB
atchSize;
- $blockEnd += $
this->mB
atchSize;
+ $blockStart += $
b
atchSize;
+ $blockEnd += $
b
atchSize;
}
$this->output( "\nDone.\n" );
}
$this->output( "\nDone.\n" );
@@
-83,7
+84,7
@@
class PopulateRecentChangesSource extends LoggedUpdateMaintenance {
return __CLASS__;
}
return __CLASS__;
}
- protected function buildUpdateCondition( Database $dbw ) {
+ protected function buildUpdateCondition(
I
Database $dbw ) {
$rcNew = $dbw->addQuotes( RC_NEW );
$rcSrcNew = $dbw->addQuotes( RecentChange::SRC_NEW );
$rcEdit = $dbw->addQuotes( RC_EDIT );
$rcNew = $dbw->addQuotes( RC_NEW );
$rcSrcNew = $dbw->addQuotes( RecentChange::SRC_NEW );
$rcEdit = $dbw->addQuotes( RC_EDIT );
@@
-103,5
+104,5
@@
class PopulateRecentChangesSource extends LoggedUpdateMaintenance {
}
}
}
}
-$maintClass =
"PopulateRecentChangesSource"
;
+$maintClass =
PopulateRecentChangesSource::class
;
require_once RUN_MAINTENANCE_IF_MAIN;
require_once RUN_MAINTENANCE_IF_MAIN;