MediaWiki  1.34.0
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. More...
 
 getPerformanceCharacteristics ()
 Get performance characteristics of the Lua engine/interpreter. More...
 
 getResourceUsage ( $resource)
 Get CPU and memory usage information, if the script engine provides it. More...
 
 getSoftwareInfo (array &$software)
 Get software information for Special:Version. More...
 
 reportLimitData (ParserOutput $output)
 Add limit report data to a ParserOutput object. More...
 
- Public Member Functions inherited from Scribunto_LuaEngine
 addWarning ( $text)
 Adds a warning to be displayed upon preview. More...
 
 callParserFunction ( $frameId, $function, $args)
 Handler for callParserFunction() More...
 
 checkNumber ( $funcName, $args, $index0)
 Workalike for luaL_checknumber() More...
 
 checkString ( $funcName, $args, $index0)
 Workalike for luaL_checkstring() More...
 
 checkType ( $funcName, $args, $index0, $type, $msgType)
 Workalike for luaL_checktype() More...
 
 destroy ()
 
 executeFunctionChunk ( $chunk, $frame)
 Execute a module function chunk. More...
 
 executeModule ( $chunk, $functionName, $frame)
 Execute a module chunk in a new isolated environment, and return the specified function. More...
 
 expandTemplate ( $frameId, $titleText, $args)
 Handler for expandTemplate() More...
 
 frameExists ( $frameId)
 Handler for frameExists() More...
 
 getAllExpandedArguments ( $frameId)
 Handler for getAllExpandedArguments() More...
 
 getCodeEditorLanguage ()
 Get the language for Ace code editor. More...
 
 getExpandedArgument ( $frameId, $name)
 Handler for getExpandedArgument() More...
 
 getFrameTitle ( $frameId)
 Handler for getTitle() More...
 
 getGeSHiLanguage ()
 Get the language for GeSHi syntax highlighter. More...
 
 getInterpreter ()
 Get the current interpreter object. More...
 
 getLuaLibDir ()
 Return the base path for Lua modules. More...
 
 incrementExpensiveFunctionCount ()
 Increment the expensive function count, and throw if limit exceeded. More...
 
 isSubsting ()
 Return whether the parser is currently substing. More...
 
 load ()
 Initialise the interpreter and the base environment. More...
 
 loadPackage ( $name)
 Handler for the loadPackage() callback. More...
 
 loadPHPLibrary ( $name)
 Handler for the loadPHPLibrary() callback. More...
 
 newChildFrame ( $frameId, $title, array $args)
 Handler for newChildFrame() More...
 
 newLuaError ( $message, $params=[])
 
 preprocess ( $frameId, $text)
 Handler for preprocess() More...
 
 registerInterface ( $moduleFileName, $interfaceFuncs, $setupOptions=[])
 Register a Lua Library. More...
 
 runConsole (array $params)
 Run an interactive console request. More...
 
 setTTL ( $ttl)
 Handler for setTTL() More...
 
- 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. More...
 
 getDefaultExceptionParams ()
 
 getOption ( $optionName)
 Get an element from the configuration array. More...
 
 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. More...
 

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. More...
 
- Protected Member Functions inherited from Scribunto_LuaEngine
 formatHtmlLogs ( $logs, $localize)
 Format the logged data for HTML output. More...
 
 getFrameById ( $frameId)
 Helper function for the implementation of frame methods. More...
 
 getLogBuffer ()
 Get data logged by modules. More...
 
 loadLibraryFromFile ( $fileName)
 Load a library from the given file and execute it in the base environment. More...
 
 newModule ( $text, $chunkName)
 
 normalizeModuleFileName ( $fileName)
 Normalize a lua module to its full path. More...
 
- Protected Member Functions inherited from ScribuntoEngineBase
 getLibraries ( $engine, array $coreLibraries=[])
 Load a list of all libraries supported by this engine. More...
 
 getLibraryPaths ( $engine, array $coreLibraryPaths=[])
 Load a list of all paths libraries can be in for this engine. More...
 

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. More...
 
- Static Protected Attributes inherited from Scribunto_LuaEngine
static array $libraryClasses
 Libraries to load. More...
 
static array $libraryPaths
 Paths for modules that may be loaded from Lua. More...
 

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, Language\factory(), Scribunto_LuaEngine\formatHtmlLogs(), Title\hasContentModel(), Linker\link(), Title\newFromText(), 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 $output, and getLimitReportData().

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: