X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FnukeNS.php;h=e735aed00fcd0e1a16cfb8305000e9765df5745a;hb=e2707643c5c49d8fe6101cc32859bf76e39bba64;hp=0f2dbf64ff686f3a01d40e1a5e737fa6f33238e4;hpb=052770c40b84e22ddd42ff5686e0aaf3b9131030;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/nukeNS.php b/maintenance/nukeNS.php index 0f2dbf64ff..e735aed00f 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' ); @@ -52,8 +52,8 @@ class NukeNS extends Maintenance { public function execute() { $ns = $this->getOption( 'ns', NS_MEDIAWIKI ); - $delete = $this->getOption( 'delete', false ); - $all = $this->getOption( 'all', false ); + $delete = $this->hasOption( 'delete' ); + $all = $this->hasOption( 'all' ); $dbw = $this->getDB( DB_MASTER ); $this->beginTransaction( $dbw, __METHOD__ ); @@ -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__ ); }