refreshLinks.php: use hasOption() rather than getOption and assignment in conditional

Change-Id: I0f5bc2117b5d26e10f116b879d60e7c996690463
This commit is contained in:
Reedy 2021-01-28 23:52:28 +00:00
parent 5269ffbc8a
commit cba68e4f02

View file

@ -63,20 +63,23 @@ class RefreshLinks extends Maintenance {
$start = (int)$this->getArg( 0 ) ?: null;
$end = (int)$this->getOption( 'e' ) ?: null;
$dfnChunkSize = (int)$this->getOption( 'dfn-chunk-size', 100000 );
$ns = $this->getOption( 'namespace' );
if ( $ns === null ) {
$this->namespace = false;
} else {
$this->namespace = (int)$ns;
}
if ( ( $category = $this->getOption( 'category', false ) ) !== false ) {
if ( $this->hasOption( 'category' ) ) {
$category = $this->getOption( 'category' );
$title = Title::makeTitleSafe( NS_CATEGORY, $category );
if ( !$title ) {
$this->fatalError( "'$category' is an invalid category name!\n" );
}
$this->refreshCategory( $title );
} elseif ( ( $category = $this->getOption( 'tracking-category', false ) ) !== false ) {
$this->refreshTrackingCategory( $category );
} elseif ( $this->hasOption( 'tracking-category' ) ) {
$this->refreshTrackingCategory( $this->getOption( 'trackingcategory' ) );
} elseif ( !$this->hasOption( 'dfn-only' ) ) {
$new = $this->hasOption( 'new-only' );
$redir = $this->hasOption( 'redirects-only' );