diff options
author | Tim Starling <tstarling@users.mediawiki.org> | 2009-06-28 07:11:43 +0000 |
---|---|---|
committer | Tim Starling <tstarling@users.mediawiki.org> | 2009-06-28 07:11:43 +0000 |
commit | 23cfebd3d25fcdb0717daad5982fc9f36aa5a1b5 (patch) | |
tree | 22ebfa82bd29e712575493c67e95d5230d21f08b /includes/HTMLFileCache.php | |
parent | 3f7fc6828896d2fa115f9bc83f0d0524e4714e88 (diff) | |
download | mediawikicore-23cfebd3d25fcdb0717daad5982fc9f36aa5a1b5.tar.gz mediawikicore-23cfebd3d25fcdb0717daad5982fc9f36aa5a1b5.zip |
* Introduced a new system for localisation caching. The system is based around fast fetches of individual messages, minimising memory overhead and startup time in the typical case. It handles both core messages (formerly in Language.php) and extension messages (formerly in MessageCache.php). Profiling indicates a significant win for average throughput.
* The serialized message cache, which would have been redundant, has been removed. Similar performance characteristics can be achieved with $wgLocalisationCacheConf['manualRecache'] = true;
* Added a maintenance script rebuildLocalisationCache.php for offline rebuilding of the localisation cache.
* Extension i18n files can now contain any of the variables which can be set in Messages*.php. It is possible, and recommended, to use this feature instead of the hooks for special page aliases and magic words.
* $wgExtensionAliasesFiles, LanguageGetMagic and LanguageGetSpecialPageAliases are retained for backwards compatibility. $wgMessageCache->addMessages() and related functions have been removed. wfLoadExtensionMessages() is a no-op and can continue to be called for b/c.
* Introduced $wgCacheDirectory as a default location for the various local caches that have accumulated. Suggested $IP/cache as a good place for it in the default LocalSettings.php and created this directory with a deny-all .htaccess.
* Patched Exception.php to avoid using the message cache when an exception is thrown from within LocalisationCache, since this tends to fail horribly.
* Removed Language::getLocalisationArray(), Language::loadLocalisation(), Language::load()
* Fixed FileDependency::__sleep()
* In Cdb.php, fixed newlines in debug messages
In MessageCache::get():
* Replaced calls to $wgContLang capitalisation functions with plain PHP functions, reducing the typical case from 99us to 93us. Message cache keys are already documented as being restricted to ASCII.
* Implemented a more efficient way to filter out bogus language codes, reducing the "foo/en" case from 430us to 101us
* Optimised wfRunHooks() in the typical do-nothing case, from ~30us to ~3us. This reduced MessageCache::get() typical case time from 93us to 38us.
* Removed hook MessageNotInMwNs to save an extra 3us per cache hit. Reimplemented the only user (LocalisationUpdate) using the new hook LocalisationCacheRecache.
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/52503
Diffstat (limited to 'includes/HTMLFileCache.php')
-rw-r--r-- | includes/HTMLFileCache.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/includes/HTMLFileCache.php b/includes/HTMLFileCache.php index 68cafa242c18..d205624e1aeb 100644 --- a/includes/HTMLFileCache.php +++ b/includes/HTMLFileCache.php @@ -14,6 +14,7 @@ * - $wgCachePages * - $wgCacheEpoch * - $wgUseFileCache + * - $wgCacheDirectory * - $wgFileCacheDirectory * - $wgUseGzip * @@ -30,7 +31,16 @@ class HTMLFileCache { public function fileCacheName() { if( !$this->mFileCache ) { - global $wgFileCacheDirectory, $wgRequest; + global $wgCacheDirectory, $wgFileCacheDirectory, $wgRequest; + + if ( $wgFileCacheDirectory ) { + $dir = $wgFileCacheDirectory; + } elseif ( $wgCacheDirectory ) { + $dir = "$wgCacheDirectory/html"; + } else { + throw new MWException( 'Please set $wgCacheDirectory in LocalSettings.php if you wish to use the HTML file cache' ); + } + # Store raw pages (like CSS hits) elsewhere $subdir = ($this->mType === 'raw') ? 'raw/' : ''; $key = $this->mTitle->getPrefixedDbkey(); |