Commit graph

123 commits

Author SHA1 Message Date
Kunal Mehta 65de1d2f76 Add extension.json, empty PHP entry point
The $wgWikimediaJenkinsCI hack was moved into a "callback" function
in the hooks file.

Bug: T87955
Change-Id: Ibdb4397231ba9b0301a3b5872867cee5fa3906f3
2015-05-04 13:40:24 -07:00
Kunal Mehta b638c287f0 Move hooks into static class
Change-Id: I4867f57d70bd646213b8471dce9415f98b101ce9
2015-05-04 13:35:41 -07:00
Kunal Mehta 57fb178a53 Remove i18n shim
Change-Id: I16f3461fd81ba1a807ea5132a8a50f17a7e45a2c
2015-05-04 13:32:02 -07:00
umherirrender 082e682c95 Use Parser::SFH_OBJECT_ARGS class const
Instead of the global const

Change-Id: I3b32231d8237f936a0960449bfbf0b2e00fab9e8
2014-11-18 19:47:12 +01:00
jenkins-bot 016d9eac4b Merge "Add a TTL to #time and #timel output" 2014-06-24 22:54:38 +00:00
Niklas Laxström 7266842900 Style fixes
Change-Id: I0ed5048a52a042e67ee24824a418ec50d2993142
2014-06-21 18:49:27 +00:00
Jackmcbarn 334f1f0ee3 Add a TTL to #time and #timel output
Set the appropriate TTL when using #time or #timel. Needs I412febf3 and
I3f5a80aa in core to function.

Change-Id: I2e8b8918482b0b3f4adf154af795b6bb53b99497
2014-06-01 14:16:43 -04:00
Jackmcbarn f7bd89e435 Allow calling #expr from Lua without the parser
Add mw.ext.ParserFunctions.expr, allowing #expr to be used without needing
to use frame:callParserFunction.

Change-Id: I64c78fafad7da503b141efb36da64c3e3d8501a5
2014-05-05 17:58:40 +00:00
Siebrand Mazeland 472cc18534 Migrate to JSON i18n
Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php
with shim.

Change-Id: I14f32ccb8bcaf3d3c38b3267b1fcb2a2f611c424
2014-03-28 12:15:51 +01:00
aude 7deac2a8f6 add check for $wgWikimediaJenkinsCI isset
Change-Id: If7e38cc4858fd970b5feb90a44a6787df822de98
2014-02-18 16:06:21 +01:00
tonythomas01 187ae0cd02 Added the $wgPFEnableStringFunctions = true in ParserFunctions tests
Jenkins bot unit tests without setting $wgPFEnableStringFunctions = true;
This triggers all the parser tests for string functions to be skipped

Bug: 61410
Change-Id: I69636d656af851beeed6fd5353e4a01c1ca5c608
2014-02-18 19:40:21 +05:30
Brad Jorsch 4d9ddef2fb Update doc comment
Extension:Lua wasn't the way we went, Extension:Scribunto is.

Change-Id: I7f18fc9586c96e28326fb6e3fdae2a3ae20ffad2
2014-02-07 10:34:43 -05:00
Reedy e8905529b2 Add square root (sqrt) function
Change-Id: I2d7908be5ee964144ce10483c6f5834350c1c35b
2013-01-06 19:26:26 +00:00
Reedy 1a96b47d94 (Bug 35866) ParserFunctions: Division by zero in Expr.php
The PHP modulo operator ('%') casts its operands to ints, causing
floating point values 0 < $right < 1 to raise a divide-by-zero error.
Explicitly casting both operands to float and using fnmod() resolves the
issue. This change also tidies up the check for zero values and adds
tests.

Change-Id: I32c9eca6552e4fec248eb4fa6419faa39c10df3b
2012-12-11 03:21:58 -08:00
Reedy 62d5b02378 Merge "Add ExprError to autoloaded classes" 2012-12-07 23:51:27 +00:00
Reedy 57a6ec2942 Bug 42809 - Replace testExpr with a PHPUnit test
Change-Id: I338af01b50684b5849ca198eac536eacdc916ec6
2012-12-07 18:34:58 +01:00
Reedy f1e64db755 Add ExprError to autoloaded classes
Change-Id: I0f585d5396fb31eab362e5eb4c351bb194574cb7
2012-12-07 03:01:35 +00:00
umherirrender 99b150fab4 Cleanup I730624f4: Bug 40039 - Remove ConvertParser from ParserFunctions
Remove unused vars and dead entries for classes and tests

