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
* Add mw-content-(ltr|ltr) class to the documentation <div>.
* Rewrite the div code as Html::rawElement instead of
concatenating a string.
Done in pairing with Niklas Laxström.
Change-Id: I4d68d53df9dcf3556885552b738f2c327aaa8607
When displaying a nosuchfunction or nosuchmodule error, include the name
of the nonexistent function or module.
Change-Id: I17fc2c68dc8267302a82eee3cb2c5df9b5a3c46c
This module doesn't exist on mobile, so don't try to load it there
(which will produce an exception).
Bug: 59808
Change-Id: Ifad7edb508c1f740a109e8f5c1656e4c7841ab13
Change Ie065c7b5 added an option to show profiling data at the bottom of
preview pages, and with it new hooks to gather and format this data in a
more structured way than is possible with ParserLimitReport. This change
adds support for the new hooks.
Depends-On: I7799616a602d90e1b8d3f0ece35811ca387bade7
Change-Id: Idffd2d78f9a0217c99c07cbbfc844d6daf0172f7
Change I15c10379 wrapped the scribunto-doc-page-show message in a div,
which is breaking things when the content of that message starts with
start-of-line-sensitive wikitext. So add a newline inside the div.
Bug: 60664
Change-Id: If596bed72f779f5980348ac111b63e7876d21ff4
A module for building complex HTML from Lua using a
fluent interface. The module is originally from enwiki,
but the authors allowed us to reuse it under GPLv2+
(as stated in the file).
The module will be loaded per default and comes with
unit tests.
As discussed on wikitech-l:
http://lists.wikimedia.org/pipermail/wikitech-l/2013-December/073320.html
Change-Id: I7c8d4378091c13d5ace0dd1fcbb4e27163e8c896
When the "Allow saving code with errors" checkbox is used, an
automatically-added tracking category would be useful. And we may as
well also include the error message that would have been displayed when
trying to save without that checkbox checked.
Bug: 39605
Change-Id: Ideb72a58887fb1187b9adba80b7245cdca070ce4
If an invalid title is entered into MediaWiki:Scribunto-doc-page-name,
it could cause "attempt to call function on a non-object" fatal errors
all over the place. Let's avoid that.
Bug: 52404
Change-Id: Id5c6e7cd01b13547095553358310605dd02e90aa
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
We had intended to use the constant CONTENT_FORMAT_TEXT, but
accidentally used that as a string instead.
Change-Id: I93a2c02d48d3fd7b73530562165d817965e272d1
Use the SoftwareInfo hook to add the versions of LuaSandbox and Lua to
Special:Version.
Bug: 39655
Change-Id: I912197efee0211066677c4d46e638fb546a410c6