Make the language cache size configurable, and increase the default from
20 to 30. It needs to be fairly small on default installations, but can
be essentially unlimited if $wgLocalisationCacheConf['manualRecache'] is
true.
Bug: T85461
Change-Id: Idb17691b30b0d2565a1624e5159df7d9b795764d
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
Implement Content::prepareSave() to ensure that any content
directly passed to WikiPage::doEditContent() that doesn't run edit
filters will still be validated. We have to use prepareSave() instead of
Content::isValid() because validation depends upon the current Title.
Create a ScribuntoContent::validate() convenience function to hold the
logic for that and add a todo to use it in the EditFilterMerged hook.
Also, remove a parser test that depended upon being able to save invalid
modules directly, as what it is testing is no longer possible (unless it
pre-dates making valid syntax a requirement).
Bug: T145548
Change-Id: Ie57eff36100963f02899d669df7375577f7375e1
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
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
This is unlikely to be a cause of the cache corruption since this isn't
calling setText() on any wikitext ParserOutputs, but let's fix it just
in case.
Bug: T124356
Change-Id: Ic34c654af86385dede843009d89df6f442ddc915
Introduce $wgScribuntoSlowFunctionThreshold, which is a float value between 0
and 1 (defaults to 0.9), specifying the percentile threshold for slow function
invocation reporting.
Change-Id: I3bd862347c21ba68d2f2f0729a834c4f7be3cd43
Report timing data for the top 1% of Lua function invocations, measured by CPU
time. Use the PSquare class from RunningStat (Ibbd3925aa) to keep an online
estimate of the 99th percentile without storing observations.
Depends on Ibbd3925aa (and on a follow-up patch to bump the RunningStat version
in core's composer.json.)
Change-Id: I0d39920733fe719f87698f03408698ed032c9849
Introduce a method, ScribuntoEngineBase::getResourceUsage(), which may be
overridden by script engine implementations to provide CPU and memory usage
data.
Change-Id: I6a4ed03c1261f43a7ce7de6f274c32c450e66abb
Add a placeholder in the HTML to have a more reliable position in the
HTML structure of the View source page.
Depends On: Ia03265a907212ee7bac1b839dcdd4d2f24c79bbe
Bug: T110050
Change-Id: I10ff67b359f04c0decd38fae750cc264e6bce50a
I94ae07bc arbitrarily removed this restriction, which seems liable to
result in confusion where non-Module-namespace pages can be marked as
modules but can't be #invoked.
Change-Id: Ia80f49d14b1f5cded0d3f5bffb6b450fb26cd986
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
Lua debugging console is useful even if the module page is protected,
so we should display it on read-only edit pages.
However, the `EditPage::showReadOnlyForm::initial` hook does not allow
to insert HTML below the textarea, so we let the JS do it client-side.
(In fact, it might be a good idea to do the same in the base case
and never send the HTML from server, I guess.)
Bug: T93902
Change-Id: I953c4313fc67c6e708b5ef68db5380991a75b363
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
Add more information to error messages in mw.html. This includes the
error level, the function name, and the position of the argument in the
argument list. Where possible, use the functions in libraryUtil.lua to
do this.
Some functions in mw.html accept multiple types, so add a checkTypeMulti
function to libraryUtil.lua to make these kinds of functions easy to check.
And while we're at it, add test cases for libraryUtil.lua as well.
Change-Id: If9cf9a52bd4b1bb42cc7f9f1f1096828710cbc52
MediaWiki core change I04b1a384 added support for i18n of API module
help. This takes advantage of that while still maintaining backwards
compatibility with earlier versions of MediaWiki.
Once support for MediaWiki before 1.25 is dropped, the methods marked
deprecated in this patch may be removed.
Change-Id: I67395aff48185f3e09da31b51a08aa2541fe6a17
There are like a billion things missing in the inline documentation
of this extension. Wow. This is what I can do for now.
Change-Id: I019c24d13cf5cb22dde4d710b86ef8f976e1ec96
Scribunto currently supports libraries with PHP callbacks that are
loaded on startup, and pure-Lua libraries that may be loaded from the
module with require().
This change allows for libraries with PHP callbacks to also be loaded
with require().
Change-Id: Ibdc1f4ef51b1c8644c3d4c98d57755b5c06447a5
This was never really a good idea. If you really want to save incomplete
code, you can put it all in a block comment. Since some modules may still
have errors from before this change, the tracking category for them has
not been removed.
Change-Id: Icb3da00a86b9773287dcd0c9277ad61446ec07ce
Instead of just displaying "Script error" in wikitext, display the actual
error string. Currently, many users don't see meaningful error messages
generated by modules, and instead just assume that "Script error" means
the module itself has a bug.
Bug: 71038
Change-Id: Ie5358049975352e0fef92088a06b97ad94717000
If a function name contains an equals sign, it doesn't increase the index,
so indexOffset=1 makes Lua see arguments as starting with 0. This change
fixes that, so that indexOffset is only set to 1 if the function name has
an index.
Change-Id: Ifa2dfad4d2f7228c3fd5721ccfc4c235576b663d
Clean up trailing whitespace from all of our code, and add comments
indicating that apparently unused variables are ScopedCallbacks.
Change-Id: I8e5997797cc7b1c64c5351ec112a18f30edc8fef
Idf4ad439 deprecated SyntaxHighlight_GeSHi::buildHeadItem in favor of
ResourceLoader. We may as well follow along.
To avoid breaking things if people don't update their
SyntaxHighlight_GeSHi in sync with Scribunto, test for the RL class used
in GeSHi's ResourceLoader integration and continue using buildHeadItem
if it's not found.
Change-Id: Id93530dce7c8c5a70a98fca58844adf9b5c6a23f
Messages from ScribuntoException are cached and stored with the page, so
they need to be output in the content language.
Change-Id: Ic8bd5cef2c49118ccb258592ca515c0e71f210e3