]> git.wh0rd.org Git - tt-rss.git/commitdiff
move db-updater functionality to public, remove db-updater.php
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 4 Apr 2013 15:45:26 +0000 (19:45 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 4 Apr 2013 15:45:26 +0000 (19:45 +0400)
cache/.htaccess [changed mode: 0644->0755]
cache/images/.empty [changed mode: 0644->0755]
cache/js/.empty [changed mode: 0644->0755]
cache/simplepie/.empty [changed mode: 0644->0755]
classes/handler/public.php
feed-icons/.empty [changed mode: 0644->0755]
js/functions.js
lock/.empty [changed mode: 0644->0755]
lock/.htaccess [changed mode: 0644->0755]
plugins/digest/digest.js
utility.css

old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 3d3d6727d8d7be97d56acac99e10196d2bf5b612..e95f118bbd381c910c31a8462f04fabd80f9f513 100644 (file)
@@ -838,12 +838,115 @@ class Handler_Public extends Handler {
        }
 
        function dbupdate() {
+               if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) {
+                       $_SESSION["login_error_msg"] = __("Your access level is insufficient to run this script.");
+                       render_login_form($link);
+                       exit;
+               }
+
+               ?><html>
+                       <head>
+                       <title>Database Updater</title>
+                       <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+                       <link rel="stylesheet" type="text/css" href="utility.css"/>
+                       </head>
+                       <style type="text/css">
+                               span.ok { color : #009000; font-weight : bold; }
+                               span.err { color : #ff0000; font-weight : bold; }
+                       </style>
+               <body>
+                       <script type='text/javascript'>
+                       function confirmOP() {
+                               return confirm("Update the database?");
+                       }
+                       </script>
+
+                       <div class="floatingLogo"><img src="images/logo_small.png"></div>
+
+                       <h1><?php echo __("Database Updater") ?></h1>
+
+                       <div class="content">
+
+                       <?php
+                               @$op = $_REQUEST["subop"];
+                               $updater = new DbUpdater($this->link, DB_TYPE, SCHEMA_VERSION);
+
+                               if ($op == "performupdate") {
+                                       if ($updater->isUpdateRequired()) {
+
+                                               print "<h2>Performing updates</h2>";
+
+                                               print "<h3>Updating to schema version " . SCHEMA_VERSION . "</h3>";
+
+                                               print "<ul>";
+
+                                               for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) {
+                                                       print "<li>Performing update up to version $i...";
+
+                                                       $result = $updater->performUpdateTo($i);
+
+                                                       if (!$result) {
+                                                               print "<span class='err'>FAILED!</span></li></ul>";
+
+                                                               print_warning("One of the updates failed. Either retry the process or perform updates manually.");
+                                                               print "<p><form method=\"GET\" action=\"index.php\">
+                                                               <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
+                                                               </form>";
+
+                                                               break;
+                                                       } else {
+                                                               print "<span class='ok'>OK!</span></li>";
+                                                       }
+                                               }
+
+                                               print "</ul>";
 
+                                               print_notice("Your Tiny Tiny RSS database is now updated to the latest version.");
 
+                                               print "<p><form method=\"GET\" action=\"index.php\">
+                                               <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
+                                               </form>";
+
+                                       } else {
+                                               print "<h2>Your database is up to date.</h2>";
+
+                                               print "<p><form method=\"GET\" action=\"index.php\">
+                                               <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
+                                               </form>";
+                                       }
+                               } else {
+                                       if ($updater->isUpdateRequired()) {
+
+                                               print "<h2>Database update required</h2>";
 
+                                               print "<h3>";
+                                               printf("Your Tiny Tiny RSS database needs update to the latest version: %d to %d.",
+                                                       $updater->getSchemaVersion(), SCHEMA_VERSION);
+                                               print "</h3>";
 
+                                               print_warning("Please backup your database before proceeding.");
 
+                                               print "<form method='POST'>
+                                                       <input type='hidden' name='subop' value='performupdate'>
+                                                       <input type='submit' onclick='return confirmOP()' value='".__("Perform updates")."'>
+                                               </form>";
+
+                                       } else {
+
+                                               print "<h2>" . "Tiny Tiny RSS database is up to date." . "</h2>";
+
+                                               print "<p><form method=\"GET\" action=\"index.php\">
+                                                       <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
+                                               </form>";
+
+                                       }
+                               }
+                       ?>
 
+                       </div>
+                       </body>
+                       </html>
+               <?php
        }
 
 }
old mode 100644 (file)
new mode 100755 (executable)
index 4e4d035572ec4e06fe72cb940cc3cf8b74886a95..82cfa90549d27dccf83f1065ebea817ec2c365b2 100644 (file)
@@ -508,7 +508,7 @@ function fatalError(code, msg, ext_info) {
                if (code == 6) {
                        window.location.href = "index.php";
                } else if (code == 5) {
-                       window.location.href = "db-updater.php";
+                       window.location.href = "public.php?op=dbupdate";
                } else {
 
                        if (msg == "") msg = "Unknown error";
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 5815e60e538286750af9d1016c5a083bd8475b0e..e3cb1e299ed3b9d3b6359d7488befc48341a5485 100644 (file)
@@ -772,7 +772,7 @@ function fatal_error(code, msg) {
                if (code == 6) {
                        window.location.href = "digest.php";
                } else if (code == 5) {
-                       window.location.href = "db-updater.php";
+                       window.location.href = "public.php?op=dbupdate";
                } else {
 
                        if (msg == "") msg = "Unknown error";
index dd39cb32b7574ebdcbae5fd67a3fd30cf23dc32b..308b71fd033a932ed679eb46725f2b80ebdd3892 100644 (file)
@@ -93,6 +93,10 @@ h2 {
        border-style : solid; 
 }
 
+div.content > h2 {
+       margin-top : 0px;
+}
+
 div.rss h1 {
        border-width : 0px 0px 1px 0px;
        border-color : gray;