#!/usr/bin/php -q '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; } } function process($path) { global $argv; $owner = $argv[2] ?? 'nobody'; $group = $argv[3] ?? 'users'; if (is_dir($path)) { write("Processing: $path\n", "... chmod -R u-x,go-rwx,go+u,ugo+X $path\n"); exec("chmod -R u-x,go-rwx,go+u,ugo+X ".escapeshellarg($path)); write("... chown -R $owner:$group $path\n"); exec("chown -R $owner:$group ".escapeshellarg($path)); write("... sync\n"); exec("sync"); write("\n"); } } $startTime = time(); if ($argv[1]??'') { $paths = explode('*',rawurldecode($argv[1])); foreach ($paths as $path) process($path); } else { $disks = parse_ini_file("/var/local/emhttp/disks.ini",true); foreach ($disks as $disk => $prop) { if (is_dir("/mnt/$disk") && !in_array($prop['status'],['DISK_NP_DSBL','DISK_NP'])) process("/mnt/$disk"); } } $time = time()-$startTime; $hours = floor($time/3600); $mins = floor($time/60)%60; $secs = floor($time%60); write("Completed, elapsed time: ".sprintf('%02d:%02d:%02d', $hours, $mins, $secs)."\n"); if ($nchan) write('_DONE_',''); ?>