From 17f2fe778f1f027ff93e5a4ac691fea10ce72a48 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 25 Aug 2013 09:26:20 +0200 Subject: [PATCH] Removed unneeded else branches in DifferenceEngine The "if" always exit, so there is no need to use else branches; also added blank lines for better readability. Change-Id: I7d8321652a90fbba99e53fa0c1fe018492883b8a --- includes/diff/DifferenceEngine.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 3ff5c986cb..e73754dafe 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -1181,26 +1181,29 @@ class DifferenceEngine extends ContextSource { function loadText() { if ( $this->mTextLoaded == 2 ) { return true; - } else { - // Whether it succeeds or fails, we don't want to try again - $this->mTextLoaded = 2; } + // Whether it succeeds or fails, we don't want to try again + $this->mTextLoaded = 2; + if ( !$this->loadRevisionData() ) { return false; } + if ( $this->mOldRev ) { $this->mOldContent = $this->mOldRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ); if ( $this->mOldContent === null ) { return false; } } + if ( $this->mNewRev ) { $this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ); if ( $this->mNewContent === null ) { return false; } } + return true; } @@ -1212,13 +1215,16 @@ class DifferenceEngine extends ContextSource { function loadNewText() { if ( $this->mTextLoaded >= 1 ) { return true; - } else { - $this->mTextLoaded = 1; } + + $this->mTextLoaded = 1; + if ( !$this->loadRevisionData() ) { return false; } + $this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ); + return true; } } -- 2.20.1