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
-
Install the External Data extension. Follow the instructions at https://www.mediawiki.org/wiki/Extension:External_Data#Installation. Ensure the necessary PHP extensions are installed based on the program you intend to run (e.g.,
ext-ldap,ext-odbc, etc.). Thecomposer.jsonfile lists suggested extensions. Also, ensure that shell access is enabled on your server, as shell access is required for executing external programs. -
Configure the program in LocalSettings.php. Define the program and its command within the
$wgExternalDataSourcesarray. This configuration stores the command as a secret, improving security. Replace/path/to/your/programandarg1 arg2with the actual path and arguments:
php$wgExternalDataSources['my_program_id'] = [ 'command' => '/path/to/your/program arg1 arg2', // Optional: set limits for execution time, memory usage, etc. 'limits' => [ 'time' => 30, // seconds 'memory' => 1024 * 1024 * 64, // bytes 'filesize' => 1024 * 1024 * 16, // bytes ], // Optional: ignore warnings in stderr if exit code is 0. 'ignore warnings' => true, // Optional: get output from a temporary file. 'temp' => '$tmp$/tempfile.txt', // Optional: specify minimum cache time. // 'min cache seconds' => 300, ];- Include the program output in a wiki page. Use the
#external_valueparser function, providing the program ID and any required parameters. Thedataparameter maps the external data to local variables. In this example, the entire output is mapped to the variableprogram_output:
wiki{{#external_value:program_output|program=my_program_id|data=program_output=program_output}} <pre> {{{program_output}}} </pre>-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.