From c5b7002917ecfebd66d7a8f50ebb48699a279b85 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Mon, 4 Oct 2004 20:36:11 +0000 Subject: [PATCH] initial support for partial message cache, the way to have separated message cache objects by scope and/or severity, though by leaving rarely used messages standalone on db and/or cached daemons... --- includes/DefaultSettings.php | 3 +-- includes/MessageCache.php | 20 ++++++++++++++------ includes/MessageCacheHints.php | 16 ++++++++++++++++ 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 includes/MessageCacheHints.php diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index ea89a14488..f22f41b431 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -301,8 +301,7 @@ $wgTranslateNumerals = true; # For Hindi and Arabic use local numerals instead # Interface messages will be get from the database. $wgUseDatabaseMessages = true; $wgMsgCacheExpiry = 86400; - - +$wgPartialMessageCache = false; # Miscellaneous configuration settings # diff --git a/includes/MessageCache.php b/includes/MessageCache.php index e5a89e9453..fd6ae56500 100755 --- a/includes/MessageCache.php +++ b/includes/MessageCache.php @@ -117,16 +117,24 @@ class MessageCache } /** - * Loads all cacheable messages from the database + * Loads all or main part of cacheable messages from the database */ function loadFromDB() { - $fname = 'MessageCache::loadFromDB'; + global $wgPartialMessageCache; + $fname = 'MessageCache::loadFromDB'; $dbr =& wfGetDB( DB_SLAVE ); + $conditions = array( 'cur_is_redirect' => 0, + 'cur_namespace' => NS_MEDIAWIKI); + if ($wgPartialMessageCache) { + if (is_array($wgPartialMessageCache)) { + $conditions['cur_title']=$wgPartialMessageCache; + } else { + require_once("MessageCacheHints.php"); + $conditions['cur_title']=MessageCacheHints::get(); + } + } $res = $dbr->select( 'cur', - array( 'cur_title', 'cur_text' ), - array( 'cur_is_redirect' => 0, 'cur_namespace' => NS_MEDIAWIKI ), - $fname - ); + array( 'cur_title', 'cur_text' ), $conditions, $fname); $this->mCache = array(); for ( $row = $dbr->fetchObject( $res ); $row; $row = $dbr->fetchObject( $res ) ) { diff --git a/includes/MessageCacheHints.php b/includes/MessageCacheHints.php new file mode 100644 index 0000000000..d84e247bee --- /dev/null +++ b/includes/MessageCacheHints.php @@ -0,0 +1,16 @@ + -- 2.20.1