]> git.wh0rd.org Git - tt-rss.git/commitdiff
return result codes if DB connection or --debug-feed fails
authorAndrew Dolgov <noreply@fakecake.org>
Tue, 25 Apr 2017 10:39:01 +0000 (13:39 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Tue, 25 Apr 2017 10:39:01 +0000 (13:39 +0300)
classes/db.php
classes/db/mysqli.php
classes/db/pgsql.php
update.php

index c7d6da910dd00a6fb93ee7a3caef3b72fe5242e4..e8cb2deab237cf64f0d7b49247046839b557bd7b 100644 (file)
@@ -23,12 +23,16 @@ class Db implements IDb {
                        }
                }
 
-               if (!$this->adapter) die("Error initializing database adapter for " . DB_TYPE);
+               if (!$this->adapter) {
+                       print("Error initializing database adapter for " . DB_TYPE);
+                       exit(100);
+               }
 
                $this->link = $this->adapter->connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, defined('DB_PORT') ? DB_PORT : "");
 
                if (!$this->link) {
-                       die("Error connecting through adapter: " . $this->adapter->last_error());
+                       print("Error connecting through adapter: " . $this->adapter->last_error());
+                       exit(101);
                }
 
                error_reporting($er);
index a9689df70cde9254c6c1015352857803aac49603..5a3afdda61fa137ca388c0d9f717849705dd10d0 100644 (file)
@@ -14,7 +14,8 @@ class Db_Mysqli implements IDb {
 
                        return $this->link;
                } else {
-                       die("Unable to connect to database (as $user to $host, database $db): " . mysqli_connect_error());
+                       print("Unable to connect to database (as $user to $host, database $db): " . mysqli_connect_error());
+                       exit(102);
                }
        }
 
index 7bacfef60df28046e617d5ba85be46e7dcfd30dd..e8697aba983c972ef4e8085376cf5eb6ebd041fb 100644 (file)
@@ -21,7 +21,8 @@ class Db_Pgsql implements IDb {
                $this->link = pg_connect($string);
 
                if (!$this->link) {
-                       die("Unable to connect to database (as $user to $host, database $db):" . pg_last_error());
+                       print("Unable to connect to database (as $user to $host, database $db):" . pg_last_error());
+                       exit(102);
                }
 
                $this->init();
index 2601e965c7731dd856012e4c62cc91a462216e78..23289f1d1fe539c6c285594c871b9e2f84311790 100755 (executable)
 
                $_REQUEST['xdebug'] = 1;
 
-               update_rss_feed($feed);
+               $rc = is_object(update_rss_feed($feed)) ? 0 : 1;
+
+               exit($rc);
        }
 
        if (isset($options["decrypt-feeds"])) {