+ _debug("warning: unable to create stampfile\n");
+ }
+
+ update_daemon_common(isset($options["pidlock"]) ? 50 : DAEMON_FEED_LIMIT);
+
+ if (!isset($options["pidlock"]) || $options["task"] == 0)
+ housekeeping_common(true);
+
+ PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op);
+ }
+
+ if (isset($options["cleanup-tags"])) {
+ $rc = cleanup_tags( 14, 50000);
+ _debug("$rc tags deleted.\n");
+ }
+
+ if (isset($options["indexes"])) {
+ _debug("PLEASE BACKUP YOUR DATABASE BEFORE PROCEEDING!");
+ _debug("Type 'yes' to continue.");
+
+ if (read_stdin() != 'yes')
+ exit;
+
+ _debug("clearing existing indexes...");
+
+ if (DB_TYPE == "pgsql") {
+ $result = db_query( "SELECT relname FROM
+ pg_catalog.pg_class WHERE relname LIKE 'ttrss_%'
+ AND relname NOT LIKE '%_pkey'
+ AND relkind = 'i'");
+ } else {
+ $result = db_query( "SELECT index_name,table_name FROM
+ information_schema.statistics WHERE index_name LIKE 'ttrss_%'");
+ }
+
+ while ($line = db_fetch_assoc($result)) {
+ if (DB_TYPE == "pgsql") {
+ $statement = "DROP INDEX " . $line["relname"];
+ _debug($statement);
+ } else {
+ $statement = "ALTER TABLE ".
+ $line['table_name']." DROP INDEX ".$line['index_name'];
+ _debug($statement);
+ }
+ db_query( $statement, false);