From dde3967d284f5c39620910423bb85e47aee43a9c Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 21 Aug 2004 09:51:01 +0000 Subject: [PATCH] Don't include SearchEngine.php when it's not used. Saves about 180k of memory at runtime. --- includes/SearchUpdate.php | 1 + includes/Setup.php | 1 - includes/SpecialSearch.php | 1 + includes/Title.php | 1 + index.php | 3 ++- 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/SearchUpdate.php b/includes/SearchUpdate.php index 9cbbb61aad..fd0a10ad38 100644 --- a/includes/SearchUpdate.php +++ b/includes/SearchUpdate.php @@ -30,6 +30,7 @@ class SearchUpdate { if( $wgDisableSearchUpdate || !$this->mId ) { return false; } + require_once( 'SearchEngine.php' ); $lc = SearchEngine::legalSearchChars() . "&#;"; $db =& wfGetDB( DB_MASTER ); $searchindex = $db->tableName( 'searchindex' ); diff --git a/includes/Setup.php b/includes/Setup.php index ee26068403..363f4c2269 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -55,7 +55,6 @@ require_once( 'Article.php' ); require_once( 'MagicWord.php' ); require_once( 'memcached-client.php' ); require_once( 'Block.php' ); -require_once( 'SearchEngine.php' ); require_once( 'MessageCache.php' ); require_once( 'BlockCache.php' ); require_once( 'Parser.php' ); diff --git a/includes/SpecialSearch.php b/includes/SpecialSearch.php index 9ce1ca0651..ad815a1309 100644 --- a/includes/SpecialSearch.php +++ b/includes/SpecialSearch.php @@ -21,6 +21,7 @@ function wfSpecialSearch( $par ) { global $wgOutput; + require_once( 'SearchEngine.php' ); $searchEngine = new SearchEngine( $par ); $searchEngine->showResults(); } diff --git a/includes/Title.php b/includes/Title.php index 2b4e562324..198d5f9119 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -207,6 +207,7 @@ class Title { # Takes a namespace index and a text-form main part /* static */ function indexTitle( $ns, $title ) { global $wgDBminWordLen, $wgLang; + require_once( 'SearchEngine.php' ); $lc = SearchEngine::legalSearchChars() . '&#;'; $t = $wgLang->stripForSearch( $title ); diff --git a/index.php b/index.php index b22c63b65d..ee3e56d51b 100644 --- a/index.php +++ b/index.php @@ -60,7 +60,8 @@ if ( !is_null( $wgTitle ) && !$wgTitle->userCanRead() ) { exit; } -if ( $search = $wgRequest->getText( 'search' ) ) { +if( $search = $wgRequest->getText( 'search' ) ) { + require_once( 'SearchEngine.php' ); $wgTitle = Title::makeTitle( NS_SPECIAL, "Search" ); $searchEngine = new SearchEngine( $search ); if( $wgRequest->getVal( 'fulltext' ) || -- 2.20.1