Commit graph

69 commits

Author SHA1 Message Date
Aaron Schulz
bfbb9928e5 Use $IP instead of hard-coded relative path.
Change-Id: I6e631116ca73896527eee7a607204071c1467414
2012-12-14 15:05:42 -08:00
Aaron Schulz
1da33a49a0 Removed references to DB ignoreErrors() function.
Change-Id: I9441d897d45bca189c17b8bcca4ea7b3469af8b0
2012-12-11 11:24:12 -08:00
Max Semenik
c6801f4b08 (bug 38897) Fix unhandled exception when visiting e.g. MediaWiki:Somemessage/0
Change-Id: I9876e4fb21c2a1a3a0a14bff05633c7aef6a3fd3
2012-12-07 17:57:47 +00:00
umherirrender
e2ef09af0f Remove unneeded third param
the 'messages' are already part of 'preload', so there is no need for
that. Last changes there: r101507/r102304

Change-Id: I6c9daa3c46bd7f1db851cc4620ecf59f81e6f9aa
2012-11-10 17:23:32 +01:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
Tim Starling
d76e670c76 Fixed fallback behaviour for plural rules
Fallbacks didn't work at all for the new plural rule system. I fixed it
by moving the getPluralRules() and getCompiledPluralRules() calls near
to the readPHPFile() calls, before merging is done. Then I factored out
the resulting code to readSourceFilesAndRegisterDeps().

* Removed pluralRules from mergeableMapKeys, it isn't one
* Added compiledPluralRules to allKeys so that it will be merged
* When a language is not present in the CLDR XML files, return null from
  getPluralRules() and getCompiledPluralRules() so that the fallback
  rules won't be overridden with an empty array. Normalised it back to
  an empty array in the unlikely event that there is no plural data in
  the fallback sequence at all, even in English.
* Fixed private function, "protected" is the way to say private here.

Change-Id: I3a008ef7f6ed7aaa15ad25ad796f7a2b8f827fa2
2012-08-29 07:57:45 +00:00
Tim Starling
fceb9bcb49 CLDR plural parser in PHP
Wrote a CLDR plural rule parser to replace the eval()-based one from
I58a9cdfe. It converts the infix notation of the XML files to a
sanitized RPN notation, referred to in external interfaces as the
"compiled" form. The RPN notation is cached and then executed by a
fast non-validating evaluator.

Timings for the largest rule in the XML file are ~1.2ms for
compilation and ~200us for execution.

Also:
* Lazy-load the plural rules when recache() requests them, instead of
  loading them for every request.
* Language::convertPlural() needs integer keys, and CLDR only gives
  string keys. The previous code was not mapping them so it didn't work
  at all. I just mapped them in the order they appear in the XML file,
  i.e. the first rule becomes MediaWiki's $pluralForm=0, the second
  becomes $pluralForm=1, etc. Not sure if there is a more rigorous way
  to do it.

Change-Id: I65ee788c1a8e5ee2ede2091990d86eb722749dd3
2012-08-22 12:55:50 +00:00
Santhosh Thottingal
bbbcf089db CLDR Plural rules based plural form calculation
* Use the plurals.xml of CLDR for the plural rules of languages
* Use plurals-mediawiki.xml to override or extend the rules inside MW
* Remove the convertPlural method in each LanguageXX.php
* Parse and load the xml files in LocalisationCache
* Use the CLDRPluralRuleEvaluator.php for parsing the cldr plural rules
  (This is taken from Translate extension and might require a replacement
   parser without using eval)
* Add getPluralRules() to make the CLDR plural rules available to JS.

PS3: More method documentation, cleanup

