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 "resourceloader: Remove addModuleScripts, and deprecate getModuleScripts."
[lhc/web/wiklou.git]
/
maintenance
/
attachLatest.php
diff --git
a/maintenance/attachLatest.php
b/maintenance/attachLatest.php
index
deab60b
..
4da0901
100644
(file)
--- a/
maintenance/attachLatest.php
+++ b/
maintenance/attachLatest.php
@@
-24,6
+24,8
@@
* @ingroup Maintenance
*/
* @ingroup Maintenance
*/
+use MediaWiki\MediaWikiServices;
+
require_once __DIR__ . '/Maintenance.php';
/**
require_once __DIR__ . '/Maintenance.php';
/**
@@
-44,15
+46,16
@@
class AttachLatest extends Maintenance {
public function execute() {
$this->output( "Looking for pages with page_latest set to 0...\n" );
$dbw = $this->getDB( DB_MASTER );
public function execute() {
$this->output( "Looking for pages with page_latest set to 0...\n" );
$dbw = $this->getDB( DB_MASTER );
- $conds =
array( 'page_latest' => 0 )
;
+ $conds =
[ 'page_latest' => 0 ]
;
if ( $this->hasOption( 'regenerate-all' ) ) {
$conds = '';
}
$result = $dbw->select( 'page',
if ( $this->hasOption( 'regenerate-all' ) ) {
$conds = '';
}
$result = $dbw->select( 'page',
-
array( 'page_id', 'page_namespace', 'page_title' )
,
+
[ 'page_id', 'page_namespace', 'page_title' ]
,
$conds,
__METHOD__ );
$conds,
__METHOD__ );
+ $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
$n = 0;
foreach ( $result as $row ) {
$pageId = intval( $row->page_id );
$n = 0;
foreach ( $result as $row ) {
$pageId = intval( $row->page_id );
@@
-60,7
+63,7
@@
class AttachLatest extends Maintenance {
$name = $title->getPrefixedText();
$latestTime = $dbw->selectField( 'revision',
'MAX(rev_timestamp)',
$name = $title->getPrefixedText();
$latestTime = $dbw->selectField( 'revision',
'MAX(rev_timestamp)',
-
array( 'rev_page' => $pageId )
,
+
[ 'rev_page' => $pageId ]
,
__METHOD__ );
if ( !$latestTime ) {
$this->output( wfWikiID() . " $pageId [[$name]] can't find latest rev time?!\n" );
__METHOD__ );
if ( !$latestTime ) {
$this->output( wfWikiID() . " $pageId [[$name]] can't find latest rev time?!\n" );
@@
-78,6
+81,7
@@
class AttachLatest extends Maintenance {
if ( $this->hasOption( 'fix' ) ) {
$page = WikiPage::factory( $title );
$page->updateRevisionOn( $dbw, $revision );
if ( $this->hasOption( 'fix' ) ) {
$page = WikiPage::factory( $title );
$page->updateRevisionOn( $dbw, $revision );
+ $lbFactory->waitForReplication();
}
$n++;
}
}
$n++;
}
@@
-88,5
+92,5
@@
class AttachLatest extends Maintenance {
}
}
}
}
-$maintClass =
"AttachLatest"
;
+$maintClass =
AttachLatest::class
;
require_once RUN_MAINTENANCE_IF_MAIN;
require_once RUN_MAINTENANCE_IF_MAIN;