MediaWiki REL1_34
Scribunto_LuaSandboxEngine Class Reference
Inheritance diagram for Scribunto_LuaSandboxEngine:
Collaboration diagram for Scribunto_LuaSandboxEngine:

Public Member Functions

 formatLimitData ( $key, &$value, &$report, $isHTML, $localize)
 Format limit report data.
 
 getPerformanceCharacteristics ()
 Get performance characteristics of the Lua engine/interpreter.
 
 getResourceUsage ( $resource)
 Get CPU and memory usage information, if the script engine provides it.
 
 getSoftwareInfo (array &$software)
 Get software information for Special:Version.
 
 reportLimitData (ParserOutput $output)
 Add limit report data to a ParserOutput object.
 
- Public Member Functions inherited from Scribunto_LuaEngine
 addWarning ( $text)
 Adds a warning to be displayed upon preview.
 
 callParserFunction ( $frameId, $function, $args)
 Handler for callParserFunction()
 
 checkNumber ( $funcName, $args, $index0)
 Workalike for luaL_checknumber()
 
 checkString ( $funcName, $args, $index0)
 Workalike for luaL_checkstring()
 
 checkType ( $funcName, $args, $index0, $type, $msgType)
 Workalike for luaL_checktype()
 
 destroy ()
 
 executeFunctionChunk ( $chunk, $frame)
 Execute a module function chunk.
 
 executeModule ( $chunk, $functionName, $frame)
 Execute a module chunk in a new isolated environment, and return the specified function.
 
 expandTemplate ( $frameId, $titleText, $args)
 Handler for expandTemplate()
 
 frameExists ( $frameId)
 Handler for frameExists()
 
 getAllExpandedArguments ( $frameId)
 Handler for getAllExpandedArguments()
 
 getCodeEditorLanguage ()
 Get the language for Ace code editor.
 
 getExpandedArgument ( $frameId, $name)
 Handler for getExpandedArgument()
 
 getFrameTitle ( $frameId)
 Handler for getTitle()
 
 getGeSHiLanguage ()
 Get the language for GeSHi syntax highlighter.
 
 getInterpreter ()
 Get the current interpreter object.
 
 getLuaLibDir ()
 Return the base path for Lua modules.
 
 incrementExpensiveFunctionCount ()
 Increment the expensive function count, and throw if limit exceeded.
 
 isSubsting ()
 Return whether the parser is currently substing.
 
 load ()
 Initialise the interpreter and the base environment.
 
 loadPackage ( $name)
 Handler for the loadPackage() callback.
 
 loadPHPLibrary ( $name)
 Handler for the loadPHPLibrary() callback.
 
 newChildFrame ( $frameId, $title, array $args)
 Handler for newChildFrame()
 
 newLuaError ( $message, $params=[])
 
 preprocess ( $frameId, $text)
 Handler for preprocess()
 
 registerInterface ( $moduleFileName, $interfaceFuncs, $setupOptions=[])
 Register a Lua Library.
 
 runConsole (array $params)
 Run an interactive console request.
 
 setTTL ( $ttl)
 Handler for setTTL()
 
- Public Member Functions inherited from ScribuntoEngineBase
 __construct (array $options)
 
 __destruct ()
 
 fetchModuleFromParser (Title $title)
 Load a module from some parser-defined template loading mechanism and register a parser output dependency.
 
 getDefaultExceptionParams ()
 
 getOption ( $optionName)
 Get an element from the configuration array.
 
 getParser ()
 
 getTitle ()
 
 newException ( $message, array $params=[])
 
 setTitle ( $title)
 
 validate ( $text, $chunkName=false)
 Validates the script and returns a Status object containing the syntax errors for the given code.
 

Public Attributes

 $loaded = false
 
 $options
 
- Public Attributes inherited from Scribunto_LuaEngine
const MAX_EXPAND_CACHE_SIZE = 100
 
- Public Attributes inherited from ScribuntoEngineBase
const CPU_SECONDS = 1
 
const MEM_PEAK_BYTES = 2
 

Protected Member Functions

 getMwLuaLine ( $lineNum)
 
 newInterpreter ()
 Create a new interpreter object.
 
- Protected Member Functions inherited from Scribunto_LuaEngine
 formatHtmlLogs ( $logs, $localize)
 Format the logged data for HTML output.
 
 getFrameById ( $frameId)
 Helper function for the implementation of frame methods.
 
 getLogBuffer ()
 Get data logged by modules.
 
 loadLibraryFromFile ( $fileName)
 Load a library from the given file and execute it in the base environment.
 
 newModule ( $text, $chunkName)
 
 normalizeModuleFileName ( $fileName)
 Normalize a lua module to its full path.
 