Change-Id: I58a9cdfe60c7b9027bf031c91370472054f04ae2
2012-08-16 11:45:17 +10:00
Alexandre Emsenhuber
a682b7335a Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I0db3461139284edcb6ac02923eb83d54e6756ffb
2012-05-12 22:33:51 +02:00
Alexandre Emsenhuber
96a8b6b979 Pass __METHOD__ to DatabaseBase::begin(), DatabaseBase::commit() and DatabaseBase::rollback() 2012-02-24 14:47:49 +00:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +00:00
Sam Reed
0a626db6e1 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 19:29:36 +00:00
Siebrand Mazeland
a63b207fff Bye, bye $wgExtensionAliasesFiles (deprecated in 1.16). 2011-12-25 23:09:26 +00:00
Roan Kattouw
3938e515ac Followup r101507: don't automatically use APC for the localization cache if it is available. I've expressed reservations in my CR comments (issues abound wherever maintenance scripts, server farms or manualRecache are involved), but the real reason is that three people (Siebrand on CR, Antoine/hashar in person and Rusty Burchfield on bug 32602) have reported problems with the APC LC, and had to set $wgLocalisationCacheConf['store'] = 'files'; explicitly to get LC to work again. 2011-11-23 13:12:22 +00:00
Chad Horohoe
de20376cc1 (bug 29747) eAccelerator shared memory caching has been removed since it is now disabled by default and is buggy. APC, XCache and WinCache are not affected.
As Brion points out in <https://bugzilla.wikimedia.org/show_bug.cgi?id=29747#c7>, the shared memory functions are very buggy. In fact, eAccelerator has disabled the shared memory functions by default for awhile now. I didn't touch APC, XCache or WinCache, but I imagine they suffer from the same problems.
2011-11-22 22:56:00 +00:00
Antoine Musso
4d03992a67 revert r103694 r103687
Need to find a better way to fix that cache issue :(
2011-11-19 17:00:57 +00:00
Antoine Musso
4802134f10 closing a store is only available for CDB type
follow up r103684
2011-11-19 16:31:42 +00:00
Antoine Musso
7fa9b4cf40 add possibility to close a LCStore_CDB
also close an LCStore_CDB after checking for expiry
2011-11-19 16:23:52 +00:00
Siebrand Mazeland
490bc418cf Revert r102650, r102640. Caused breakage on translatewiki.net:
No localisation cache found for English. Please run maintenance/rebuildLocalisationCache.php.

Backtrace:

#0 /www/w/includes/LocalisationCache.php(288): LocalisationCache->initLanguage('en')
#1 /www/w/includes/LocalisationCache.php(223): LocalisationCache->loadItem('en', 'specialPageAlia...')
#2 /www/w/languages/Language.php(2630): LocalisationCache->getItem('en', 'specialPageAlia...')
#3 /www/w/includes/SpecialPageFactory.php(211): Language->getSpecialPageAliases()
#4 /www/w/includes/SpecialPageFactory.php(247): SpecialPageFactory::getAliasList()
#5 /www/w/includes/Title.php(4186): SpecialPageFactory::resolveAlias('LanguageStats/n...')
#6 /www/w/includes/Wiki.php(154): Title->isSpecial('Badtitle')
#7 /www/w/includes/Wiki.php(605): MediaWiki->performRequest()
#8 /www/w/includes/Wiki.php(524): MediaWiki->main()
#9 /www/w/index.php(58): MediaWiki->run()
#10 {main}
2011-11-10 19:01:41 +00:00
Antoine Musso
8fd6abd408 correct variable name
This is caused by r102640, I have moved some code to a new function
and forgot to rename the internal variable name to match the function
parameter.
2011-11-10 13:14:52 +00:00
Antoine Musso
7e9f50387f move store writing out of recache()
Writing to cache is now handled in a new method. That makes recache() a bit
shorter and easier to read. Since there is no point in writing data to
/dev/null , return early in such a case (ie if store is LCStore_Null).
2011-11-10 11:56:52 +00:00
Aaron Schulz
5199bd7f84 Fixed misleading getItem() comments...things like arrays or FileDependency objects and what not can be returned 2011-11-09 22:35:31 +00:00
Mark A. Hershberger
2d1ccd9ba1 re Bug #29283, r101507: Apply Vitaliy Filippov's followup fix:
.... I've found another bug with the implementation - it also
    relies on the presence of key '...:preload' and doesn't check it
    when checking for the expired cache, which can lead to "Invalid or
    missing localisation cache" exceptions.
2011-11-07 17:50:54 +00:00
Sam Reed
b23b2b0d24 Fix fixme on r101177 2011-11-03 20:55:57 +00:00
Mark A. Hershberger
e0963b7ecc followup r101490, remove extra tabs after talking to Nikerabbit. 2011-11-03 13:57:25 +00:00
Mark A. Hershberger
3f65609b13 follow up r101496 — ^demon's comments re style 2011-11-01 18:49:38 +00:00
Mark A. Hershberger
beb8906557 Re-apply Vitaliy Filippov's patch from Bug #29283 with a modification
to make it work when no ACCEL cache is available.
2011-11-01 18:31:04 +00:00
Roan Kattouw
1fd659cc5b Revert r101492, broken, see CR. Also revert followup r101496. 2011-11-01 16:51:31 +00:00
Mark A. Hershberger
1e82e0ff29 followup 101492 — make it actually work. 2011-11-01 16:29:49 +00:00
Mark A. Hershberger
461b7885d8 Apply Vitaliy Filippov's patch from Bug #29283 with some small style mods 2011-11-01 16:10:44 +00:00
Mark A. Hershberger
1323554417 Style fixups 2011-11-01 16:07:09 +00:00
Sam Reed
962644437c Followup r101161 having array() doesn't work so well with isset, changing to null 2011-10-28 19:17:44 +00:00
Sam Reed
450814de00 More documentation updates 2011-10-28 18:11:47 +00:00
Santhosh Thottingal
88bdda41b1 Add support for Number grouping(commafy) based on CLDR number grouping patterns like ##,##,###.
Testcases for Malayalam and Dutch
Number grouping Patterns added to Ml and Hi Message classes.
Reference: Bug 29495
2011-09-22 05:01:19 +00:00
Robin Pepermans
3dfb64f9d7 Replace localisation cache check removed in r91432 with another check 2011-09-09 12:49:40 +00:00
Siebrand Mazeland
7622f51870 Whitespace and formatting updates. 2011-08-25 14:45:38 +00:00
Niklas Laxström
4fa97663e7 Make the language recaching non-recursive and load the data directly.
This might be a bit slower, but avoids problems with cyclic language fallbacks.
Followup r94907
2011-08-22 08:12:10 +00:00
Niklas Laxström
cd47443fcf Fu r94907 - also update localisation cache, which accesses the fallback variable directly
Fixes bug 30456
2011-08-19 09:02:35 +00:00
Sam Reed
66e01d1bb7 Adding __METHOD__ to parameters passed to wfMkdirParents() 2011-07-25 22:01:19 +00:00
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