closed internal TODO, merged 2 if() to one + added spaces

Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-03-23 22:16:04 +01:00
parent 11d3fd163a
commit 843b7a003c
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78

View file

@ -1349,12 +1349,11 @@ class App {
// This should prevent the forking of masses of workers. // This should prevent the forking of masses of workers.
$cachekey = "app:proc_run:started"; $cachekey = "app:proc_run:started";
$result = Cache::get($cachekey); $result = Cache::get($cachekey);
/// @TODO maybe merge these both into one if() ?
if (!is_null($result)) { if (!is_null($result) AND (time() - $result) < 10) {
if ((time() - $result) < 10) { return;
return;
}
} }
// Set the timestamp of the last proc_run // Set the timestamp of the last proc_run
Cache::set($cachekey, time(), CACHE_MINUTE); Cache::set($cachekey, time(), CACHE_MINUTE);
@ -1363,16 +1362,17 @@ class App {
// add baseurl to args. cli scripts can't construct it // add baseurl to args. cli scripts can't construct it
$args[] = $this->get_baseurl(); $args[] = $this->get_baseurl();
/// @TODO let's replace these with a foreach($key => $value) loop
for ($x = 0; $x < count($args); $x ++) { for ($x = 0; $x < count($args); $x ++) {
$args[$x] = escapeshellarg($args[$x]); $args[$x] = escapeshellarg($args[$x]);
} }
$cmdline = implode($args," "); $cmdline = implode($args, " ");
if (get_config('system','proc_windows')) { if (get_config('system', 'proc_windows')) {
proc_close(proc_open('cmd /c start /b ' . $cmdline,array(),$foo,dirname(__FILE__))); proc_close(proc_open('cmd /c start /b ' . $cmdline, array(), $foo, dirname(__FILE__)));
} else { } else {
proc_close(proc_open($cmdline." &",array(),$foo,dirname(__FILE__))); proc_close(proc_open($cmdline . " &", array(), $foo, dirname(__FILE__)));
} }
} }