require_once "sanity_check.php";
require_once "db.php";
require_once "db-prefs.php";
- require_once "errorhandler.php";
if (!defined('PHP_EXECUTABLE'))
define('PHP_EXECUTABLE', '/usr/bin/php');
"quiet",
"log:",
"indexes",
+ "pidlock:",
"update-schema",
"convert-filters",
"force-update",
return;
}
+ if (!isset($options['daemon'])) {
+ require_once "errorhandler.php";
+ }
+
if (!isset($options['update-schema'])) {
$schema_version = get_schema_version();
$lock_filename = $lock_filename . "-task_" . $options["task"];
}
+ if (isset($options["pidlock"])) {
+ $my_pid = $options["pidlock"];
+ $lock_filename = "update_daemon-$my_pid.lock";
+
+ }
+
+ _debug("Lock: $lock_filename");
+
$lock_handle = make_lockfile($lock_filename);
$must_exit = false;
+ if (isset($options["task"])) {
+ $waits = $options["task"] * 5;
+ _debug("Waiting before update ($waits)");
+ sleep($waits);
+ }
+
// Try to lock a file in order to avoid concurrent update.
if (!$lock_handle) {
die("error: Can't create lockfile ($lock_filename). ".
}
if (isset($options["list-plugins"])) {
- $tmppluginhost = new PluginHost();
+ $tmppluginhost = new PluginHost(Db::get());
$tmppluginhost->load_all($tmppluginhost::KIND_ALL);
$enabled = array_map("trim", explode(",", PLUGINS));