From: Platonides Date: Thu, 10 Feb 2011 17:13:12 +0000 (+0000) Subject: Convert the if into an early exit. Whitespace ignoring diff recommended. X-Git-Tag: 1.31.0-rc.0~32062 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=d9bcf39e348a26098dc8337fa87279bc960efd47;p=lhc%2Fweb%2Fwiklou.git Convert the if into an early exit. Whitespace ignoring diff recommended. --- diff --git a/includes/Article.php b/includes/Article.php index 1ec33b3892..48516e5f12 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1831,25 +1831,25 @@ class Article { // Delete if changing from redirect to non-redirect $isRedirect = !is_null( $redirectTitle ); - if ( $isRedirect || is_null( $lastRevIsRedirect ) || $lastRevIsRedirect !== $isRedirect ) { - wfProfileIn( __METHOD__ ); - if ( $isRedirect ) { - $this->insertRedirectEntry( $redirectTitle ); - } else { - // This is not a redirect, remove row from redirect table - $where = array( 'rd_from' => $this->getId() ); - $dbw->delete( 'redirect', $where, __METHOD__ ); - } - - if ( $this->getTitle()->getNamespace() == NS_FILE ) { - RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $this->getTitle() ); - } - wfProfileOut( __METHOD__ ); + if ( !$isRedirect && !is_null( $lastRevIsRedirect ) && $lastRevIsRedirect === $isRedirect ) { + return true; + } + + wfProfileIn( __METHOD__ ); + if ( $isRedirect ) { + $this->insertRedirectEntry( $redirectTitle ); + } else { + // This is not a redirect, remove row from redirect table + $where = array( 'rd_from' => $this->getId() ); + $dbw->delete( 'redirect', $where, __METHOD__ ); + } - return ( $dbw->affectedRows() != 0 ); + if ( $this->getTitle()->getNamespace() == NS_FILE ) { + RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $this->getTitle() ); } + wfProfileOut( __METHOD__ ); - return true; + return ( $dbw->affectedRows() != 0 ); } /**