@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | Debug::set_enabled(true); |
167 | 167 | |
168 | 168 | if (isset($options["log-level"])) { |
169 | - Debug::set_loglevel((int)$options["log-level"]); |
|
169 | + Debug::set_loglevel((int) $options["log-level"]); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | if (isset($options["log"])) { |
173 | 173 | Debug::set_quiet(isset($options['quiet'])); |
174 | 174 | Debug::set_logfile($options["log"]); |
175 | - Debug::log("Logging to " . $options["log"]); |
|
175 | + Debug::log("Logging to ".$options["log"]); |
|
176 | 176 | } else { |
177 | 177 | if (isset($options['quiet'])) { |
178 | 178 | Debug::set_loglevel(Debug::$LOG_DISABLED); |
@@ -497,8 +497,8 @@ discard block |
||
497 | 497 | |
498 | 498 | PluginHost::getInstance()->run_commands($options); |
499 | 499 | |
500 | - if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) { |
|
500 | + if (file_exists(LOCK_DIRECTORY."/$lock_filename")) { |
|
501 | 501 | if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') |
502 | 502 | fclose($lock_handle); |
503 | 503 | } |
504 | - unlink(LOCK_DIRECTORY . "/$lock_filename"); |
|
504 | + unlink(LOCK_DIRECTORY."/$lock_filename"); |
@@ -498,7 +498,8 @@ |
||
498 | 498 | PluginHost::getInstance()->run_commands($options); |
499 | 499 | |
500 | 500 | if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) { |
501 | - if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') |
|
502 | - fclose($lock_handle); |
|
501 | + if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { |
|
502 | + fclose($lock_handle); |
|
503 | + } |
|
503 | 504 | } |
504 | 505 | unlink(LOCK_DIRECTORY . "/$lock_filename"); |
@@ -70,7 +70,7 @@ |
||
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - load_user_plugins( $_SESSION["uid"]); |
|
73 | + load_user_plugins($_SESSION["uid"]); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $method = strtolower($_REQUEST["op"]); |
@@ -38,7 +38,9 @@ |
||
38 | 38 | // fallback on HTTP parameters |
39 | 39 | if ($input) { |
40 | 40 | $input = json_decode($input, true); |
41 | - if ($input) $_REQUEST = $input; |
|
41 | + if ($input) { |
|
42 | + $_REQUEST = $input; |
|
43 | + } |
|
42 | 44 | } |
43 | 45 | } else { |
44 | 46 | // Accept JSON only |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | #!/usr/bin/env php |
2 | 2 | <?php |
3 | -set_include_path(dirname(__FILE__) .DIRECTORY_SEPARATOR."include" . PATH_SEPARATOR . |
|
3 | +set_include_path(dirname(__FILE__).DIRECTORY_SEPARATOR."include".PATH_SEPARATOR. |
|
4 | 4 | get_include_path()); |
5 | 5 | |
6 | -declare(ticks = 1); |
|
6 | +declare(ticks=1); |
|
7 | 7 | chdir(dirname(__FILE__)); |
8 | 8 | |
9 | 9 | define('DISABLE_SESSIONS', true); |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | |
94 | 94 | function shutdown($caller_pid) { |
95 | 95 | if ($caller_pid == posix_getpid()) { |
96 | - if (file_exists(LOCK_DIRECTORY . "/update_daemon.lock")) { |
|
96 | + if (file_exists(LOCK_DIRECTORY."/update_daemon.lock")) { |
|
97 | 97 | Debug::log("removing lockfile (master)..."); |
98 | - unlink(LOCK_DIRECTORY . "/update_daemon.lock"); |
|
98 | + unlink(LOCK_DIRECTORY."/update_daemon.lock"); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | function task_shutdown() { |
104 | 104 | $pid = posix_getpid(); |
105 | 105 | |
106 | - if (file_exists(LOCK_DIRECTORY . "/update_daemon-$pid.lock")) { |
|
106 | + if (file_exists(LOCK_DIRECTORY."/update_daemon-$pid.lock")) { |
|
107 | 107 | Debug::log("removing lockfile ($pid)..."); |
108 | - unlink(LOCK_DIRECTORY . "/update_daemon-$pid.lock"); |
|
108 | + unlink(LOCK_DIRECTORY."/update_daemon-$pid.lock"); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | |
135 | 135 | $options = getopt("", $longopts); |
136 | 136 | |
137 | -if (isset($options["help"]) ) { |
|
137 | +if (isset($options["help"])) { |
|
138 | 138 | print "Tiny Tiny RSS update daemon.\n\n"; |
139 | 139 | print "Options:\n"; |
140 | 140 | print " --log FILE - log messages to FILE\n"; |
141 | 141 | print " --log-level N - log verbosity level\n"; |
142 | 142 | print " --tasks N - amount of update tasks to spawn\n"; |
143 | - print " default: " . MAX_JOBS . "\n"; |
|
143 | + print " default: ".MAX_JOBS."\n"; |
|
144 | 144 | print " --interval N - task spawn interval\n"; |
145 | - print " default: " . SPAWN_INTERVAL . " seconds.\n"; |
|
145 | + print " default: ".SPAWN_INTERVAL." seconds.\n"; |
|
146 | 146 | print " --quiet - don't output messages to stdout\n"; |
147 | 147 | return; |
148 | 148 | } |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | Debug::set_enabled(true); |
151 | 151 | |
152 | 152 | if (isset($options["log-level"])) { |
153 | - Debug::set_loglevel((int)$options["log-level"]); |
|
153 | + Debug::set_loglevel((int) $options["log-level"]); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | if (isset($options["log"])) { |
157 | 157 | Debug::set_quiet(isset($options['quiet'])); |
158 | 158 | Debug::set_logfile($options["log"]); |
159 | - Debug::log("Logging to " . $options["log"]); |
|
159 | + Debug::log("Logging to ".$options["log"]); |
|
160 | 160 | } else { |
161 | 161 | if (isset($options['quiet'])) { |
162 | 162 | Debug::set_loglevel(Debug::$LOG_DISABLED); |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | if (isset($options["tasks"])) { |
167 | - Debug::log("Set to spawn " . $options["tasks"] . " children."); |
|
167 | + Debug::log("Set to spawn ".$options["tasks"]." children."); |
|
168 | 168 | $max_jobs = $options["tasks"]; |
169 | 169 | } else { |
170 | 170 | $max_jobs = MAX_JOBS; |
171 | 171 | } |
172 | 172 | |
173 | 173 | if (isset($options["interval"])) { |
174 | - Debug::log("Spawn interval: " . $options["interval"] . " seconds."); |
|
174 | + Debug::log("Spawn interval: ".$options["interval"]." seconds."); |
|
175 | 175 | $spawn_interval = $options["interval"]; |
176 | 176 | } else { |
177 | 177 | $spawn_interval = SPAWN_INTERVAL; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | $my_pid = posix_getpid(); |
248 | 248 | |
249 | - passthru(PHP_EXECUTABLE . " update.php --daemon-loop $quiet $log --task $j --pidlock $my_pid"); |
|
249 | + passthru(PHP_EXECUTABLE." update.php --daemon-loop $quiet $log --task $j --pidlock $my_pid"); |
|
250 | 250 | |
251 | 251 | sleep(1); |
252 | 252 |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | |
136 | 136 | function pdo_connect($host, $user, $pass, $db, $type, $port = false) { |
137 | 137 | |
138 | - $db_port = $port ? ';port=' . $port : ''; |
|
139 | - $db_host = $host ? ';host=' . $host : ''; |
|
138 | + $db_port = $port ? ';port='.$port : ''; |
|
139 | + $db_host = $host ? ';host='.$host : ''; |
|
140 | 140 | |
141 | 141 | try { |
142 | - $pdo = new PDO($type . ':dbname=' . $db . $db_host . $db_port, |
|
142 | + $pdo = new PDO($type.':dbname='.$db.$db_host.$db_port, |
|
143 | 143 | $user, |
144 | 144 | $pass); |
145 | 145 | |
146 | 146 | return $pdo; |
147 | 147 | } catch (Exception $e) { |
148 | - print "<div class='alert alert-danger'>" . $e->getMessage() . "</div>"; |
|
148 | + print "<div class='alert alert-danger'>".$e->getMessage()."</div>"; |
|
149 | 149 | return null; |
150 | 150 | } |
151 | 151 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | |
440 | 440 | if (!$res) { |
441 | 441 | print_notice("Query: $line"); |
442 | - print_error("Error: " . implode(", ", $pdo->errorInfo())); |
|
442 | + print_error("Error: ".implode(", ", $pdo->errorInfo())); |
|
443 | 443 | } |
444 | 444 | } |
445 | 445 | } |