diff options
Diffstat (limited to 'maintenance/fixSlaveDesync.php')
-rw-r--r-- | maintenance/fixSlaveDesync.php | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/maintenance/fixSlaveDesync.php b/maintenance/fixSlaveDesync.php index 3c6888ae..8bf556f0 100644 --- a/maintenance/fixSlaveDesync.php +++ b/maintenance/fixSlaveDesync.php @@ -1,5 +1,7 @@ <?php /** + * Fix erroneous page_latest values due to slave desynchronisation. + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -15,11 +17,18 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * + * @file * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); +/** + * Maintenance script that fixes erroneous page_latest values + * due to slave desynchronisation. + * + * @ingroup Maintenance + */ class FixSlaveDesync extends Maintenance { public function __construct() { parent::__construct(); @@ -88,7 +97,7 @@ class FixSlaveDesync extends Maintenance { private function desyncFixPage( $pageID ) { # Check for a corrupted page_latest $dbw = wfGetDB( DB_MASTER ); - $dbw->begin(); + $dbw->begin( __METHOD__ ); $realLatest = $dbw->selectField( 'page', 'page_latest', array( 'page_id' => $pageID ), __METHOD__, 'FOR UPDATE' ); # list( $masterFile, $masterPos ) = $dbw->getMasterPos(); @@ -98,7 +107,7 @@ class FixSlaveDesync extends Maintenance { /* if ( !$db->masterPosWait( $masterFile, $masterPos, 10 ) ) { $this->output( "Slave is too lagged, aborting\n" ); - $dbw->commit(); + $dbw->commit( __METHOD__ ); sleep(10); return; }*/ @@ -112,7 +121,7 @@ class FixSlaveDesync extends Maintenance { } if ( !$found ) { $this->output( "page_id $pageID seems fine\n" ); - $dbw->commit(); + $dbw->commit( __METHOD__ ); return; } @@ -199,7 +208,7 @@ class FixSlaveDesync extends Maintenance { } $this->output( "done\n" ); } - $dbw->commit(); + $dbw->commit( __METHOD__ ); } } |