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

Change subject: Limit static scope a bit further
......................................................................


Limit static scope a bit further

Change-Id: I8a224e1d1c867c324d882d5a6ee9f26ee195d3d5
---
M includes/Searcher.php
1 file changed, 5 insertions(+), 9 deletions(-)

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



diff --git a/includes/Searcher.php b/includes/Searcher.php
index 8ab8b55..efc6899 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -46,11 +46,6 @@
        const MAX_TITLE_SEARCH = 255;
 
        /**
-        * @var null|array template names to boost factors.  lazily initialized 
and defaulting to null.
-        */
-       private static $defaultBoostTemplates = null;
-
-       /**
         * @var integer search offset
         */
        private $offset;
@@ -944,20 +939,21 @@
        }
 
        private static function getDefaultBoostTemplates() {
-               if ( self::$defaultBoostTemplates === null ) {
+               static $defaultBoostTemplates = null;
+               if ( $defaultBoostTemplates === null ) {
                        $source = wfMessage( 'cirrussearch-boost-templates' 
)->inContentLanguage();
                        if( $source->isDisabled() ) {
-                               self::$defaultBoostTemplates = array();
+                               $defaultBoostTemplates = array();
                        } else {
                                $lines = explode( "\n", $source->plain() );
                                $lines = preg_replace( '/#.*$/', '', $lines ); 
// Remove comments
                                $lines = array_map( 'trim', $lines );          
// Remove extra spaces
                                $lines = array_filter( $lines );               
// Remove empty lines
-                               self::$defaultBoostTemplates = 
self::parseBoostTemplates(
+                               $defaultBoostTemplates = 
self::parseBoostTemplates(
                                        implode( ' ', $lines ) );               
   // Now parse the templates
                        }
                }
-               return self::$defaultBoostTemplates;
+               return $defaultBoostTemplates;
        }
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8a224e1d1c867c324d882d5a6ee9f26ee195d3d5
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: jenkins-bot <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to