@@ -12,14 +12,22 @@ discard block |
||
12 | 12 | |
13 | 13 | public function sh_exec(string $cmd, string $outputfile = "", string $pidfile = "", bool $mergestderror = true, bool $bg = false) { |
14 | 14 | $fullcmd = $cmd; |
15 | - if(strlen($outputfile) > 0) $fullcmd .= " >> " . $outputfile; |
|
16 | - if($mergestderror) $fullcmd .= " 2>&1"; |
|
15 | + if(strlen($outputfile) > 0) { |
|
16 | + $fullcmd .= " >> " . $outputfile; |
|
17 | + } |
|
18 | + if($mergestderror) { |
|
19 | + $fullcmd .= " 2>&1"; |
|
20 | + } |
|
17 | 21 | |
18 | 22 | if($bg) { |
19 | 23 | $fullcmd = "nohup " . $fullcmd . " &"; |
20 | - if(strlen($pidfile)) $fullcmd .= " echo $! > " . $pidfile; |
|
24 | + if(strlen($pidfile)) { |
|
25 | + $fullcmd .= " echo $! > " . $pidfile; |
|
26 | + } |
|
21 | 27 | } else { |
22 | - if(strlen($pidfile) > 0) $fullcmd .= "; echo $$ > " . $pidfile; |
|
28 | + if(strlen($pidfile) > 0) { |
|
29 | + $fullcmd .= "; echo $$ > " . $pidfile; |
|
30 | + } |
|
23 | 31 | } |
24 | 32 | shell_exec($fullcmd); |
25 | 33 | } |
@@ -76,10 +84,11 @@ discard block |
||
76 | 84 | $result = $stmt->get_result(); |
77 | 85 | $video = $result->fetch_assoc(); |
78 | 86 | |
79 | - if($result->num_rows === 0) |
|
80 | - return 0; |
|
81 | - else |
|
82 | - return $video; |
|
87 | + if($result->num_rows === 0) { |
|
88 | + return 0; |
|
89 | + } else { |
|
90 | + return $video; |
|
91 | + } |
|
83 | 92 | |
84 | 93 | $stmt->close(); |
85 | 94 | } |