X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FnukeNS.php;h=0326e02308426cea7079e0075363d84c60c4fe85;hb=e8dd1f43fb16919007aa865560eaef24e2d6cc08;hp=04e267376176a23285e9e4e3b8a688658173a41d;hpb=ccef8c7750f09062585bbad5adec304d26e3baf0;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/nukeNS.php b/maintenance/nukeNS.php index 04e2673761..0326e02308 100644 --- a/maintenance/nukeNS.php +++ b/maintenance/nukeNS.php @@ -44,7 +44,7 @@ require_once __DIR__ . '/Maintenance.php'; class NukeNS extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Remove pages with only 1 revision from any namespace"; + $this->addDescription( 'Remove pages with only 1 revision from any namespace' ); $this->addOption( 'delete', "Actually delete the page" ); $this->addOption( 'ns', 'Namespace to delete from, default NS_MEDIAWIKI', false, true ); $this->addOption( 'all', 'Delete everything regardless of revision count' ); @@ -54,7 +54,7 @@ class NukeNS extends Maintenance { $ns = $this->getOption( 'ns', NS_MEDIAWIKI ); $delete = $this->getOption( 'delete', false ); $all = $this->getOption( 'all', false ); - $dbw = wfGetDB( DB_MASTER ); + $dbw = $this->getDB( DB_MASTER ); $this->beginTransaction( $dbw, __METHOD__ ); $tbl_pag = $dbw->tableName( 'page' ); @@ -70,7 +70,7 @@ class NukeNS extends Maintenance { // Get corresponding revisions $res2 = $dbw->query( "SELECT rev_id FROM $tbl_rev WHERE rev_page = $id" ); - $revs = array(); + $revs = []; foreach ( $res2 as $row2 ) { $revs[] = $row2->rev_id; @@ -106,8 +106,8 @@ class NukeNS extends Maintenance { $pages -= $n_deleted; $dbw->update( 'site_stats', - array( 'ss_total_pages' => $pages ), - array( 'ss_row_id' => 1 ), + [ 'ss_total_pages' => $pages ], + [ 'ss_row_id' => 1 ], __METHOD__ ); }