This is not a real fix for the cause of the bug (which is a
pcre.recursion_limit that is far too low), but I do wonder
about the efficiency of using a regexp to test for valid
UTF-8 encoding. After all the regexp has to be compiled first
into a state machine.
Patch set 2: Php unit test for Language.checkTitleEncoding
Patch set 3: benchmark
Patch set 4: add benchmark for non-capturing subgroup in regexp, and
since that's faster than a capturing subgroup, use it in
checkTitleEncoding() in the regexp branch.
Patch set 5: use Tim's suggestion (once-only pattern) in the regexp
branch. Also add to benchmark.
Change-Id: I551f096921d4c9c57cbcb091b80ab5970ca86a9b
The Language::formatDuration() method introduced by this patch let us
easily render an amount of seconds for easier human reading.
$ maintenance/eval.php
> var_dump( $wgLang->formatDuration( 1000 );
string(25) "16 minutes and 40 seconds"
Also ran rebuildLanguage.php on Siebrands request
Change-Id: If287fb10e897d3d2374cf6eeae3bc5be00cdfc01
- More tests, test comments
(This is the same as r114049.)
Patch set 2: Squash in missed test file
Change-Id: Icaf7fdd11499c64c42b46e442c158f22309345a7
This reverts the SpecialCachedPage and formatDuration sagas, with some collateral damage here and there. All of these revisions are tagged with 'gerritmigration' and will be resubmitted into Gerrit after the Gerrit switchover. See also http://lists.wikimedia.org/pipermail/wikitech-l/2012-March/059124.html
Make Language::formatNum() handle TB through YB
Rewrote code to be simpler and less indenty
Though, something like formatBitrate might be be better in future... We'll see!
This patch is a PARTIAL merge of /branches/nikola/phase3 ::
r85224 avoid double conversion when text already use the correct variant
r85239 minor fixes to previous
r85308 documentation (@since 1.18 update to 1.19)
r101359 guessVariant doc + boolean typecast
r101369 tests
r103131 additional test
Test plan:
==========
$ ./phpunit.php --filter LanguageSr
PHPUnit 3.6.3 by Sebastian Bergmann.
Configuration read from /srv/trunk/tests/phpunit/suite.xml
.....
Time: 1 second, Memory: 78.50Mb
OK (5 tests, 19 assertions)
$
* Add a $noAbbrevs parameter that causes the 'seconds', 'minutes', etc. messages to be used instead of the 'seconds-abbrev', 'minutes-abbrev', etc. messages
* Add the 'seconds', 'minutes', 'hours' and 'days' messages
* Change the -abbrev messages to take a parameter rather than having the number prepended to them. This is for compatibility with 'seconds' et al, which need the parameter for {{PLURAL:}}. It also generally makes more sense. This does BREAK the messages in non-English languages that override them; Niklas told me to leave this alone and ping the TranslateWiki folks
* Introduce an 'ago' message for '$1 ago'. Not currently used in core, but I want to use it in an extension and it seemed stupid not to have such a thing in core.
* Refactor the function to use message objects and pass the number as a parameter
* Add tests! They exposed a subtle bug in my first iteration; all hail tests!