Commit graph

340 commits

Author SHA1 Message Date
Brad Jorsch c7246a1c42 Improve disable_functions handling in LuaStandalone
If the user is on a webhost that has proc_open listed in PHP's
disable_functions directive, we should give a better error message.
Until we no longer support PHP below 5.4, we should do the same for
safe_mode. And since we're doing that, we may as well report any other
warnings if proc_open fails, too.

In addition, this cleans up error handling in
Scribunto_LuaEngine::load() so it doesn't pretend the interpreter is
loaded if getInterpreter() throws an exception. Otherwise other code
winds up with PHP fatal errors trying to access a null value.

Bug: 50706
Change-Id: I2887b722e089fd7a526aa7dcab9c80deb343d8ac
2013-07-24 15:01:36 -04:00
Brad Jorsch ad3e5a7c48 Fix LuaSandbox mw.ustring.byteoffset with negative 'i'
Negative values for 'i' in mw.ustring.byteoffset are supposed to count
from the end of the string. But in LuaSandbox, it was actually counting
from two bytes before the end of the string due to a typo.

Fix that, and add some tests for it.

Bug: 50176
Change-Id: Iceee1022a55abd7a08df1ea7843e1277eb02798b
2013-06-25 10:06:01 -04:00
Translation updater bot 9d187bf301 Localisation updates from http://translatewiki.net.
Change-Id: I2873c7b3be27ecc3e277150a767d82e56a21a853
2013-06-24 19:56:27 +00:00
Translation updater bot ac968ab67f Localisation updates from http://translatewiki.net.
Change-Id: I5e195b4d876b58cfefcc740f1f00c3364ab03858
2013-06-15 21:12:15 +00:00
Translation updater bot 7a664889d2 Localisation updates from http://translatewiki.net.
Change-Id: I4f9467e5dca9de3eb5f88b4e6eb5b59194501bcc
2013-06-14 21:52:59 +00:00
Brad Jorsch e12d743986 Handle bogus entries in MediaWiki:Scribunto-doc-page-name
If someone puts something broken in MediaWiki:Scribunto-doc-page-name,
it may not be possible to determine which module the page is a doc page
for. In that case, just pretend it's not a doc page.

Bug: 49322
Change-Id: Ia4421576b372e188cf7e3dfe2c0b8ce213d026d4
2013-06-07 18:21:31 -04:00
Translation updater bot 6081c4fd30 Localisation updates from http://translatewiki.net.
Change-Id: I2e8b232d72eacf4b04a7848059906541f2effc7e
2013-06-04 09:31:57 +00:00
Translation updater bot 593d7e5f59 Localisation updates from http://translatewiki.net.
Change-Id: I8458d0454cab9ba74858fde2cd57ec6156208ea4
2013-06-03 19:00:24 +00:00
Translation updater bot f015053ae9 Localisation updates from http://translatewiki.net.
Change-Id: Ie4208b29b51fba9a541bd1fae254cd9a0983e24e
2013-06-03 11:54:09 +00:00
Translation updater bot 904650875c Localisation updates from http://translatewiki.net.
Change-Id: I68f12ab624e905f229078b349094c736842d89b1
2013-05-29 08:40:57 +00:00
Translation updater bot 45fb5f2456 Localisation updates from http://translatewiki.net.
Change-Id: Iac612a33013f5777dfe12f7d515150fc44b8312a
2013-05-28 06:46:47 +00:00
Translation updater bot a399a8bc77 Localisation updates from http://translatewiki.net.
Change-Id: I4e3da38389a780a880d1c86699b9aaad89a26b18
2013-05-26 08:44:06 +00:00
Translation updater bot b7788925c7 Localisation updates from http://translatewiki.net.
Change-Id: I0459f2ce2d549cf84c479c4fc76a454c3d8cc216
2013-05-24 08:37:50 +00:00
Translation updater bot 37abea396b Localisation updates from http://translatewiki.net.
Change-Id: I2725a92c673c586d3efe1934a74332d3f54e2bff
2013-05-23 05:43:09 +00:00
Translation updater bot 45b7e6d477 Localisation updates from http://translatewiki.net.
Change-Id: I06ca2457277bc9e07e96a45880809971ee2c7766
2013-05-21 05:56:42 +00:00
Translation updater bot 80caf16c17 Localisation updates from http://translatewiki.net.
Change-Id: I2e64fd58a54688b4ae9f4ac6f76b48fefd8f3f73
2013-05-16 20:16:11 +00:00
Translation updater bot 3dddf83b85 Localisation updates from http://translatewiki.net.
Change-Id: Idf162033a1423658559c91f1a676e914ef010f2f
2013-05-15 21:09:46 +00:00
jenkins-bot b0776fab0d Merge "Fix 5a2030dd for namespace names in zh and yue (zh-yue)" 2013-05-14 16:35:01 +00:00
Brad Jorsch 1ef4cd15ec Fix uncaught exception in LuaStandalone
If the interpreter exits before the end of the page, then the call to
Scribunto_LuaStandaloneEngine::getLimitReport() throws an uncaught
exception when it tries to access the interpreter. Catch it.

