https://www.mediawiki.org/wiki/Extension:Scribunto says that master
requires 1.25+, so let's remove checks for stuff that was added before
that.
* PPFrame::getTTL() was in 1.24.
* PPFrame::setTTL() was in 1.24.
* PPFrame::isVolatile() was in 1.24.
* Parser::fetchCurrentRevisionOfTitle() was in 1.24.
* ObjectCache::getLocalServerInstance() was added in 1.27, so restore the call to ObjectCache::newAccelerator() as BC.
This also removes BC with the php-luasandbox extension older than 1.6, which
was released before MediaWiki 1.22.
Bug: T148012
Change-Id: I36e37f3b65d0f167e1d28b00e0842d9721feee31
An empty pattern isn't "safe" since it could match in between the
bytes of a UTF-8 character.
Also, it turns out there's a bug in PHP <5.6.9 preg_replace() that we
need to work around too.
Change-Id: I282e5909e4663461d60c5386693db182de2fd44c
Provides a simple wrapper for PHP's hash() and
hash_algos() functions.
I will add docs to the Lua reference manual once
this is merged.
Bug: T142585
Change-Id: I6697463974a175e99f9b77428a1085247165ebc9
mw.ustring is really really slow. I've discovered that in a lot of modules
on enwiki, upwards of 2/3 of the total runtime gets used when mw.html
calls mw.ustring.gsub. This change checks whether any Unicode characters
are present, and if not, calls string.gsub instead.
Change-Id: Ia50061584be3901ae7428354c449236225c318db
Core strip markers were changed in T110143 to include characters that
are normally encoded in attributes, however we want to pass them through
here so they can be unstripped correctly in the output wikitext.
This fix makes "Strip markers in CSS" parser test pass again.
Bug: T110143
Bug: T135961
Change-Id: I1353931a53c668d8a453dfa2300a99f59fdb01c5
The following continue to be ignored:
* Generic.Arrays.DisallowLongArraySyntax.Found, because I'm not sure
Scribunto is ready to abandon old version support in master.
* MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures,
because it's overly strict for its purpose.
Squiz.Classes.ValidClassName.NotCamelCaps isn't ignored globally, we
just ignore it explicitly every place it's needed.
Change-Id: I307668da6ef7b3e23da19b1fd1e08914239b99b3
Such a configuration is completely broken, but it's easy enough to
detect and avoid here.
Bug: T131910
Change-Id: I0bf108ec191a59f5506c0cdab00f3e5e68158ed5
This also makes some updates to make-normalization-table.php to handle
the move of UtfNormal to a separate library.
Bug: T126427
Change-Id: Id4985c3ca441cf92f08ba1f1af85c762ba43d7d2
When caching results from frame:preprocess and frame:expandTemplate,
restrict the scope of the cache to the frame object that was used. This
allows the integrity of the empty-frame expansion cache to be maintained
while also allowing parent frame access. This change is the equivalent of
I621e9075 in core.
Change-Id: Iae4c00e7e19ba12cfdaac135be16c991d9d0cea1
The new Scribunto_LuaTitleLibrary::redirectTarget() method is
used by mw.title objects as read-only attribute 'redirectTarget'.
If the page does not exist or it is not a redirect, the value
of the attribute is `false`; otherwise, it is the target of the
redirect page, as mw.title object.
This is a proper alternative to parsing wikitext as it is done in:
https://en.wikipedia.org/wiki/Module:Redirect
Bug: T68974
Change-Id: Id4d9b0f8c1cd09ebc42c031d4d3fc0c33eea44aa
The language used should be $parser->getTargetLanguage(), not the user
language.
Soft-depends on Id14733aaef3e52a2e315bffe74baeb926d46e238.
Bug: T127233
Change-Id: I712e048367d9d65fd223cb085dbf9e5fceca286c
These binaries were compiled from a manually lua-5.1.5 source tree.
Linux binaries were built by Anomie. Mac OS X and Windows by dpatrick.
Bug: T72541
Change-Id: I6af0f042c491785cce26afc186a148c83c4f3414
This is required for ensuring $this->interpreter is available. See
::getLimitReportData(), which does the same thing.
Change-Id: I275b093dd7d5f4873ec4b912823322e6e533cae1
Introduce a method, ScribuntoEngineBase::getResourceUsage(), which may be
overridden by script engine implementations to provide CPU and memory usage
data.
Change-Id: I6a4ed03c1261f43a7ce7de6f274c32c450e66abb
Lua actually treats a close-bracket at the start of a bracketed
character class as a literal, rather than using it to close the
character class. Probably unintended behavior, but it happens.
Also, have the pure-lua version throw our more informative errors on
error even when falling back to string.find and the like, and fix some
other weird edge cases that came up in testing.
Bug: T95958
Bug: T115686
Change-Id: Iab783d4a3e58b1514cc09729d4a71c2cb1242ee8
A string with a dot pattern is only "simple" if
followed by +, - or *. The end of string condition was not checked
properly.
Change-Id: Ia10b9164caeabe464c76441cc82eef37a7013048
Cache Lua libraries in APC (if available) for up to 5 minutes. Always check the
file's mtime to avoid serving a stale copy.
This code path is hot enough that using APC makes a difference.
Change-Id: I32bad5fd9443c1759fe6dc91f8df2ac2f120d75b
Make Scribunto compatible with storing content model in the database, by
checking for it directly instead of guessing it based on the title.
Change-Id: I94ae07bc47273fbf65d64b2909e5895c1c3fd7e9
The result of the type function should be compared against the
string "table", not the global variable. This bug probably went
undetected until now, as "table" is also the global variable for the Lua
table library.
Change-Id: Ia28fa10388bfc587d95b522bfa8f3524b4a3ee5f
When the Scribunto console produces an error, display a full backtrace
instead of just the error message.
Bug: T74462
Change-Id: I305438284eae8e19a51a70b1e83d54e4831de396
Add mw_loadData=true to metatables set by mw.loadData, so that modules can
distinguish them from other tables.
Change-Id: I0795d738891c85600af2621908376474ae21b3fe
Marius found a race condition in the handling of SIGXCPU: the pipes
would close, causing the read/write to complete, before the status of
the process changed, so the status would randomly be "running" for a few
milliseconds after proc_get_status() was called.
So: terminate the process unconditionally after an I/O error. Get the
exit status from proc_close(), since that's the only way to get the
status of a terminated process while simultaneously waiting for it to
exit. Also fix signal identification as in unmerged patch I57cdf8aa.
Change-Id: I252ec046e82063a868c1094e81705cb5e847db92
This is apparently unofficially deprecated, and we can do things a bit
more straightforwardly by using ParserOutput::addJsConfigVars() to
communicate the error messages to the JS.
This also takes the opportunity to move "ext.scribunto", which is mostly
about errors, to "ext.scribunto.errors".
Bug: T75618
Change-Id: I1577dab2dab1bd79cb127879de141fdbb8963aeb
Should be good to apply now after Wikibase has been adopted to
this.
This reverts commit 06f03fe09b.
Bug: T69483
Change-Id: I28073a891b8847fc6aa5ad026bf702e4015f7d4a
* For most tests, subclassing MediaWikiLangTestCase instead of
MediaWikiTestCase works.
* The Site library needs to not reuse its namespace cache if the
language changed.
* ScribuntoExceptions are still being localized for some reason; test
the message and args of the exception instead of using getMessage().
Bug: T69483
Change-Id: I1c0ca3b11b6228654b47ceb92c1b1be7bda6709a
Use cases:
- size: Showing links (like to SVG validator) conditionally (e.g.
only if the filesize is below the threshold it can work on)
- mime: No longer have to guess the MIME type based on the file
extension. We use the MIME type for displaying correct and
precise information about maximum thumbnailable sizes in
case an uploaded work exceeds this limit.
This change will not have negative impact on performance; as soon
as width or height is loaded, the two newly added information are
gratis.
Change-Id: I25aad85c2a558a684aca83374aeb628f355fad1c