]> git.wh0rd.org - tt-rss.git/blobdiff - db-updater.php
update_daemon: use getopt; make things a bit more configurable, add help
[tt-rss.git] / db-updater.php
index edee3bc83341369fc5cb2af7ab01c6567ddc8c26..e6b3db06a466abc0fb77ae6e4001136030ff497c 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+       set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
+               get_include_path());
+
        require_once "functions.php";
        require_once "sessions.php";
        require_once "sanity_check.php";
@@ -7,7 +10,7 @@
 
        $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
 
-       init_connection($link);
+       if (!init_connection($link)) return;
        login_sequence($link);
 
        $owner_uid = $_SESSION["uid"];
@@ -87,7 +90,7 @@ function confirmOP() {
 
                } else {
                        print_notice(__("Tiny Tiny RSS database is up to date."));
-                       print "<form method=\"GET\" action=\"tt-rss.php\">
+                       print "<form method=\"GET\" action=\"index.php\">
                                <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
                                </form>";
                }
@@ -122,6 +125,7 @@ function confirmOP() {
                foreach (array_keys($update_versions) as $v) {
                        if ($v == $version + 1) {
                                print "<p>".T_sprintf("Updating to version %d...", $v)."</p>";
+                               db_query($link, "BEGIN");
                                $fp = fopen($update_versions[$v], "r");
                                if ($fp) {
                                        while (!feof($fp)) {
@@ -133,6 +137,7 @@ function confirmOP() {
                                        }
                                }
                                fclose($fp);
+                               db_query($link, "COMMIT");
 
                                print "<p>".__("Checking version... ");