jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/390357 )
Change subject: search.wikimedia.org: Clean up result returning logic ...................................................................... search.wikimedia.org: Clean up result returning logic - We don't need to use empty(), a loose boolean check suffices - Swap the order here, what good is outputting the note about no results if we've already tried to output them Change-Id: Ia4e3ee9e79c4e85b9631a82bca77434b1e44e63f --- M docroot/search.wikimedia.org/index.php 1 file changed, 6 insertions(+), 6 deletions(-) Approvals: Krinkle: Looks good to me, but someone else must approve Chad: Looks good to me, approved jenkins-bot: Verified Zoranzoki21: Looks good to me, but someone else must approve diff --git a/docroot/search.wikimedia.org/index.php b/docroot/search.wikimedia.org/index.php index ac20beb..95f76b8 100644 --- a/docroot/search.wikimedia.org/index.php +++ b/docroot/search.wikimedia.org/index.php @@ -94,14 +94,14 @@ "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"></head>\n" . "<body>"; -foreach ( $results as $result ) { - $htmlResult = htmlspecialchars( str_replace( ' ', '_', $result ) ); - print "<div><span class=\"language\">$lang</span>:<span class=\"key\">$htmlResult</span></div>"; -} - -if ( empty( $results ) ) { +if ( !$results ) { $htmlSearch = htmlspecialchars( $search ); print "<p>No entries found for \"$lang:$htmlSearch\"</p>"; +} else { + foreach ( $results as $result ) { + $htmlResult = htmlspecialchars( str_replace( ' ', '_', $result ) ); + print "<div><span class=\"language\">$lang</span>:<span class=\"key\">$htmlResult</span></div>"; + } } print "</body></html>\n"; -- To view, visit https://gerrit.wikimedia.org/r/390357 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia4e3ee9e79c4e85b9631a82bca77434b1e44e63f Gerrit-PatchSet: 2 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: Urbanecm <martin.urba...@wikimedia.cz> Gerrit-Reviewer: Zoranzoki21 <zorandori4...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits