MediaWiki REL1_34
|
Wikitext scripting infrastructure for MediaWiki: base classes. More...
Public Member Functions | |
__construct (array $options) | |
__destruct () | |
destroy () | |
fetchModuleFromParser (Title $title) | |
Load a module from some parser-defined template loading mechanism and register a parser output dependency. | |
formatLimitData ( $key, &$value, &$report, $isHTML, $localize) | |
Format limit report data. | |
getCodeEditorLanguage () | |
Get the language for Ace code editor. | |
getDefaultExceptionParams () | |
getGeSHiLanguage () | |
Get the language for GeSHi syntax highlighter. | |
getOption ( $optionName) | |
Get an element from the configuration array. | |
getParser () | |
getResourceUsage ( $resource) | |
Get CPU and memory usage information, if the script engine provides it. | |
getSoftwareInfo (array &$software) | |
Get software information for Special:Version. | |
getTitle () | |
newException ( $message, array $params=[]) | |
reportLimitData (ParserOutput $output) | |
Add limit report data to a ParserOutput object. | |
runConsole (array $params) | |
Run an interactive console request. | |
setTitle ( $title) | |
validate ( $text, $chunkName=false) | |
Validates the script and returns a Status object containing the syntax errors for the given code. | |
Public Attributes | |
const | CPU_SECONDS = 1 |
const | MEM_PEAK_BYTES = 2 |
Protected Member Functions | |
getLibraries ( $engine, array $coreLibraries=[]) | |
Load a list of all libraries supported by this engine. | |
getLibraryPaths ( $engine, array $coreLibraryPaths=[]) | |
Load a list of all paths libraries can be in for this engine. | |
newModule ( $text, $chunkName) | |
Creates a new module object within this engine. | |
Protected Attributes | |
ScribuntoModuleBase[] | $modules = [] |
array | $options |
Parser | $parser |
Title | $title |
Wikitext scripting infrastructure for MediaWiki: base classes.
Copyright (C) 2012 Victor Vasiliev vasil.nosp@m.vv@g.nosp@m.mail..nosp@m.com et al https://www.mediawiki.org/
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html Base class for all script engines. Includes all code not related to particular modules, like tracking links between modules or loading module texts.
ScribuntoEngineBase::__construct | ( | array | $options | ) |
ScribuntoEngineBase::destroy | ( | ) |
Reimplemented in Scribunto_LuaEngine.
Definition at line 103 of file Base.php.
Referenced by __destruct().
ScribuntoEngineBase::fetchModuleFromParser | ( | Title | $title | ) |
Load a module from some parser-defined template loading mechanism and register a parser output dependency.
Does not initialize the module, i.e. do not expect it to complain if the module text is garbage or has syntax error. Returns a module or null if it doesn't exist.
Title | $title | The title of the module |
Definition at line 164 of file Base.php.
References $title, Title\getPrefixedDBkey(), and newModule().
Referenced by Scribunto_LuaEngine\loadPackage().
ScribuntoEngineBase::formatLimitData | ( | $key, | |
& | $value, | ||
& | $report, | ||
$isHTML, | |||
$localize ) |
Format limit report data.
string | $key | |
mixed | &$value | |
string | &$report | |
bool | $isHTML | |
bool | $localize |
Reimplemented in Scribunto_LuaSandboxEngine, and Scribunto_LuaStandaloneEngine.
ScribuntoEngineBase::getCodeEditorLanguage | ( | ) |
ScribuntoEngineBase::getDefaultExceptionParams | ( | ) |
Definition at line 146 of file Base.php.
References $title.
Referenced by newException(), and Scribunto_LuaEngine\newLuaError().
ScribuntoEngineBase::getGeSHiLanguage | ( | ) |
Get the language for GeSHi syntax highlighter.
Reimplemented in Scribunto_LuaEngine.
Definition at line 216 of file Base.php.
Referenced by ScribuntoContent\highlight().
|
protected |
Load a list of all libraries supported by this engine.
The return value is an array with keys being the library name seen by the module and values being either a PHP class name or an array with the following elements:
string | $engine | script engine we're using (eg: lua) |
array | $coreLibraries | Array of core libraries we support |
Definition at line 249 of file Base.php.
Referenced by Scribunto_LuaEngine\load().
|
protected |
Load a list of all paths libraries can be in for this engine.
string | $engine | script engine we're using (eg: lua) |
array | $coreLibraryPaths | Array of library paths to use by default |
Definition at line 262 of file Base.php.
Referenced by Scribunto_LuaEngine\loadPackage().
ScribuntoEngineBase::getOption | ( | $optionName | ) |
ScribuntoEngineBase::getParser | ( | ) |
Definition at line 231 of file Base.php.
References $parser.
Referenced by Scribunto_LuaEngine\addWarning(), Scribunto_LuaEngine\callParserFunction(), Scribunto_LuaEngine\expandTemplate(), Scribunto_LuaEngine\getFrameById(), Scribunto_LuaEngine\incrementExpensiveFunctionCount(), Scribunto_LuaEngine\isSubsting(), Scribunto_LuaEngine\newChildFrame(), and Scribunto_LuaEngine\setupCurrentFrames().
ScribuntoEngineBase::getResourceUsage | ( | $resource | ) |
Get CPU and memory usage information, if the script engine provides it.
If the script engine is capable of reporting CPU and memory usage data, it should override this implementation.
int | $resource | One of ScribuntoEngineBase::CPU_SECONDS or ScribuntoEngineBase::MEM_PEAK_BYTES. |
Reimplemented in Scribunto_LuaSandboxEngine.
|
abstract |
Get software information for Special:Version.
array | &$software |
Reimplemented in Scribunto_LuaSandboxEngine, and Scribunto_LuaStandaloneEngine.
ScribuntoEngineBase::getTitle | ( | ) |
ScribuntoEngineBase::newException | ( | $message, | |
array | $params = [] ) |
string | $message | |
array | $params |
Definition at line 139 of file Base.php.
References getDefaultExceptionParams().
Referenced by Scribunto_LuaEngine\executeModule().
|
abstractprotected |
Creates a new module object within this engine.
string | $text | |
string | bool | $chunkName |
Reimplemented in Scribunto_LuaEngine.
Referenced by fetchModuleFromParser(), and validate().
ScribuntoEngineBase::reportLimitData | ( | ParserOutput | $output | ) |
Add limit report data to a ParserOutput object.
ParserOutput | $output | ParserOutput object in which to add limit data |
Reimplemented in Scribunto_LuaSandboxEngine, and Scribunto_LuaStandaloneEngine.
|
abstract |
Run an interactive console request.
array | $params | Associative array. Options are:
|
Reimplemented in Scribunto_LuaEngine.
ScribuntoEngineBase::setTitle | ( | $title | ) |
ScribuntoEngineBase::validate | ( | $text, | |
$chunkName = false ) |
Validates the script and returns a Status object containing the syntax errors for the given code.
string | $text | |
string | bool | $chunkName |
Definition at line 191 of file Base.php.
References newModule().
|
protected |
|
protected |
Definition at line 43 of file Base.php.
Referenced by __construct(), and Scribunto_LuaEngine\newAutodetectEngine().
|
protected |
Definition at line 53 of file Base.php.
Referenced by getParser().
|
protected |
Definition at line 38 of file Base.php.
Referenced by Scribunto_LuaEngine\expandTemplate(), fetchModuleFromParser(), Scribunto_LuaSandboxEngine\formatLimitData(), getDefaultExceptionParams(), getTitle(), Scribunto_LuaEngine\loadPackage(), Scribunto_LuaEngine\newChildFrame(), and setTitle().
const ScribuntoEngineBase::CPU_SECONDS = 1 |
Definition at line 32 of file Base.php.
Referenced by Scribunto_LuaSandboxEngine\getResourceUsage().
const ScribuntoEngineBase::MEM_PEAK_BYTES = 2 |
Definition at line 33 of file Base.php.
Referenced by Scribunto_LuaSandboxEngine\getResourceUsage().