Florianschmidtwelzow has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/333365 )
Change subject: Simplify function Captcha::loadText for readability ...................................................................... Simplify function Captcha::loadText for readability * Move globals definition to the top of the function * no else needed, if the if part returns always returns something I came across this while reading the code in I3a56e4252bbb810c1cf5c632ece9a8edf91c8424 Change-Id: I826a41457667e886b65a07d9d9edc5daec7d1013 --- M SimpleCaptcha/Captcha.php 1 file changed, 10 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ConfirmEdit refs/changes/65/333365/1 diff --git a/SimpleCaptcha/Captcha.php b/SimpleCaptcha/Captcha.php index 7de4838..82ad84b 100644 --- a/SimpleCaptcha/Captcha.php +++ b/SimpleCaptcha/Captcha.php @@ -1232,19 +1232,20 @@ * @access private */ function loadText( $title, $section, $flags = Revision::READ_LATEST ) { + global $wgParser; + $rev = Revision::newFromTitle( $title, false, $flags ); if ( is_null( $rev ) ) { return ""; - } else { - $content = $rev->getContent(); - $text = ContentHandler::getContentText( $content ); - if ( $section != '' ) { - global $wgParser; - return $wgParser->getSection( $text, $section ); - } else { - return $text; - } } + + $content = $rev->getContent(); + $text = ContentHandler::getContentText( $content ); + if ( $section !== '' ) { + return $wgParser->getSection( $text, $section ); + } + + return $text; } /** -- To view, visit https://gerrit.wikimedia.org/r/333365 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I826a41457667e886b65a07d9d9edc5daec7d1013 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ConfirmEdit Gerrit-Branch: master Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits