From: Alexandre Emsenhuber Date: Sat, 10 May 2014 12:23:50 +0000 (+0200) Subject: Don't use isset() to check for null X-Git-Tag: 1.31.0-rc.0~15525^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=4c4d3051e70f221250fadbdb119264d9ed8dd635;p=lhc%2Fweb%2Fwiklou.git Don't use isset() to check for null Fixes in maintenance/ Change-Id: I300a2a0cb240cb3f9c1d0c76d4575f93e9706b59 --- diff --git a/maintenance/dumpLinks.php b/maintenance/dumpLinks.php index dfd1959cfc..888c2dc1d9 100644 --- a/maintenance/dumpLinks.php +++ b/maintenance/dumpLinks.php @@ -59,7 +59,7 @@ class DumpLinks extends Maintenance { $lastPage = null; foreach ( $result as $row ) { if ( $lastPage != $row->page_id ) { - if ( isset( $lastPage ) ) { + if ( $lastPage !== null ) { $this->output( "\n" ); } $page = Title::makeTitle( $row->page_namespace, $row->page_title ); @@ -69,7 +69,7 @@ class DumpLinks extends Maintenance { $link = Title::makeTitle( $row->pl_namespace, $row->pl_title ); $this->output( " " . $link->getPrefixedURL() ); } - if ( isset( $lastPage ) ) { + if ( $lastPage !== null ) { $this->output( "\n" ); } } diff --git a/maintenance/fixDoubleRedirects.php b/maintenance/fixDoubleRedirects.php index 0b3cdba4c2..a678a92832 100644 --- a/maintenance/fixDoubleRedirects.php +++ b/maintenance/fixDoubleRedirects.php @@ -44,13 +44,14 @@ class FixDoubleRedirects extends Maintenance { public function execute() { $async = $this->getOption( 'async', false ); $dryrun = $this->getOption( 'dry-run', false ); - $title = $this->getOption( 'title' ); - if ( isset( $title ) ) { - $title = Title::newFromText( $title ); + if ( $this->hasOption( 'title' ) ) { + $title = Title::newFromText( $this->getOption( 'title' ) ); if ( !$title || !$title->isRedirect() ) { $this->error( $title->getPrefixedText() . " is not a redirect!\n", true ); } + } else { + $title = null; } $dbr = wfGetDB( DB_SLAVE ); @@ -75,7 +76,7 @@ class FixDoubleRedirects extends Maintenance { 'pb.page_is_redirect' => 1, ); - if ( isset( $title ) ) { + if ( $title != null ) { $conds['pb.page_namespace'] = $title->getNamespace(); $conds['pb.page_title'] = $title->getDBkey(); } diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index c43851e6f2..1930a22a13 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -244,9 +244,6 @@ class GenerateSitemap extends Maintenance { * @return null|string */ private static function init_path( $fspath ) { - if ( !isset( $fspath ) ) { - return null; - } # Create directory if needed if ( $fspath && !is_dir( $fspath ) ) { wfMkdirParents( $fspath, null, __METHOD__ ) or die( "Can not create directory $fspath.\n" );