]> git.wh0rd.org Git - tt-rss.git/commitdiff
add some more daemon debugging
authorAndrew Dolgov <fox@madoka.spb.ru>
Thu, 15 Mar 2007 04:57:24 +0000 (05:57 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Thu, 15 Mar 2007 04:57:24 +0000 (05:57 +0100)
functions.php
update_daemon.php

index 5bcbfc1d7a3fd3cf02aa92e3edc16975f90eb693..ae663bb8a21aee675b72e8b26f260b7c9ae7ff17 100644 (file)
                }
 
                if (defined('DAEMON_EXTENDED_DEBUG')) {
-                       print "update_rss_feed: start\n";
+                       _debug("update_rss_feed: start");
                }
 
                $result = db_query($link, "SELECT update_interval,auth_login,auth_pass  
                }
 
                if (defined('DAEMON_EXTENDED_DEBUG')) {
-                       print "update_rss_feed: fetching...\n";
+                       _debug("update_rss_feed: fetching...");
                }
 
                if (!defined('DAEMON_EXTENDED_DEBUG')) {
                $rss = fetch_rss($fetch_url);
 
                if (defined('DAEMON_EXTENDED_DEBUG')) {
-                       print "update_rss_feed: fetch done, parsing...\n";
+                       _debug("update_rss_feed: fetch done, parsing...");
                } else {
                        error_reporting (DEFAULT_ERROR_LEVEL);
                }
                        foreach ($iterator as $item) {
 
                                $entry_guid = $item["id"];
-       
+
                                if (!$entry_guid) $entry_guid = $item["guid"];
                                if (!$entry_guid) $entry_guid = $item["link"];
                                if (!$entry_guid) $entry_guid = make_guid_from_title($item["title"]);
 
+                               if (defined('DAEMON_EXTENDED_DEBUG')) {
+                                       _debug("update_rss_feed: guid $entry_guid");
+                               }
+
                                if (!$entry_guid) continue;
 
                                $entry_timestamp = "";
                                
                                $entry_content = sanitize_rss($entry_content);
 
+                               if (defined('DAEMON_EXTENDED_DEBUG')) {
+                                       _debug("update_rss_feed: done collecting data [TITLE:$entry_title]");
+                               }
+
                                db_query($link, "BEGIN");
 
                                if (db_num_rows($result) == 0) {
 
+                                       if (defined('DAEMON_EXTENDED_DEBUG')) {
+                                               _debug("update_rss_feed: base guid not found");
+                                       }
+
                                        // base post entry does not exist, create it
 
                                        $result = db_query($link,
 
                                if (db_num_rows($result) == 1) {
 
+                                       if (defined('DAEMON_EXTENDED_DEBUG')) {
+                                               _debug("update_rss_feed: base guid found, creating user ref");
+                                       }
+
                                        // this will be used below in update handler
                                        $orig_content_hash = db_fetch_result($result, 0, "content_hash");
                                        $orig_title = db_fetch_result($result, 0, "title");
 
                                db_query($link, "COMMIT");
 
+                               if (defined('DAEMON_EXTENDED_DEBUG')) {
+                                       _debug("update_rss_feed: looking for tags...");
+                               }
+
                                /* taaaags */
                                // <a href="http://technorati.com/tag/Xorg" rel="tag">Xorg</a>, //
 
                }
 
                if (defined('DAEMON_EXTENDED_DEBUG')) {
-                       print "update_rss_feed: done\n";
+                       _debug("update_rss_feed: done");
                }
 
        }
        }
 
        function get_script_dt_add() {
-               if (strpos(VERSION, "99") === false) {
+               if (strpos(VERSION, ".99") === false) {
                        return VERSION;
                } else {
                        return time();
index f99e4f76379f13ded6169310c5ac414f1ad38fed..37c04e28fe06ec920afcde5f3e594834a06394e1 100644 (file)
@@ -3,13 +3,19 @@
        // this daemon runs in the background and updates all feeds
        // continuously
 
-       define('DEFAULT_ERROR_LEVEL', E_ALL);
+       // define('DEFAULT_ERROR_LEVEL', E_ALL);
+       define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
 
        declare(ticks = 1);
 
        define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache-daemon');
        define('DISABLE_SESSIONS', true);
-       define('DAEMON_EXTENDED_DEBUG', true);
+
+       require_once "version.php";
+
+       if (strpos(VERSION, ".99") !== false) {
+               define('DAEMON_EXTENDED_DEBUG', true);
+       }
 
        define('PURGE_INTERVAL', 3600); // seconds
 
        require_once "functions.php";
        require_once "magpierss/rss_fetch.inc";
 
-       error_reporting(E_ALL);
+       error_reporting(DEFAULT_ERROR_LEVEL);
 
        function sigint_handler() {
                unlink("update_daemon.lock");
                die("Received SIGINT. Exiting.\n");
        }
 
+//     function sigalrm_handler() {
+//             print "SIGALARM\n";
+//             pcntl_alarm(3);
+//     }
+
        pcntl_signal(SIGINT, sigint_handler);
+//     pcntl_signal(SIGALRM, sigalrm_handler);
 
        $lock_handle = make_lockfile("update_daemon.lock");