@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | #!/usr/bin/env php |
2 | 2 | <?php |
3 | - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
3 | + set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
4 | 4 | get_include_path()); |
5 | 5 | |
6 | 6 | define('DISABLE_SESSIONS', true); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | "help"); |
89 | 89 | |
90 | 90 | foreach (PluginHost::getInstance()->get_commands() as $command => $data) { |
91 | - array_push($longopts, $command . $data["suffix"]); |
|
91 | + array_push($longopts, $command.$data["suffix"]); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | $options = getopt("", $longopts); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | exit; |
120 | 120 | } |
121 | 121 | |
122 | - if (count($options) == 0 || isset($options["help"]) ) { |
|
122 | + if (count($options) == 0 || isset($options["help"])) { |
|
123 | 123 | print "Tiny Tiny RSS data update script.\n\n"; |
124 | 124 | print "Options:\n"; |
125 | 125 | print " --feeds - update feeds\n"; |
@@ -165,13 +165,13 @@ discard block |
||
165 | 165 | Debug::set_enabled(true); |
166 | 166 | |
167 | 167 | if (isset($options["log-level"])) { |
168 | - Debug::set_loglevel((int)$options["log-level"]); |
|
168 | + Debug::set_loglevel((int) $options["log-level"]); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | if (isset($options["log"])) { |
172 | 172 | Debug::set_quiet(isset($options['quiet'])); |
173 | 173 | Debug::set_logfile($options["log"]); |
174 | - Debug::log("Logging to " . $options["log"]); |
|
174 | + Debug::log("Logging to ".$options["log"]); |
|
175 | 175 | } else { |
176 | 176 | if (isset($options['quiet'])) { |
177 | 177 | Debug::set_loglevel(Debug::$LOG_DISABLED); |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | if (isset($options["task"])) { |
188 | - Debug::log("Using task id " . $options["task"]); |
|
189 | - $lock_filename = $lock_filename . "-task_" . $options["task"]; |
|
188 | + Debug::log("Using task id ".$options["task"]); |
|
189 | + $lock_filename = $lock_filename."-task_".$options["task"]; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | if (isset($options["pidlock"])) { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | if (isset($options["force-update"])) { |
216 | 216 | Debug::log("marking all feeds as needing update..."); |
217 | 217 | |
218 | - $pdo->query( "UPDATE ttrss_feeds SET |
|
218 | + $pdo->query("UPDATE ttrss_feeds SET |
|
219 | 219 | last_update_started = '1970-01-01', last_updated = '1970-01-01'"); |
220 | 220 | } |
221 | 221 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $log = isset($options['log']) ? '--log '.$options['log'] : ''; |
233 | 233 | $log_level = isset($options['log-level']) ? '--log-level '.$options['log-level'] : ''; |
234 | 234 | |
235 | - passthru(PHP_EXECUTABLE . " " . $argv[0] ." --daemon-loop $quiet $log $log_level"); |
|
235 | + passthru(PHP_EXECUTABLE." ".$argv[0]." --daemon-loop $quiet $log $log_level"); |
|
236 | 236 | |
237 | 237 | // let's enforce a minimum spawn interval as to not forkbomb the host |
238 | 238 | $spawn_interval = max(60, DAEMON_SLEEP_INTERVAL); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | if (isset($options["cleanup-tags"])) { |
259 | - $rc = cleanup_tags( 14, 50000); |
|
259 | + $rc = cleanup_tags(14, 50000); |
|
260 | 260 | Debug::log("$rc tags deleted.\n"); |
261 | 261 | } |
262 | 262 | |
@@ -270,18 +270,18 @@ discard block |
||
270 | 270 | Debug::log("clearing existing indexes..."); |
271 | 271 | |
272 | 272 | if (DB_TYPE == "pgsql") { |
273 | - $sth = $pdo->query( "SELECT relname FROM |
|
273 | + $sth = $pdo->query("SELECT relname FROM |
|
274 | 274 | pg_catalog.pg_class WHERE relname LIKE 'ttrss_%' |
275 | 275 | AND relname NOT LIKE '%_pkey' |
276 | 276 | AND relkind = 'i'"); |
277 | 277 | } else { |
278 | - $sth = $pdo->query( "SELECT index_name,table_name FROM |
|
278 | + $sth = $pdo->query("SELECT index_name,table_name FROM |
|
279 | 279 | information_schema.statistics WHERE index_name LIKE 'ttrss_%'"); |
280 | 280 | } |
281 | 281 | |
282 | 282 | while ($line = $sth->fetch()) { |
283 | 283 | if (DB_TYPE == "pgsql") { |
284 | - $statement = "DROP INDEX " . $line["relname"]; |
|
284 | + $statement = "DROP INDEX ".$line["relname"]; |
|
285 | 285 | Debug::log($statement); |
286 | 286 | } else { |
287 | 287 | $statement = "ALTER TABLE ". |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | $pdo->query($statement); |
292 | 292 | } |
293 | 293 | |
294 | - Debug::log("reading indexes from schema for: " . DB_TYPE); |
|
294 | + Debug::log("reading indexes from schema for: ".DB_TYPE); |
|
295 | 295 | |
296 | - $fp = fopen("schema/ttrss_schema_" . DB_TYPE . ".sql", "r"); |
|
296 | + $fp = fopen("schema/ttrss_schema_".DB_TYPE.".sql", "r"); |
|
297 | 297 | if ($fp) { |
298 | 298 | while ($line = fgets($fp)) { |
299 | 299 | $matches = array(); |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | $filter = array(); |
337 | 337 | |
338 | 338 | if (sql_bool_to_bool($line["cat_filter"])) { |
339 | - $feed_id = "CAT:" . (int)$line["cat_id"]; |
|
339 | + $feed_id = "CAT:".(int) $line["cat_id"]; |
|
340 | 340 | } else { |
341 | - $feed_id = (int)$line["feed_id"]; |
|
341 | + $feed_id = (int) $line["feed_id"]; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | $filter["enabled"] = $line["enabled"] ? "on" : "off"; |
@@ -367,12 +367,12 @@ discard block |
||
367 | 367 | } |
368 | 368 | |
369 | 369 | if (isset($options["update-schema"])) { |
370 | - Debug::log("Checking for updates (" . DB_TYPE . ")..."); |
|
370 | + Debug::log("Checking for updates (".DB_TYPE.")..."); |
|
371 | 371 | |
372 | 372 | $updater = new DbUpdater(DB_TYPE, SCHEMA_VERSION); |
373 | 373 | |
374 | 374 | if ($updater->isUpdateRequired()) { |
375 | - Debug::log("Schema update required, version " . $updater->getSchemaVersion() . " to " . SCHEMA_VERSION); |
|
375 | + Debug::log("Schema update required, version ".$updater->getSchemaVersion()." to ".SCHEMA_VERSION); |
|
376 | 376 | |
377 | 377 | if (DB_TYPE == "mysql") |
378 | 378 | Debug::Log("READ THIS: Due to MySQL limitations, your database is not completely protected while updating.\n". |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | if (read_stdin() != 'yes') |
386 | 386 | exit; |
387 | 387 | |
388 | - Debug::log("Performing updates to version " . SCHEMA_VERSION); |
|
388 | + Debug::log("Performing updates to version ".SCHEMA_VERSION); |
|
389 | 389 | |
390 | 390 | for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) { |
391 | 391 | Debug::log("* Updating to version $i..."); |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | while (true) { |
429 | 429 | |
430 | 430 | while ($line = $sth->fetch()) { |
431 | - $tsvector_combined = mb_substr(strip_tags($line["title"] . " " . $line["content"]), 0, 1000000); |
|
431 | + $tsvector_combined = mb_substr(strip_tags($line["title"]." ".$line["content"]), 0, 1000000); |
|
432 | 432 | |
433 | 433 | $usth->execute([$tsvector_combined, $line['id']]); |
434 | 434 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | |
486 | 486 | PluginHost::getInstance()->run_commands($options); |
487 | 487 | |
488 | - if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) |
|
488 | + if (file_exists(LOCK_DIRECTORY."/$lock_filename")) |
|
489 | 489 | if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') |
490 | 490 | fclose($lock_handle); |
491 | - unlink(LOCK_DIRECTORY . "/$lock_filename"); |
|
491 | + unlink(LOCK_DIRECTORY."/$lock_filename"); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | } |
15 | 15 | |
16 | 16 | public function get_js() { |
17 | - return file_get_contents(__DIR__ . "/init.js"); |
|
17 | + return file_get_contents(__DIR__."/init.js"); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function api_version() { |
@@ -14,7 +14,7 @@ |
||
14 | 14 | } |
15 | 15 | |
16 | 16 | public function get_js() { |
17 | - return file_get_contents(__DIR__ . "/init.js"); |
|
17 | + return file_get_contents(__DIR__."/init.js"); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function api_version() { |
@@ -14,7 +14,7 @@ |
||
14 | 14 | } |
15 | 15 | |
16 | 16 | public function get_js() { |
17 | - return file_get_contents(__DIR__ . "/init.js"); |
|
17 | + return file_get_contents(__DIR__."/init.js"); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function api_version() { |