Krinkle has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366317 )

Change subject: maintenance: Consistently use hasOption() for boolean options
......................................................................

maintenance: Consistently use hasOption() for boolean options

We already do this in many places, but there were also still plenty
of getOption(, false) calls. Change these to hasOption() for consistency.

Change-Id: I74f91a5bf5a8036496ab1f493e5862a04d27ec0f
---
M maintenance/fixDoubleRedirects.php
M maintenance/generateSitemap.php
M maintenance/moveBatch.php
M maintenance/nukeNS.php
M maintenance/nukePage.php
M maintenance/populateCategory.php
M maintenance/populateInterwiki.php
M maintenance/rebuildFileCache.php
M maintenance/refreshLinks.php
9 files changed, 13 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/17/366317/1

diff --git a/maintenance/fixDoubleRedirects.php 
b/maintenance/fixDoubleRedirects.php
index 79f75ef..8c9faca 100644
--- a/maintenance/fixDoubleRedirects.php
+++ b/maintenance/fixDoubleRedirects.php
@@ -42,8 +42,8 @@
        }
 
        public function execute() {
-               $async = $this->getOption( 'async', false );
-               $dryrun = $this->getOption( 'dry-run', false );
+               $async = $this->hasOption( 'async' );
+               $dryrun = $this->hasOption( 'dry-run' );
 
                if ( $this->hasOption( 'title' ) ) {
                        $title = Title::newFromText( $this->getOption( 'title' 
) );
diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php
index fb00bed..8a837d2 100644
--- a/maintenance/generateSitemap.php
+++ b/maintenance/generateSitemap.php
@@ -195,7 +195,7 @@
                }
                $this->identifier = $this->getOption( 'identifier', wfWikiID() 
);
                $this->compress = $this->getOption( 'compress', 'yes' ) !== 
'no';
-               $this->skipRedirects = $this->getOption( 'skip-redirects', 
false ) !== false;
+               $this->skipRedirects = $this->hasOption( 'skip-redirects' );
                $this->dbr = $this->getDB( DB_REPLICA );
                $this->generateNamespaces();
                $this->timestamp = wfTimestamp( TS_ISO_8601, wfTimestampNow() );
diff --git a/maintenance/moveBatch.php b/maintenance/moveBatch.php
index 3c29689..d578a49 100644
--- a/maintenance/moveBatch.php
+++ b/maintenance/moveBatch.php
@@ -64,7 +64,7 @@
                $user = $this->getOption( 'u', false );
                $reason = $this->getOption( 'r', '' );
                $interval = $this->getOption( 'i', 0 );
-               $noredirects = $this->getOption( 'noredirects', false );
+               $noredirects = $this->hasOption( 'noredirects' );
                if ( $this->hasArg() ) {
                        $file = fopen( $this->getArg(), 'r' );
                } else {
diff --git a/maintenance/nukeNS.php b/maintenance/nukeNS.php
index 0326e02..e735aed 100644
--- a/maintenance/nukeNS.php
+++ b/maintenance/nukeNS.php
@@ -52,8 +52,8 @@
 
        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__ );
 
diff --git a/maintenance/nukePage.php b/maintenance/nukePage.php
index ff821cc..e27324a 100644
--- a/maintenance/nukePage.php
+++ b/maintenance/nukePage.php
@@ -40,7 +40,7 @@
 
        public function execute() {
                $name = $this->getArg();
-               $delete = $this->getOption( 'delete', false );
+               $delete = $this->hasOption( 'delete' );
 
                $dbw = $this->getDB( DB_MASTER );
                $this->beginTransaction( $dbw, __METHOD__ );
diff --git a/maintenance/populateCategory.php b/maintenance/populateCategory.php
index 87a4699..5dccdd6 100644
--- a/maintenance/populateCategory.php
+++ b/maintenance/populateCategory.php
@@ -71,7 +71,7 @@
        public function execute() {
                $begin = $this->getOption( 'begin', '' );
                $throttle = $this->getOption( 'throttle', 0 );
-               $force = $this->getOption( 'force', false );
+               $force = $this->hasOption( 'force' );
 
                $dbw = $this->getDB( DB_MASTER );
 
diff --git a/maintenance/populateInterwiki.php 
b/maintenance/populateInterwiki.php
index 8f7a918..1b05e1e 100644
--- a/maintenance/populateInterwiki.php
+++ b/maintenance/populateInterwiki.php
@@ -56,7 +56,7 @@
        }
 
        public function execute() {
-               $force = $this->getOption( 'force', false );
+               $force = $this->hasOption( 'force' );
                $this->source = $this->getOption( 'source', 
'https://en.wikipedia.org/w/api.php' );
 
                $data = $this->fetchLinks();
diff --git a/maintenance/rebuildFileCache.php b/maintenance/rebuildFileCache.php
index 04ac967..fe3944c 100644
--- a/maintenance/rebuildFileCache.php
+++ b/maintenance/rebuildFileCache.php
@@ -78,7 +78,7 @@
                $this->output( "Building content page file cache from page 
{$start}!\n" );
 
                $dbr = $this->getDB( DB_REPLICA );
-               $overwrite = $this->getOption( 'overwrite', false );
+               $overwrite = $this->hasOption( 'overwrite' );
                $start = ( $start > 0 )
                        ? $start
                        : $dbr->selectField( 'page', 'MIN(page_id)', false, 
__METHOD__ );
diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php
index facc506..3e1654a 100644
--- a/maintenance/refreshLinks.php
+++ b/maintenance/refreshLinks.php
@@ -76,9 +76,9 @@
                } elseif ( ( $category = $this->getOption( 'tracking-category', 
false ) ) !== false ) {
                        $this->refreshTrackingCategory( $category );
                } elseif ( !$this->hasOption( 'dfn-only' ) ) {
-                       $new = $this->getOption( 'new-only', false );
-                       $redir = $this->getOption( 'redirects-only', false );
-                       $oldRedir = $this->getOption( 'old-redirects-only', 
false );
+                       $new = $this->hasOption( 'new-only' );
+                       $redir = $this->hasOption( 'redirects-only' );
+                       $oldRedir = $this->hasOption( 'old-redirects-only' );
                        $this->doRefreshLinks( $start, $new, $end, $redir, 
$oldRedir );
                        $this->deleteLinksFromNonexistent( null, null, 
$this->mBatchSize, $dfnChunkSize );
                } else {

-- 
To view, visit https://gerrit.wikimedia.org/r/366317
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I74f91a5bf5a8036496ab1f493e5862a04d27ec0f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to