From d9bcf39e348a26098dc8337fa87279bc960efd47 Mon Sep 17 00:00:00 2001 From: Platonides Date: Thu, 10 Feb 2011 17:13:12 +0000 Subject: [PATCH] Convert the if into an early exit. Whitespace ignoring diff recommended. --- includes/Article.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) 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 ); } /** -- 2.20.1