Change-Id: I7ce4f09b1b2206f13ab0f422de35e0b69a3b24d5
2013-05-13 16:27:37 -04:00
Translation updater bot 06d73773fc Localisation updates from http://translatewiki.net.
Change-Id: I18844db85411c1a0de587bfa987a11d86014b171
2013-05-13 19:48:47 +00:00
Brad Jorsch d6f3633428 (bug 47365) Fix edge cases in mw.ustring.find, mw.ustring.match
The following errors are fixed:
* PHP warning and wrong return value with empty pattern and plain
* Incorrect offsets returned when init is larger than the string length
* Incorrect captured offsets returned when init is excessively negative

Bug: 47365
Change-Id: I9741418287dc727747326d6a19678370ce155a2b
2013-05-10 06:00:02 +00:00
Translation updater bot eff08defec Localisation updates from http://translatewiki.net.
Change-Id: I4bef7c8e24caeff4e0cc9691f5d1fd7c60ba5b52
2013-05-06 20:21:26 +00:00
Translation updater bot a70b9fa9fb Localisation updates from http://translatewiki.net.
Change-Id: If111fffe2aecab406739c46f5163feb565b8250e
2013-05-05 21:10:28 +00:00
Translation updater bot 86521cf18d Localisation updates from http://translatewiki.net.
Change-Id: I9d6856a7653179a0254051f1ec5ea3e7ace853ef
2013-05-04 20:24:55 +00:00
Brad Jorsch 1e02fad924 Fix content format for ScribuntoContentHander
We had intended to use the constant CONTENT_FORMAT_TEXT, but
accidentally used that as a string instead.

Change-Id: I93a2c02d48d3fd7b73530562165d817965e272d1
2013-04-30 14:28:14 -04:00
Translation updater bot 3515465c9a Localisation updates from http://translatewiki.net.
Change-Id: Ieb2ff4593932ce69231675846423479907b17aaa
2013-04-28 23:57:45 +00:00
Translation updater bot 20ed7a9d1d Localisation updates from http://translatewiki.net.
Change-Id: I32fa55c8d7ab68610f18ed3d940787b31f232e92
2013-04-26 22:14:07 +00:00
Liangent d4286e271d Fix 5a2030dd for namespace names in zh and yue (zh-yue)
* zh names are dropped to use fallback.
* zh-yue is renamed to yue, with talk namespace name added.

Change-Id: I9b0e0e5ab03a70bcbbc052ef4e6c753574e73e13
2013-04-26 19:00:33 +08:00
Brad Jorsch 3622f82bd1 (bug 47300) Fix sandboxing with require
Two related issues:
* The package module was inheriting the loaders from the outer sandbox,
  so loaded modules were being loaded into the outer sandbox's
  environment.
* mw.loadData was using the outer sandbox's require(), so again loaded
  modules were being loaded into the outer sandbox's environment.

Bug: 47300
Change-Id: I48d8dd4784c9a890e3abb6389f96f38e1420dbbb
2013-04-24 06:19:44 +00:00
Translation updater bot 0faada1ddf Localisation updates from http://translatewiki.net.
Change-Id: Iba12005176fad06d4352f1dfea3b462ab952bc34
2013-04-23 20:11:51 +00:00
jenkins-bot 970a83ae97 Merge "(bug 47262) Magic word localization in Galician." 2013-04-23 11:43:50 +00:00
Dereckson 4c92452d50 (bug 47262) Magic word localization in Galician.
#invoke -> #chamar

Bug: 47262
Change-Id: I738ad78b30193ca9227a932b768a7c62bf76022c
2013-04-23 11:43:21 +00:00
jenkins-bot 24843707df Merge "(bug 47268) lang:parseFormattedNumber should return a number, not a string" 2013-04-22 19:18:13 +00:00
Brad Jorsch 203b3e75dc Don't pass negative years to Language::sprintfDate
Language::sprintfDate cannot handle negative years, so don't pass them.
Return an appropriate error instead.

Change-Id: Ifb633631df98c82aa1c3dc8a555b91f77faf15ed
2013-04-19 17:59:48 -04:00
Brad Jorsch 821ba409d8 (bug 47268) lang:parseFormattedNumber should return a number, not a string
The documentation, and the expectation of users, is that
lang:parseFormattedNumber() should actually return a number, not a
string.

Bug: 47268
Change-Id: Ieabddd0d9192f1fd8ef7e890d5d6268be9636f38
2013-04-15 20:53:47 -04:00
Translation updater bot 2ef8c54041 Localisation updates from http://translatewiki.net.
Change-Id: Iba559e360f82467334df9092c1e42fb0a673399d
2013-04-15 21:02:30 +00:00
Brad Jorsch 581b2306af Remove mw.getLogBuffer and others from public interface
One of the design goals of Scribunto is that each #invoke should be
independent. Creative use of mw.log and mw.getLogBuffer can get around
this, passing information from one #invoke to the next.

