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
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
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
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
Currently, mw.title.new always results in a database query, which holds up
the parse until it finishes. This changes it to not require a database
query if it's not actually necessary.
Bug: T68328
Change-Id: I62f347d4cd9176bd0440215dcbe804c1dc3d4c99
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
Use $title->exists() to see if a title exists, and use
$parser->fetchLatestRevisionOfTitle() when available, so that
TemplateSandbox works with title.exists and title.getContent().
Bug: 70495
Change-Id: I732da9daccdc35b11d726818c3a7c81f5e810a32
When calling getContent() on the page currently being viewed, set
vary-revision on the parser output, as is done when a page transcludes
itself.
Change-Id: I908f095935067dc24dd561192b0699c602cb605f
Add a way to fetch cascading protection information from Lua without
needing to call the CASCADINGSOURCES parser function.
Change-Id: I1b3ac18af11d3066f78d27b31da8d6709a6a2631
Include a protectionLevels variable in the output of the mw.title.*
functions, containing the contents of the title's mRestrictions
array (i.e., its protection levels)
Change-Id: I79c9fed64bacfc90aee1d411a3e1b47e44c99755
mw.title.new( pageid ) should not throw an error for an nonexisting
pageid, just return nil. Similarly, it should always return nil for 0,
rather than returning the last non-existent title created.
Change-Id: I3cdbb24fc785aef0f8e75fba1feccd26ac5b7370
Every Lua-using page loads the "self" title for mw.title. But we don't
want to record this self-link in the links table, because that confuses
people.
Change-Id: I1ef57daa615c176b7789f5f09bd15ee5b292ad0c
People sometimes want to know if the actual file exists, not just the
file description page. Support that.
Also alias .exists to .fileExists for the Media namespace, since that's
what the Media namespace is for.
And while we're at it, fix .exists for special pages too.
Bug: 45774
Change-Id: I019adc89858a1d32995a38d5e8eef32577fd32d6
Since the content of a page is being loaded, this should be recorded in
templatelinks so things can be updated properly when that page is
edited.
Change-Id: I3e720fee2705f6c08ac0456c3cab0ed4ede84536
Remove unused parameters from the require() argument lists of two
modules, left over from an earlier phase of development.
Change-Id: Ib55d19fb9adffed2153a9cb3788533c4b70b5e26
getParser() sometimes returns null (eg: on saving edits). In that case,
don't try injecting link information into the (non-existent)
ParserOutput object.
Change-Id: Ief544922228615fbf674305bff95f874d56b7866
Note that fetching any title besides the one for the current page is
considered "expensive". It also records the title fetched in the
ParserOutput so it will be listed in pagelinks, just like #ifexists.
This also moves the ToString test formatter into TestFramework.lua, so
TitleLibraryTests.lua can use it too.
Change-Id: I799f3289a37fe1349b6bca5758829acf82cb718f