X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FnukePage.php;h=44235d5f07a24fbf83a745d921d0205399261154;hb=48fdd531c8cf294b39e4f0ea2b3d06f742c197c7;hp=3193d4367d847be94434c09fced527c031379d0e;hpb=e676c6953fad3c9b29f50216f1b082a13738bf20;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/nukePage.php b/maintenance/nukePage.php index 3193d4367d..44235d5f07 100644 --- a/maintenance/nukePage.php +++ b/maintenance/nukePage.php @@ -23,7 +23,7 @@ * @author Rob Church */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once __DIR__ . '/Maintenance.php'; /** * Maintenance script that erases a page record from the database. @@ -33,7 +33,7 @@ require_once( dirname( __FILE__ ) . '/Maintenance.php' ); class NukePage extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Remove a page record from the database"; + $this->addDescription( 'Remove a page record from the database' ); $this->addOption( 'delete', "Actually delete the page" ); $this->addArg( 'title', 'Title to delete' ); } @@ -43,8 +43,8 @@ class NukePage extends Maintenance { $name = $this->getArg(); $delete = $this->getOption( 'delete', false ); - $dbw = wfGetDB( DB_MASTER ); - $dbw->begin( __METHOD__ ); + $dbw = $this->getDB( DB_MASTER ); + $this->beginTransaction( $dbw, __METHOD__ ); $tbl_pag = $dbw->tableName( 'page' ); $tbl_rec = $dbw->tableName( 'recentchanges' ); @@ -54,7 +54,7 @@ class NukePage extends Maintenance { $this->output( "Searching for \"$name\"..." ); $title = Title::newFromText( $name ); if ( $title ) { - $id = $title->getArticleID(); + $id = $title->getArticleID(); $real = $title->getPrefixedText(); $isGoodArticle = $title->isContentPage(); $this->output( "found \"$real\" with ID $id.\n" ); @@ -79,7 +79,7 @@ class NukePage extends Maintenance { $this->output( "done.\n" ); } - $dbw->commit( __METHOD__ ); + $this->commitTransaction( $dbw, __METHOD__ ); # Delete revisions as appropriate if ( $delete && $count ) { @@ -99,22 +99,22 @@ class NukePage extends Maintenance { } } else { $this->output( "not found in database.\n" ); - $dbw->commit( __METHOD__ ); + $this->commitTransaction( $dbw, __METHOD__ ); } } public function deleteRevisions( $ids ) { - $dbw = wfGetDB( DB_MASTER ); - $dbw->begin( __METHOD__ ); + $dbw = $this->getDB( DB_MASTER ); + $this->beginTransaction( $dbw, __METHOD__ ); $tbl_rev = $dbw->tableName( 'revision' ); $set = implode( ', ', $ids ); $dbw->query( "DELETE FROM $tbl_rev WHERE rev_id IN ( $set )" ); - $dbw->commit( __METHOD__ ); + $this->commitTransaction( $dbw, __METHOD__ ); } } $maintClass = "NukePage"; -require_once( RUN_MAINTENANCE_IF_MAIN ); +require_once RUN_MAINTENANCE_IF_MAIN;