From: Domas Mituzas Date: Mon, 4 Oct 2004 20:36:11 +0000 (+0000) Subject: initial support for partial message cache, the way to have separated message X-Git-Tag: 1.5.0alpha1~1660 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=c5b7002917ecfebd66d7a8f50ebb48699a279b85;p=lhc%2Fweb%2Fwiklou.git 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... --- 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 @@ +