This patch takes the simple solution of removing mw.getLogBuffer from
modules' environments. For good measure, it also removes
mw.clearLogBuffer and mw.executeModule.

Some minor cleanup of the console code is also included.

Change-Id: I30d73928bade4a6bdd7c00ffcd58a3858ff55698
2013-04-14 23:59:07 +00:00
jenkins-bot e40d364b36 Merge "(bug 46082) import namespace names translations from Meta" 2013-04-12 20:32:07 +00:00
Translation updater bot 8c25e7e4fc Localisation updates from http://translatewiki.net.
Change-Id: I024fb122b2885fee7900fcd8880b21c50cca0fa6
2013-04-12 18:17:18 +00:00
Translation updater bot 619e607332 Localisation updates from http://translatewiki.net.
Change-Id: I6416985d5d5b92450b3884b31d1aca17f61d65af
2013-04-08 20:04:41 +00:00
MatmaRex 5a2030dd8f (bug 46082) import namespace names translations from Meta
https://meta.wikimedia.org/wiki/Lua_deployments/Localization_of_Module

Four languages (ka, ms, zh, zh-yue) are missing the translation for
Module talk, as there wasn't one on the Meta page.

Full list of newly added languages (including the ones with partial
translations): an, ar, ast, ba, bn, ca, crh, da, dv, es, et, eu, fa,
gl, id, it, ja, ka, ko, min, ms, nn, no, pl, ru, sk, sl, uk, zh,
zh-yue.

Change-Id: I504ce98a2a430aa98f116186051331fbbfcc57d5
2013-04-08 19:10:35 +02:00
Translation updater bot 0678fa01d9 Localisation updates from http://translatewiki.net.
Change-Id: Iae8ba7543660734a5d1e9776935cd43045cf5c76
2013-04-06 19:53:58 +00:00
Translation updater bot 41fc11a483 Localisation updates from http://translatewiki.net.
Change-Id: I963c710c124fc89ccf73d3ad91cf88472f2b8ab6
2013-04-04 20:04:45 +00:00
Translation updater bot 4d186cb231 Localisation updates from http://translatewiki.net.
Change-Id: I18b1f823cc321d92e778e5f35a36b95941ddb99d
2013-04-03 19:50:56 +00:00
raymond a0a53bf110 Add namespace translation for 'cy'
Requested by Lloffiwr
https://translatewiki.net/wiki/Thread:Support/Module_namespace_for_cy_wikis

Change-Id: I90a11fa7e4cdf8cb59742b9f61a66827c45c5a56
2013-04-03 09:15:51 +02:00
Brad Jorsch ca3b0b55b2 Add timezone support to mw.lang:formatDate
This uses the timezone support added to core Language::sprintfDate in
Iea1f7842 to add support for various timezone-related formatting
characters, and to correct the output for 'c', 'r', and 'U' in local
mode.

This is related to bug 33454, which requests the same for
ParserFunctions' {{#timel:}}.

Bug: 33454
Change-Id: I1b92dc671051a6cc53e35ebd74d383448e16696c
2013-04-02 23:15:16 +00:00
Brad Jorsch 71d9f600dc (bug 46294) Fix for Windows text-mode file handles
On Windows for LuaStandalone, the lua executable's standard output is a
text-mode file handle, even if the pipe is opened from PHP with the
binary flag. Which means that when Lua returns a "\n", it gets silently
rewritten to "\r\n" and the unserialization fails.

So, change the protocol for Lua→PHP messages to encode \r and \n (and \
itself, as the escape character) to avoid this issue.

Bug: 46294
Change-Id: I73b5f44e8aa0334f5fd03013dc027d1a57318349
2013-04-02 23:05:38 +00:00
Translation updater bot 2a1e1b57a3 Localisation updates from http://translatewiki.net.
Change-Id: Iabf82ced63c5325a494d86f5c13f63a9a0a897f1
2013-04-02 19:11:18 +00:00
Brad Jorsch adb7b5f939 Make pairs() work with various library objects
Users are reporting disappointment that using pairs on title objects
doesn't let them see the fields available. It's easy enough to add a
__pairs metamethod to allow pairs to work on title objects, so let's do
that.

The same can be done for mw.uri objects.

For mw.message objects, we can easily enough change the implementation
to be like mw.language objects, which doesn't have this problem.

For mw.site.stats, we may as well just remove the load-on-demand feature
since it will be demanded as soon as the environment is cloned for the
first module.

Change-Id: Ie5a3b5684b2bb6c090f9994baa03977687688929
2013-04-02 17:23:42 +00:00
Translation updater bot 9e6d0848ee Localisation updates from http://translatewiki.net.
Change-Id: Id3a7ec403c9a6cfc922c3a59323bd520bdbc88a8
2013-03-31 18:53:49 +00:00