Commit graph

18 commits

Author SHA1 Message Date
Roan Kattouw
e46c9a91fd Build preload l10ncache after running hooks, not before, so extension changes (by e.g. LocalisationUpdate) to preloaded messages get picked up. 2010-03-08 14:43:02 +00:00
Tim Starling
e667605c8a Made Special:Allmessages many times faster for a typical installation, by taking advantage of the message name list available from LocalisationCache to avoid unnecessary message loads. Now it only loads messages that are on the current page being displayed. 2010-01-06 05:48:05 +00:00
Tim Starling
33ce9783f5 (bug 20837) Don't give a PHP notice when getSubitem() calls loadSubitem() which causes the whole item to be loaded. In this case there is no negative cache value stored so we need to use isset(). It was handled already for the case where the item was already loaded at function entry, but not for the case where the item is loaded halfway through loadSubitem(). 2010-01-06 04:08:59 +00:00
Max Semenik
8c4e1d2a57 Fixed variable name in error message 2009-11-13 11:16:42 +00:00
Roan Kattouw
7c7909f108 (bug 20773) Disabling LocalisationUpdate breaks stuff. Added a check that verifies each dependency object is a CacheDependency before using it, and considers the cache expired otherwise. 2009-09-23 13:51:47 +00:00
Tim Starling
d26d659ef1 Fix disabling of APC cache when loading message files: apc.enabled has been PHP_INI_SYSTEM since 3.0.13 but apc.cache_by_default works. This reduces the required APC cache space by about half on my test wiki, from 20MB to 10MB. 2009-09-04 03:41:25 +00:00
Tim Starling
e3b87e0916 Fixed a bug whereby if a recache is triggered via getSubitem(), the subitem requested will be saved into the process cache as missing. 2009-09-04 02:40:53 +00:00
Alexandre Emsenhuber
b274afeef5 * (bug 20464) Force manual recaching to false in LocalisationCache::disableBackend() since otherwise an Exception with the message "No localisation cache found for English. Please run maintenance/rebuildLocalisationCache.php." is thrown each time update.php is executed. 2009-09-02 20:16:26 +00:00
Brion Vibber
2afad5687f Change r52690 per suggestions on CodeReview: rearrange from boolean OR mysteriously changed to binary OR to a nice plain if statement. 2009-08-22 21:53:57 +00:00
Tim Starling
84b6a177f1 * Converted BagOStuff.php from the style of memcached-client.php to the standard MediaWiki style, including camel case, using protected visibility instead of initial underscore, abstract functions instead of stubs, stylize.php.
* In SqlBagOStuff, ignore errors due to a read-only database, per my comments on CR r42796. Same for LocalisationCache. 
* Merged SqlBagOStuff and MediaWikiBagOStuff, that proved to be an awkward and unnecessary generalisation. Use the standard quoting wrapper functions instead of $db->query(). 
* Implemented atomic incr() and decr() functions for SqlBagOStuff. 
* Made incr() and decr() generally work roughly the same as it does in memcached, respecting negative steps instead of ignoring such operations. This allows decr() to be implemented in terms of incr().
* Per bug 11533, in MessageCache.php, don't retry 20 times on a cache failure, that's really memcached-specific and won't be useful for other cache types. It's not really very useful for memcached either.
* Moved MySQL-specific implementations of wasDeadlock() and wasErrorReissuable() to DatabaseMysql.
* Briefly tested page views with $wgReadOnly=read_only=1, fixed an error from Article::viewUpdates(). A CentralAuth fix will be in a subsequent commit.
2009-08-15 03:45:19 +00:00
Aaron Schulz
78edbb41d9 Follow-up r54968: this close() should be redundant now 2009-08-13 21:32:31 +00:00
Aaron Schulz
d4eff3e382 Fixed 'permission denied' cdb fatals (on windows at least) 2009-08-13 20:55:26 +00:00
Tim Starling
b6640b29e9 (bug 19574) LocalisationCache gets confused when external code deletes its store after it does its cache freshness check. Fix by reinitialising the cache after the DB setup. 2009-07-22 04:03:46 +00:00
Tim Starling
e1bc89771d * Added the ability to set the localisation cache directory specifically, overriding $wgCacheDirectory.
* Documented the issues with having multiple wikis share a localisation cache: they will fight each other if they have a different set of extensions.
2009-07-03 08:02:55 +00:00
Tim Starling
371eb5b6e7 (bug 19447) Disable the localisation store backend during install and update. 2009-07-03 06:56:46 +00:00
Tim Starling
1f79ae389d * Re-added $wgMessageCache->addMessages(), there are still some extensions (in and out of subversion) that rely on it. Call wfDeprecated().
* Made wfDeprecated() issue a notice only once for each function name instead of every time the function is called.
* Added exceptions for malformed keys input to $wgMessageCache->get(), per CR comments on r52503
* Fixed notice from MWException::useMessageCache()
2009-07-03 06:19:39 +00:00
Victor Vasiliev
94f09907d0 Replace || with |, so messages get merged regardless of $used value 2009-07-02 12:59:04 +00:00
Tim Starling
23cfebd3d2 * 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.
2009-06-28 07:11:43 +00:00