#!/usr/bin/php -q 'plugin', 'xml' => 'language', '' => 'language']; function write(...$messages){ global $nchan; if ($nchan) { $com = curl_init(); curl_setopt_array($com,[ CURLOPT_URL => 'http://localhost/pub/plugins?buffer_length=1', CURLOPT_UNIX_SOCKET_PATH => '/var/run/nginx.socket', CURLOPT_POST => 1, CURLOPT_RETURNTRANSFER => true ]); foreach ($messages as $message) { curl_setopt($com, CURLOPT_POSTFIELDS, $message); curl_exec($com); } curl_close($com); } else { foreach ($messages as $message) echo $message; } } foreach ($plugins as $plugin) { if (!$plugin || (!$cmd = $call[pathinfo($plugin,PATHINFO_EXTENSION)])) continue; $line = ''; $pluginArg = $method == "update" ? basename($plugin) : $plugin; $run = popen("$cmd $method $pluginArg",'r'); while (!feof($run)) { $line .= fgetc($run); if (!empty($line) && in_array($line[-1],["\r","\n"])) {write($line); $line = '';} } pclose($run); write("\n"); } if ($nchan) write('_DONE_',''); ?>