Change-Id: I0920f0294043fa1cca0ca5622fb7eae4a8c61fcb
2012-09-08 19:30:30 +02:00
Reedy 7a3619ea8d Bug 40039 - Remove ConvertParser from ParserFunctions
Change-Id: I730624f455dcd8cf0375b9147efe4abee5b203bb
2012-09-06 15:44:12 +01:00
Sam Reed 0b1347bdd2 SFH_OBJECT_ARGS was added pre 1.12...
Kill ancient back compat, and code where unused
2011-12-19 00:38:10 +00:00
Brion Vibber dcfa8e0c50 Update a butt-ton of extension about URLs to point to https://www.mediawiki.org/ 2011-12-13 23:49:33 +00:00
Sam Reed 34dbdcfd82 Comments, braces, explicit member variables
Remove a couple of unused variables
2011-11-16 13:22:03 +00:00
Happy-melon 0ef625494c Follow up r81074: implement a language map per Tim's suggestion (no more American linguistic imperialism, yay! :D). This is not a perfect solution because languages without translations still fall back to 'en' rather than 'en-gb' and so use the American units there, but this cures most of the issue. 2011-09-07 21:28:41 +00:00
Happy-melon cecb0eaeef Follow-up r81074:
* Disable {{#convert}} function by default.  This means that this change will not be live by default, so the fixme doesn't block WMF deployment, although it probably should still block the tarball.
* Documentation and type hinting
* Fix minor errors noted by Tim in CR.
2011-09-07 21:06:10 +00:00
Paul Copperman 3350ea8f2d Make ParserFunctions work with HipHop.
* When using HipHop, is_callable() returns false for objects which have only a __call() method instead of the requested one.
* Work around this by removing the ParserFunctions_HookStub hack.
* To retain the behavior that the code of ParserFunctions_body.php is only loaded when needed, turn it into a static class.
* Defer the registering of the ParserClearState hook until a relevant function is called.
2011-04-11 17:27:51 +00:00
Happy-melon 7ec54c6cfc Follow-up r81074 CR:
* Use autoloader for ConvertParser, and ExprParser which the code was cloned from
* Fix PHP 5.1 compatibility, while there's no requirement for us to keep it, there's also no need to break it unnecessarily, and it's a really trivial fix in this case.
* Tidy whitespace
* Use ConvertDimension::getLocalisedName() for the dimensionmismatch error, as intended
2011-01-27 17:34:37 +00:00
Happy-melon 65e9e69202 (bug 235) parser function for conversion of units of measurement.
[[Template:Convert]] on enwiki is a behemoth of a construction that just about manages to do this sort of conversion, taking {{convert|5|mi|km}} and outputting "5 miles (8 km)", etc.  To port this to another wiki requires copying over three and a half thousand subtemplates.  The additional load produced by including numerous copies of this template is measurable on large pages on enwiki, and it eats voraciously into the template limits.

This revision introduces {{#convert: 5 mi | km }}, outputting "8 km" or thereabouts.  See http://www.mediawiki.org/wiki/User:Happy-melon/Convert for more details, or look at the examples in the parser tests.  

In a very rough profile, comparing 50 calls to {{convert}} verses the same 50 calls to the wrapper template shown at the link above, the parser function implementation reduces page load time by 72%, preprocessor node count by 83%, post-expand include size by 86% and template argument size by 97%.  More detailed profiling would probably reveal places where extra caching could improve performance further.

The primary reason for putting it in ParserFunctions instead of its own extension is availability: PFs are already available across the cluster, and it's accepted as an essential extension for any wiki wishing to emulate or mirror WMF content.  One less separate extension installed on the cluster is one less extension which has to be matched by reusers.  

It's still missing a lot of units, which I ran out of patience to copy from {{convert}}; I thought I'd get some feedback on the infrastructure first.
2011-01-27 00:13:10 +00:00
Siebrand Mazeland 20888253e0 * remove MediaWiki pre-1.8 compatibility and remove SprintfDateCompat.php
* bump version to 1.4.0
* run stylize.php
2010-10-02 22:36:34 +00:00
Max Semenik 0055784a24 Follow-up to r67044: moved string function tests to a separate file protected by conditional, tweaked test runner to skip instead of exploding when required function hook is not found. 2010-07-09 21:11:54 +00:00
Max Semenik 1b75afd18d (bug 19940) urldecode dropped during StringFunctions-ParserFunctions merger 2010-05-29 16:12:41 +00:00
Brion Vibber 49aef28f87 Clean up some old PHP 4-style references passing $parsers around in ParserFunctions. Caused PHP warning output when using some functions on PHP 5.3. 2010-04-16 11:00:07 +00:00
Siebrand Mazeland 1b740a85ab * Remove $wgExtensionCredits['description'] where $wgExtensionCredits['descriptionmsg'] present. This feature was introduced in MediaWiki 1.12, and 'description' is not used if 'descriptionmsg' is present.
* Random indentation updates and trailing whitespace removed
2010-02-22 23:41:51 +00:00
Chad Horohoe 481afdc456 Nuking fallback code for MW < 1.12 in most extensions (there's like 5 or 6 left I haven't done). Couple of points:
* 1.11 and below aren't supported anymore, so we don't need to be maintaining back-compat code for it anymore. This is why we branch extensions
* The vast majority of these were using $wgParser. This defeats the purpose of ParserFirstCallInit...allowing you to use parsers other than $wgParser. All these extensions now work in any instance of the Parser, not just $wgParser
2009-09-04 22:22:12 +00:00
Siebrand Mazeland cd47b32b80 Somehow the implementation of r54847 did not work. Now adding $wgExtensionMessagesFiles ParserFunctionsMagic instead, which does appear to work. 2009-08-19 07:09:49 +00:00
Siebrand Mazeland 31a1820e70 * new style magic words support for ParserFunctions
* add localisation support for ParserFunctions magic in Translate
* bump version
2009-08-12 13:08:25 +00:00
Tim Starling 5d97108615 * Disabled string functions by default with a configuration variable. Outlined my case for doing so.
* Defer loading the bulk of the code until a parser function is actually called. Necessary due to the recent large increase in code size. 
* Fixed the total disregard for parser state and object-oriented data flow in ExtParserFunctions::loadRegex().
2009-06-05 09:53:05 +00:00
Robert Rohde 7840d735cf (Bug 19078) Restore #pos default behavior unintentionally changed in r50997 2009-06-05 00:06:06 +00:00
Katie Filbert 6d969b56e7 fix spelling in code comments for r50997 2009-06-01 00:51:49 +00:00
Siebrand Mazeland 7da7e7d2ef Follow up to r51082 from CR. Message is supposed to be in the content language. 2009-05-28 20:05:10 +00:00
Siebrand Mazeland 78253a7e4e Support PLURAL for pfunc_string_too_long. Is that escape really needed - it's a number? 2009-05-27 18:44:30 +00:00
Robert Rohde a697525576 (Bug 6455) Add string function support to ParserFunctions 2009-05-26 00:43:34 +00:00
Tim Starling 645e6149a8 * Fix for PHP 5.3: use the timezone parameter to DateTime::__construct() instead of applying setTimeZone() afterwards. This avoids an exception being thrown when the timezone is not set in php.ini.
* Tweaked formatting
2009-05-12 06:56:04 +00:00
Shinjiman e5eeec681f * (bug 18242) Show the Subversion revision number per extensions in Special:Version (currently applied on some extensions to get the entries file) 2009-04-26 05:22:33 +00:00
Philip Tzou 680d39e1e6 Allowed to find variant link when use #ifexist. 2009-04-25 03:46:10 +00:00
Alexandre Emsenhuber 58c7808057 Update url in extension's credits 2008-12-30 14:55:45 +00:00
Andrew Garrett d39259e0fa Revert "Follow up on r43982. Reduce dirname(__FILE__) calls in core and extensions."
Uses $dir in extension files, and assumes that it remains unchanged in require_once( 'maintenance/commandLine.inc' ).
In fact, it is likely that '$dir' will be set when setting up command-line, as some extensions will use the same var.

Recommended fix: Use $CentralAuth_dir, $EmailPage_dir, etc.
2008-11-30 03:15:22 +00:00
Siebrand Mazeland ec013e2112 Follow up on r43982. Reduce dirname(__FILE__) calls in core and extensions. 2008-11-26 23:17:15 +00:00
Brion Vibber 8a8fcf7466 * (bug 11686) Make #time work with pre-1970 dates
Uses DateTime class in PHP 5.2+ to support dates outside the 1970-2038 range. On earlier versions will still fall back to strtotime with the old 32-bit Unix timestamp range limitations.
Patch by rememberthedot -- https://bugzilla.wikimedia.org/attachment.cgi?id=5416

Added a couple quick parser test cases to confirm the new behavior. However I am seeing some annoyances with how input time zones are handled, so we'll want to clean that up at some point. :)
2008-10-27 17:56:58 +00:00
Raimond Spekking 3141cddd5e * (bug 15730) #iferror catches more errors so any amount of other classes may precede or succede /error/.
Patch by René Kijewski
2008-10-09 11:45:20 +00:00
Tim Starling 7f9f5c56c3 In #ifexist: add the link to the parser output even if it's in the link cache already 2008-09-26 08:42:27 +00:00