X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=maintenance%2FdeleteOrphanedRevisions.php;h=5f08b5a9a66f8d141b08448512e1cdd82e0fd09a;hb=8aa6c9f43e9b54e4157a5feee42229a9a48b1764;hp=7f1ffe418b7868e49910317c6f49c9eff58b8a64;hpb=bd2a78a159ce6d9f7b27fd75d05570228b44c3cb;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/deleteOrphanedRevisions.php b/maintenance/deleteOrphanedRevisions.php index 7f1ffe418b..5f08b5a9a6 100644 --- a/maintenance/deleteOrphanedRevisions.php +++ b/maintenance/deleteOrphanedRevisions.php @@ -34,7 +34,8 @@ require_once __DIR__ . '/Maintenance.php'; class DeleteOrphanedRevisions extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Maintenance script to delete revisions which refer to a nonexisting page"; + $this->addDescription( + 'Maintenance script to delete revisions which refer to a nonexisting page' ); $this->addOption( 'report', 'Prints out a count of affected revisions but doesn\'t delete them' ); } @@ -43,8 +44,8 @@ class DeleteOrphanedRevisions extends Maintenance { $report = $this->hasOption( 'report' ); - $dbw = wfGetDB( DB_MASTER ); - $dbw->begin( __METHOD__ ); + $dbw = $this->getDB( DB_MASTER ); + $this->beginTransaction( $dbw, __METHOD__ ); list( $page, $revision ) = $dbw->tableNamesN( 'page', 'revision' ); # Find all the orphaned revisions @@ -63,7 +64,7 @@ class DeleteOrphanedRevisions extends Maintenance { # Nothing to do? if ( $report || $count == 0 ) { - $dbw->commit( __METHOD__ ); + $this->commitTransaction( $dbw, __METHOD__ ); exit( 0 ); } @@ -73,7 +74,7 @@ class DeleteOrphanedRevisions extends Maintenance { $this->output( "done.\n" ); # Close the transaction and call the script to purge unused text records - $dbw->commit( __METHOD__ ); + $this->commitTransaction( $dbw, __METHOD__ ); $this->purgeRedundantText( true ); }