jenkins-bot has submitted this change and it was merged.

Change subject: Fix undefined index help in search profiles
......................................................................


Fix undefined index help in search profiles

Same code as in I17cc79c

Change-Id: Idcb59c6b0a937d7ed7c030b809a6d41ab68f9d4d
---
M classes/Hooks.php
1 file changed, 14 insertions(+), 1 deletion(-)

Approvals:
  Alex Monk: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/classes/Hooks.php b/classes/Hooks.php
index ffc7757..8140150 100644
--- a/classes/Hooks.php
+++ b/classes/Hooks.php
@@ -334,7 +334,20 @@
                        ),
                );
 
-               $profiles = wfArrayInsertAfter( $profiles, $insert, 'help' );
+               // Insert translations before 'all'
+               $index = array_search( 'all', array_keys( $profiles ) );
+
+               // Or just at the end if all is not found
+               if ( $index === false ) {
+                       wfWarn( '"all" not found in search profiles' );
+                       $index = count( $profiles );
+               }
+
+               $profiles = array_merge(
+                       array_slice( $profiles, 0, $index ),
+                       $insert,
+                       array_slice( $profiles, $index )
+               );
 
                return true;
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/141118
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idcb59c6b0a937d7ed7c030b809a6d41ab68f9d4d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LiquidThreads
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: Alex Monk <kren...@wikimedia.org>
Gerrit-Reviewer: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to