diff options
Diffstat (limited to 'update.php')
-rwxr-xr-x | update.php | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/update.php b/update.php index ab6272c83..4aff4a774 100755 --- a/update.php +++ b/update.php @@ -14,7 +14,7 @@ require_once "db-prefs.php"; function make_stampfile($filename) { - $fp = fopen(LOCK_DIRECTORY . "/$filename", "w"); + $fp = fopen(Config::get(Config::LOCK_DIRECTORY) . "/$filename", "w"); if (flock($fp, LOCK_EX | LOCK_NB)) { fwrite($fp, time() . "\n"); @@ -30,9 +30,9 @@ $days = (int) $days; - if (DB_TYPE == "pgsql") { + if (Config::get(Config::DB_TYPE) == "pgsql") { $interval_query = "date_updated < NOW() - INTERVAL '$days days'"; - } else /*if (DB_TYPE == "mysql") */ { + } else /*if (Config::get(Config::DB_TYPE) == "mysql") */ { $interval_query = "date_updated < DATE_SUB(NOW(), INTERVAL $days DAY)"; } @@ -224,7 +224,7 @@ $log = isset($options['log']) ? '--log '.$options['log'] : ''; $log_level = isset($options['log-level']) ? '--log-level '.$options['log-level'] : ''; - passthru(PHP_EXECUTABLE . " " . $argv[0] ." --daemon-loop $quiet $log $log_level"); + passthru(Config::get(Config::PHP_EXECUTABLE) . " " . $argv[0] ." --daemon-loop $quiet $log $log_level"); // let's enforce a minimum spawn interval as to not forkbomb the host $spawn_interval = max(60, DAEMON_SLEEP_INTERVAL); @@ -277,7 +277,7 @@ Debug::log("clearing existing indexes..."); - if (DB_TYPE == "pgsql") { + if (Config::get(Config::DB_TYPE) == "pgsql") { $sth = $pdo->query( "SELECT relname FROM pg_catalog.pg_class WHERE relname LIKE 'ttrss_%' AND relname NOT LIKE '%_pkey' @@ -288,7 +288,7 @@ } while ($line = $sth->fetch()) { - if (DB_TYPE == "pgsql") { + if (Config::get(Config::DB_TYPE) == "pgsql") { $statement = "DROP INDEX " . $line["relname"]; Debug::log($statement); } else { @@ -299,9 +299,9 @@ $pdo->query($statement); } - Debug::log("reading indexes from schema for: " . DB_TYPE); + Debug::log("reading indexes from schema for: " . Config::get(Config::DB_TYPE)); - $fp = fopen("schema/ttrss_schema_" . DB_TYPE . ".sql", "r"); + $fp = fopen("schema/ttrss_schema_" . Config::get(Config::DB_TYPE) . ".sql", "r"); if ($fp) { while ($line = fgets($fp)) { $matches = array(); @@ -375,14 +375,14 @@ } if (isset($options["update-schema"])) { - Debug::log("Checking for updates (" . DB_TYPE . ")..."); + Debug::log("Checking for updates (" . Config::get(Config::DB_TYPE) . ")..."); - $updater = new DbUpdater(Db::pdo(), DB_TYPE, SCHEMA_VERSION); + $updater = new DbUpdater(Db::pdo(), Config::get(Config::DB_TYPE), SCHEMA_VERSION); if ($updater->is_update_required()) { Debug::log("Schema update required, version " . $updater->get_schema_version() . " to " . SCHEMA_VERSION); - if (DB_TYPE == "mysql") + if (Config::get(Config::DB_TYPE) == "mysql") Debug::Log("READ THIS: Due to MySQL limitations, your database is not completely protected while updating.\n". "Errors may put it in an inconsistent state requiring manual rollback.\nBACKUP YOUR DATABASE BEFORE CONTINUING."); else @@ -460,7 +460,7 @@ if (isset($options["list-plugins"])) { $tmppluginhost = new PluginHost(); $tmppluginhost->load_all($tmppluginhost::KIND_ALL); - $enabled = array_map("trim", explode(",", PLUGINS)); + $enabled = array_map("trim", explode(",", Config::get(Config::PLUGINS))); echo "List of all available plugins:\n"; @@ -515,8 +515,8 @@ PluginHost::getInstance()->run_commands($options); - if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) + if (file_exists(Config::get(Config::LOCK_DIRECTORY) . "/$lock_filename")) if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') fclose($lock_handle); - unlink(LOCK_DIRECTORY . "/$lock_filename"); + unlink(Config::get(Config::LOCK_DIRECTORY) . "/$lock_filename"); ?> |