use the extension to include output of a local program in a wiki page. use params. do…
- User
use the extension to include output of a local program in a wiki page. use params. do not use legacy functions.
Assistant
I'll help you use the External Data extension to include output from a local program in your MediaWiki page using modern syntax. Based on the provided context, here's how to do it:
Using the
#get_external_dataparser function with program execution parameters:code{{#get_external_data: |program=program_id |command=/path/to/program param1 param2 |format=text |data=output=output }} {{#external_value:output}}Key parameters explained:
program: An identifier for the program (used for caching/throttling)command: The actual command to execute with its parametersformat: The format of the program's output (default is "text")data: Maps the program output to a variable name
Additional optional parameters you can use:
env: Environment variables for the programlimits: Resource limits (time, memory etc.)ignore warnings: Set to true to ignore stderr output if exit code is 0cache seconds: How long to cache the resultstemp: Use a temporary file for output instead of stdout
Example with more parameters:
code{{#get_external_data: |program=date_cmd |command=/bin/date "+%Y-%m-%d %H:%M:%S" |format=text |data=date=output |cache seconds=60 |limits={"time": 5, "memory": [Redacted PhoneNumber]} |env={"TZ": "UTC"} }} Current server time: {{#external_value:date}}Important security notes:
- Shell execution must be enabled on the server
- The program path and parameters need to be pre-configured securely
- Resource limits should be set to prevent abuse
- Consider using caching to reduce program execution frequency
The extension will execute the program, capture its output, and make it available through the
{{#external_value:}}function.For error handling, the extension will show error messages if:
- Shell execution is disabled
- The program returns non-zero exit code
- Resource limits are exceeded
- Required parameters are missing
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.