Commit graph

30 commits

Author SHA1 Message Date
Robin Pepermans
81446abcdc (see bug 29712) Removing the defaultUserOptionOverrides in MessagesXx.php because it is broken (and has been for a long time) and secondly, it is only used for things that can be done otherwise:
* 'editfont' => 'sans-serif'; -> trivial (can be set in CSS)
* 'underline' => 0; by languages written in scripts that are hard to read with underlines -> now set in shared.css, which makes it work also when they are used as interface language (note that [lang="xx"] is not yet present on wikitext content by default but will be soon as part of my work on RTL improvements)
* 'quickbar' => 2; by RTL languages. For this, I introduced a new option (5) that sets left/right according to the directionality of your interface language (and automatic is better than setting it in MessagesXx files!). Note that the broken feature was in this case "corrected" by CSS flipping, causing preferences to say "left" while it was actually "right". This commit fixes that bug as well.
Third, it actually would have made more sense to have it them load for wgLang instead of wgContLang, but that's not possible because wgLang is itself dependent on preferences
2011-07-05 01:26:49 +00:00
Sam Reed
296f3d3f4f And even more documentation 2011-05-28 18:59:42 +00:00
Mark A. Hershberger
c152979d1f clean up eol w/s 2011-04-25 02:20:04 +00:00
Brion Vibber
8ee5e02054 Followup to r85706 and friends: now that Math messages have been moved to extension, move out the settings list and constants.
* MW_MATH_* constants are now defined in Math extension
* Language::getMathNames() is removed
* mathNames section in message files is removed
* A hardcoded preference override in refreshLinks moved to MaintenanceRefreshLinksInit hook
2011-04-09 19:57:35 +00:00
Tim Starling
1e67922842 Followup for r81340:
* Allow any language code which consists entirely of valid title characters, and does not contain any path-traversal characters, to be customised via the uselang parameter. Language::isValidCode() represents this concept. 
* Add some shortcuts preventing Language and LocalisationCache from looking for localisation files for a language code which does not follow the usual form of language codes in MediaWiki, i.e. /[a-z-]*/. This concept is represented by Language::isValidBuiltInCode().
* Do not allow colon characters in file names, per Platonides' suggestion on CR.
2011-02-28 03:15:39 +00:00
Tim Starling
3bc410efa7 * Fix for r81960: List the local magic word synonyms first, so that they will be returned by $magic->getSynonym( 0 ). Apply array_values() to fix up the keys, potentially corrupted by array_unique().
* In MagicWord::initRegex(), put the longest synonyms first in the alternation. This means that when one synonym is an initial substring of another, the longest one will match in precedence, which is generally in line with user expectations.
2011-02-16 07:24:36 +00:00
Niklas Laxström
7694c67c99 * (bug 17160) Gender specific display text for User namespace
Second attempt for this thing..
2011-02-12 20:40:40 +00:00
Tim Starling
9a38d22579 Since 1.17 a whole lot of extensions have sprouted *.i18n.magic.php files. Most of these files have entries which erroneously omit the English synonym for a magic word. This breaks the extension completely when an affected language is selected.
This patch automatically includes synonyms from the fallback localisation, and prevents the case flag from being overridden, thus making extensions resistant to translator error.
2011-02-11 11:53:00 +00:00
Alexandre Emsenhuber
51c6afc751 * Replaced $wgMessageCache by MessageCache::singleton(); since we only use one instance of this class (as for ParserCache, LinkCache)
* MessageCache::singleton() calls wfGetMessageCacheStorage() directly instead of using $messageMemc, just in case this would be called before that variable is set
* Per TimStarling: also removed deprecated methods in MessageCache class: addMessages() and related, [get|set|enable|disable]Transform(), loadAllMessages(), loadMessageFile() and some others. Same for the legacyData stuff in LocalisationCache that was only used by MessageCache::addMessages() and related. 
* Converted remaining extensions
2011-01-26 15:42:04 +00:00
Sam Reed
7bff03b3ad Remove public from interface defintion, as decleration in an interface is not valid 2010-12-15 11:30:54 +00:00
Trevor Parscal
ea8b855c2e Followup to r72349: fix database error caused by update.php indirectly (via LocalisationCache::recache() and MessageBlobStore::clear()) trying to clear out the msg_resource table before it's even created it. 2010-09-04 07:54:55 +00:00
Roan Kattouw
32377424b9 Merging resourceloader branch into trunk. Full documentation is at http://www.mediawiki.org/wiki/ResourceLoader and a general overview has been posted on wikitech-li <http://lists.wikimedia.org/pipermail/wikitech-l/2010-September/049253.html>. One important change is that all JS is now loaded at the bottom, so any scripts assuming things from wikibits or whatever are present will fail. 2010-09-04 04:00:09 +00:00
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