@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | return; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - load_user_plugins( $_SESSION["uid"]); |
|
| 71 | + load_user_plugins($_SESSION["uid"]); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $method = strtolower($_REQUEST["op"]); |
@@ -84,6 +84,6 @@ discard block |
||
| 84 | 84 | $handler->after(); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | -header("Api-Content-Length: " . ob_get_length()); |
|
| 87 | +header("Api-Content-Length: ".ob_get_length()); |
|
| 88 | 88 | |
| 89 | 89 | ob_end_flush(); |
@@ -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 | |
@@ -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"); |
|