Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions emhttp/plugins/dynamix.plugin.manager/scripts/plugin
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ function plugin($method, $plugin_file, &$error) {

// Process FILE elements in order
//
$current_file = 0;
foreach ($xml->FILE as $file) {
$current_file++;
// skip if not our $method
if (isset($file->attributes()->Method)) {
if (!in_array($method, explode(" ", $file->attributes()->Method))) continue;
Expand Down Expand Up @@ -460,10 +462,12 @@ function plugin($method, $plugin_file, &$error) {
my_logger("running: $command $file->LOCAL", $logger);
$retval = run("$command $file->LOCAL");
} elseif ($file->INLINE) {
my_logger("running: 'anonymous'", $logger);
$name = '/tmp/inline.sh';

$name = '/tmp/inline'.$current_file.'-'.pathinfo($plugin_file, PATHINFO_FILENAME).'.sh';
file_put_contents($name, $file->INLINE);
$retval = run("$command $name");
$exec = $command." ".escapeshellarg($name);
my_logger("executing inline script: $exec", $logger);
$retval = run($exec);
unlink($name);
}
if ($retval != 0) {
Expand Down
Loading