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 "Hide TOC with CSS instead of JavaScript"
[lhc/web/wiklou.git]
/
maintenance
/
updateSpecialPages.php
diff --git
a/maintenance/updateSpecialPages.php
b/maintenance/updateSpecialPages.php
index
1c6f9b3
..
01aace0
100644
(file)
--- a/
maintenance/updateSpecialPages.php
+++ b/
maintenance/updateSpecialPages.php
@@
-24,6
+24,9
@@
require_once __DIR__ . '/Maintenance.php';
require_once __DIR__ . '/Maintenance.php';
+use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\DBReplicationWaitError;
+
/**
* Maintenance script to update cached special pages.
*
/**
* Maintenance script to update cached special pages.
*
@@
-48,7
+51,7
@@
class UpdateSpecialPages extends Maintenance {
foreach ( QueryPage::getPages() as $page ) {
list( $class, $special ) = $page;
foreach ( QueryPage::getPages() as $page ) {
list( $class, $special ) = $page;
- $limit =
isset( $page[2] ) ? $page[2] :
null;
+ $limit =
$page[2] ??
null;
# --list : just show the name of pages
if ( $this->hasOption( 'list' ) ) {
# --list : just show the name of pages
if ( $this->hasOption( 'list' ) ) {
@@
-81,7
+84,7
@@
class UpdateSpecialPages extends Maintenance {
if ( $queryPage->isExpensive() ) {
$t1 = microtime( true );
# Do the query
if ( $queryPage->isExpensive() ) {
$t1 = microtime( true );
# Do the query
- $num = $queryPage->recache( $limit
=== null ? $wgQueryCacheLimit : $l
imit );
+ $num = $queryPage->recache( $limit
?? $wgQueryCacheL
imit );
$t2 = microtime( true );
if ( $num === false ) {
$this->output( "FAILED: database error\n" );
$t2 = microtime( true );
if ( $num === false ) {
$this->output( "FAILED: database error\n" );
@@
-119,16
+122,22
@@
class UpdateSpecialPages extends Maintenance {
* mysql connection to "go away"
*/
private function reopenAndWaitForReplicas() {
* mysql connection to "go away"
*/
private function reopenAndWaitForReplicas() {
- if ( !wfGetLB()->pingAll() ) {
+ $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+ $lb = $lbFactory->getMainLB();
+ if ( !$lb->pingAll() ) {
$this->output( "\n" );
do {
$this->error( "Connection failed, reconnecting in 10 seconds..." );
sleep( 10 );
$this->output( "\n" );
do {
$this->error( "Connection failed, reconnecting in 10 seconds..." );
sleep( 10 );
- } while ( !
wfGetLB()
->pingAll() );
+ } while ( !
$lb
->pingAll() );
$this->output( "Reconnected\n\n" );
}
$this->output( "Reconnected\n\n" );
}
- # Wait for the replica DB to catch up
- wfWaitForSlaves();
+ // Wait for the replica DB to catch up
+ try {
+ $lbFactory->waitForReplication();
+ } catch ( DBReplicationWaitError $e ) {
+ // ignore
+ }
}
public function doSpecialPageCacheUpdates( $dbw ) {
}
public function doSpecialPageCacheUpdates( $dbw ) {