Help:Extension/ScriptFunctions
From Metabolomics.JP
Extension Information | |
Implementation | |
Description | |
Author(s) | K, Suwa |
Version | 0.2 |
MediaWiki | |
License | |
Hooks used | |
Token type | Parser function |
Contents |
Extension to use an external scripting language, Lua.
Since an infinite loop can be achieved by Lua, script_monitoring.sh run by crond will kill all Lua processes running longer than 10 seconds.
For security, Lua's io, debug, package, os library are nullified. Also, the program halts when it finds 'dofile'.
Example
{{#lua:luaコード|標準入力}}
第一引数にコード、第二引数に標準入力文字列を渡します。第二引数はコード中で「stdin」として利用できます。
- ソース
{{#lua:print(stdin)|input string}}
- 実行例
input string
Requirements
Download
version | source | md5 | OperationCheck version |
0.2(July 31,2010) | ScriptFunctions.phps | 06836d5073909109d6cbc5dc976d8456 | 1.11.1, 1.16.2 |
0.1(October 7,2008) | ScriptFunctions-0.1.phps | 394b55519d7449f06cbf34b4ed845570 | 1.11.1 |
version | source | md5 |
0.1(September 30,2008) | script_monitoring.sh | eedd37d4618802a48fd5b26d8dbfedfb |
Installtion
- Download the source code and rename it to ScriptFunctions.php and script_monitoring.sh.
- Place it in the extensions/ directory.
- Insert the follow lines to LocalSettings.php
require_once( "$IP/extensions/ScriptFunctions.php" ); $egLuaPath = "path to directory which in lua binary"; $egTmpPath = "path to tmp directory"; ( default: "/tmp" )
$egLuaPath is required.
$egTmpPath is a temporary place to save Lua programs.
- Put in any direcotry.( ideal: /etc/cron.d/ )
- Insert follow line to /etc/crontab
* * * * * root /etc/cron.d/script_monitoring.sh
- 実行可能パーミッションを付加します。 Give executable permission.
chmod 755 /etc/cron.d/script_monitoring.sh
Function
ChangeLog
0.2
- 引数に"[[-]]"を受け取れないバグを修正しました。
- mediawiki 1.12に対応しました。