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
Fix SQLite patch-(page|template)links-fix-pk.sql column order
[lhc/web/wiklou.git]
/
maintenance
/
populateRevisionLength.php
diff --git
a/maintenance/populateRevisionLength.php
b/maintenance/populateRevisionLength.php
index
5de5819
..
dcb89d1
100644
(file)
--- a/
maintenance/populateRevisionLength.php
+++ b/
maintenance/populateRevisionLength.php
@@
-21,6
+21,8
@@
* @ingroup Maintenance
*/
* @ingroup Maintenance
*/
+use Wikimedia\Rdbms\IDatabase;
+
require_once __DIR__ . '/Maintenance.php';
/**
require_once __DIR__ . '/Maintenance.php';
/**
@@
-44,9
+46,9
@@
class PopulateRevisionLength extends LoggedUpdateMaintenance {
public function doDBUpdates() {
$dbw = $this->getDB( DB_MASTER );
if ( !$dbw->tableExists( 'revision' ) ) {
public function doDBUpdates() {
$dbw = $this->getDB( DB_MASTER );
if ( !$dbw->tableExists( 'revision' ) ) {
- $this->
error( "revision table does not exist", true
);
+ $this->
fatalError( "revision table does not exist"
);
} elseif ( !$dbw->tableExists( 'archive' ) ) {
} elseif ( !$dbw->tableExists( 'archive' ) ) {
- $this->
error( "archive table does not exist", true
);
+ $this->
fatalError( "archive table does not exist"
);
} elseif ( !$dbw->fieldExists( 'revision', 'rev_len', __METHOD__ ) ) {
$this->output( "rev_len column does not exist\n\n", true );
} elseif ( !$dbw->fieldExists( 'revision', 'rev_len', __METHOD__ ) ) {
$this->output( "rev_len column does not exist\n\n", true );
@@
-76,8
+78,8
@@
class PopulateRevisionLength extends LoggedUpdateMaintenance {
$dbr = $this->getDB( DB_REPLICA );
$dbw = $this->getDB( DB_MASTER );
$batchSize = $this->getBatchSize();
$dbr = $this->getDB( DB_REPLICA );
$dbw = $this->getDB( DB_MASTER );
$batchSize = $this->getBatchSize();
- $start = $dbw->selectField( $table, "MIN($idCol)",
false
, __METHOD__ );
- $end = $dbw->selectField( $table, "MAX($idCol)",
false
, __METHOD__ );
+ $start = $dbw->selectField( $table, "MIN($idCol)",
''
, __METHOD__ );
+ $end = $dbw->selectField( $table, "MAX($idCol)",
''
, __METHOD__ );
if ( !$start || !$end ) {
$this->output( "...$table table seems to be empty.\n" );
if ( !$start || !$end ) {
$this->output( "...$table table seems to be empty.\n" );
@@
-97,7
+99,13
@@
class PopulateRevisionLength extends LoggedUpdateMaintenance {
[
"$idCol >= $blockStart",
"$idCol <= $blockEnd",
[
"$idCol >= $blockStart",
"$idCol <= $blockEnd",
- "{$prefix}_len IS NULL"
+ $dbr->makeList( [
+ "{$prefix}_len IS NULL",
+ $dbr->makeList( [
+ "{$prefix}_len = 0",
+ "{$prefix}_sha1 != " . $dbr->addQuotes( 'phoiac9h4m842xq45sp7s6u21eteeq1' ), // sha1( "" )
+ ], IDatabase::LIST_AND )
+ ], IDatabase::LIST_OR )
],
__METHOD__,
[],
],
__METHOD__,
[],
@@
-117,7
+125,6
@@
class PopulateRevisionLength extends LoggedUpdateMaintenance {
$blockStart += $batchSize;
$blockEnd += $batchSize;
$blockStart += $batchSize;
$blockEnd += $batchSize;
- wfWaitForSlaves();
}
return $count;
}
return $count;
@@
-137,7
+144,7
@@
class PopulateRevisionLength extends LoggedUpdateMaintenance {
? Revision::newFromArchiveRow( $row )
: new Revision( $row );
? Revision::newFromArchiveRow( $row )
: new Revision( $row );
- $content = $rev->getContent();
+ $content = $rev->getContent(
Revision::RAW
);
if ( !$content ) {
# This should not happen, but sometimes does (T22757)
$id = $row->$idCol;
if ( !$content ) {
# This should not happen, but sometimes does (T22757)
$id = $row->$idCol;
@@
-157,5
+164,5
@@
class PopulateRevisionLength extends LoggedUpdateMaintenance {
}
}
}
}
-$maintClass =
"PopulateRevisionLength"
;
+$maintClass =
PopulateRevisionLength::class
;
require_once RUN_MAINTENANCE_IF_MAIN;
require_once RUN_MAINTENANCE_IF_MAIN;