- Protected Member Functions inherited from ScribuntoEngineBase
 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.
 

Protected Attributes

Scribunto_LuaSandboxInterpreter $interpreter
 
 $lineCache = []
 
- Protected Attributes inherited from Scribunto_LuaEngine
 $availableLibraries = []
 
array $currentFrames = []
 
 $expandCache = []
 
Scribunto_LuaInterpreter $interpreter
 
 $loaded = false
 
array $mw
 
- Protected Attributes inherited from ScribuntoEngineBase
ScribuntoModuleBase[] $modules = []
 
array $options
 
Parser $parser
 
Title $title
 

Private Member Functions

 getLimitReportData ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Scribunto_LuaEngine
static newAutodetectEngine (array $options)
 If luasandbox is installed and usable then use it, otherwise.
 
- Static Protected Attributes inherited from Scribunto_LuaEngine
static array $libraryClasses
 Libraries to load.
 
static array $libraryPaths
 Paths for modules that may be loaded from Lua.
 

Detailed Description

Definition at line 3 of file Engine.php.

Member Function Documentation

◆ formatLimitData()

Scribunto_LuaSandboxEngine::formatLimitData ( $key,
& $value,
& $report,
$isHTML,
$localize )

Format limit report data.

Parameters
string$key
mixed&$value
string&$report
bool$isHTML
bool$localize
Returns
bool

Reimplemented from ScribuntoEngineBase.

Definition at line 123 of file Engine.php.

References $lang, $line, ScribuntoEngineBase\$title, $wgLang, Scribunto_LuaEngine\formatHtmlLogs(), Title\hasContentModel(), Linker\link(), and wfMessage().

◆ getLimitReportData()

Scribunto_LuaSandboxEngine::getLimitReportData ( )
private

◆ getMwLuaLine()

Scribunto_LuaSandboxEngine::getMwLuaLine ( $lineNum)
protected

Definition at line 203 of file Engine.php.

References Scribunto_LuaEngine\getLuaLibDir().

Referenced by getLimitReportData().

◆ getPerformanceCharacteristics()

Scribunto_LuaSandboxEngine::getPerformanceCharacteristics ( )

Get performance characteristics of the Lua engine/interpreter.

phpCallsRequireSerialization: boolean whether calls between PHP and Lua functions require (slow) serialization of parameters and return values

Returns
array

Reimplemented from Scribunto_LuaEngine.

Definition at line 12 of file Engine.php.

◆ getResourceUsage()

Scribunto_LuaSandboxEngine::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.

Parameters
int$resourceOne of ScribuntoEngineBase::CPU_SECONDS or ScribuntoEngineBase::MEM_PEAK_BYTES.
Returns
float|int|false Resource usage for the specified resource or false if not available.

Reimplemented from ScribuntoEngineBase.

Definition at line 40 of file Engine.php.

References ScribuntoEngineBase\CPU_SECONDS, Scribunto_LuaEngine\load(), and ScribuntoEngineBase\MEM_PEAK_BYTES.

◆ getSoftwareInfo()

Scribunto_LuaSandboxEngine::getSoftwareInfo ( array & $software)

Get software information for Special:Version.

Parameters
array&$software

Reimplemented from ScribuntoEngineBase.

Definition at line 18 of file Engine.php.

References Scribunto_LuaSandboxInterpreter\checkLuaSandboxVersion().

◆ newInterpreter()

Scribunto_LuaSandboxEngine::newInterpreter ( )
protected

Create a new interpreter object.

Returns
Scribunto_LuaInterpreter

Reimplemented from Scribunto_LuaEngine.

Definition at line 210 of file Engine.php.

◆ reportLimitData()

Scribunto_LuaSandboxEngine::reportLimitData ( ParserOutput $output)

Add limit report data to a ParserOutput object.

Parameters
ParserOutput$outputParserOutput object in which to add limit data
Returns
null

Reimplemented from ScribuntoEngineBase.

Definition at line 113 of file Engine.php.

References ParserOutput\addModules(), getLimitReportData(), and ParserOutput\setLimitReportData().

Member Data Documentation

◆ $interpreter

Scribunto_LuaSandboxInterpreter Scribunto_LuaSandboxEngine::$interpreter
protected

Definition at line 10 of file Engine.php.

◆ $lineCache

Scribunto_LuaSandboxEngine::$lineCache = []
protected

Definition at line 5 of file Engine.php.

◆ $loaded

Scribunto_LuaSandboxEngine::$loaded = false

Definition at line 4 of file Engine.php.

◆ $options

Scribunto_LuaSandboxEngine::$options

Definition at line 4 of file Engine.php.


The documentation for this class was generated from the following file: