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 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
Replace numeric loops with iteration, don't unnecessarily check for nil
before table.insert (since it's a no-op in that case anyway), and similar
restructuring.
Change-Id: I155839a648f242a1b1de35f4081d8bcfa34f6933
At the moment, in mw.site.interwikiMap, URLs stored in the database
with relative protocols are converted to http or https depending
on the protocol of the user who last requested that the page be parsed.
However, this URL isn't updated for users pulling pages from the page
cache, so they may see links with an incorrect protocol. Module authors
can work round this by using mw.uri objects and the isProtocolRelative
property, but it would be simpler just to use relative URLs from the
outset.
Change-Id: If0a169cfd1597e09706fc0e6d5cdcc821ba8d06a
This makes the interwiki map available to Lua modules. The code is
based on the API interwiki map code in core (the appendInterwikiMap
method of includes/api/ApiQuerySiteInfo.php.) Everything that the
API includes is added, apart from iw_api and iw_wikiid, which I
couldn't think of a use for from Lua modules.
Accessing the interwiki map would be useful for modules like
enwiki's Module:InterwikiTable,[1] as it would stop module writers
having to duplicate the data.
[1] https://en.wikipedia.org/wiki/Module:InterwikiTable
Change-Id: Ie8ad2582aaf5e422824f7da51714a347bb4041d1
Change handling of PTD_FOR_INCLUSION to match that of the parser (i.e.,
don't set it if text is being expanded in the root frame), so that
frame:getParent():preprocess() will handle <noinclude> etc. correctly.
Change-Id: I13f45e57aa334642d310e9bd5fdd3dbe5922c4e1
When os.date("*t") or ("!*t") is called, instead of just setting the TTL
to 1 second, create a metatable that sets TTLs as the values are looked
at.
Change-Id: Id1e2df731f182f21cf19708738f9907fa927185c
When processing Lua console requests, don't attempt to parse pages that
aren't modules. This allows the Lua console to be successfully loaded
everywhere.
Change-Id: Idfd1985aca4acb6a8f3235d34ac00358e30e361c