some dbupdater improvements; fix schema 136 syntax for mysql

This commit is contained in:
Andrew Dolgov 2019-03-06 19:42:27 +03:00
parent 0d04e21006
commit 0881d0a00d
3 changed files with 24 additions and 17 deletions

View File

@ -52,7 +52,7 @@ class DbUpdater {
$this->pdo->query($line); // PDO returns errors as exceptions now $this->pdo->query($line); // PDO returns errors as exceptions now
} catch (PDOException $e) { } catch (PDOException $e) {
if ($html_output) { if ($html_output) {
print_error("Error: " . implode(", ", $this->pdo->errorInfo())); print "<div class='text-error'>Error: " . implode(", ", $this->pdo->errorInfo()) . "</div>";
} else { } else {
Debug::log("Error: " . implode(", ", $this->pdo->errorInfo())); Debug::log("Error: " . implode(", ", $this->pdo->errorInfo()));
} }

View File

@ -959,12 +959,12 @@ class Handler_Public extends Handler {
print "<form method='POST' action='public.php'> print "<form method='POST' action='public.php'>
<input type='hidden' name='method' value='do'> <input type='hidden' name='method' value='do'>
<input type='hidden' name='op' value='forgotpass'> <input type='hidden' name='op' value='forgotpass'>
<fieldset> <fieldset>
<label>".__("Login:")."</label> <label>".__("Login:")."</label>
<input dojoType='dijit.form.TextBox' type='text' name='login' value='' required> <input dojoType='dijit.form.TextBox' type='text' name='login' value='' required>
</fieldset> </fieldset>
<fieldset> <fieldset>
<label>".__("Email:")."</label> <label>".__("Email:")."</label>
<input dojoType='dijit.form.TextBox' type='email' name='email' value='' required> <input dojoType='dijit.form.TextBox' type='email' name='email' value='' required>
@ -977,13 +977,13 @@ class Handler_Public extends Handler {
<label>".T_sprintf("How much is %d + %d:", $_SESSION["pwdreset:testvalue1"], $_SESSION["pwdreset:testvalue2"])."</label> <label>".T_sprintf("How much is %d + %d:", $_SESSION["pwdreset:testvalue1"], $_SESSION["pwdreset:testvalue2"])."</label>
<input dojoType='dijit.form.TextBox' type='text' name='test' value='' required> <input dojoType='dijit.form.TextBox' type='text' name='test' value='' required>
</fieldset> </fieldset>
<hr/> <hr/>
<fieldset> <fieldset>
<button dojoType='dijit.form.Button' type='submit' class='alt-danger'>".__("Reset password")."</button> <button dojoType='dijit.form.Button' type='submit' class='alt-danger'>".__("Reset password")."</button>
<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a> <a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>
</fieldset> </fieldset>
</form>"; </form>";
} else if ($method == 'do') { } else if ($method == 'do') {
@ -1036,7 +1036,7 @@ class Handler_Public extends Handler {
$mailer = new Mailer(); $mailer = new Mailer();
$rc = $mailer->mail(["to_name" => $login, $rc = $mailer->mail(["to_name" => $login,
"to_address" => $email, "to_address" => $email,
"subject" => __("[tt-rss] Password reset request"), "subject" => __("[tt-rss] Password reset request"),
"message" => $message]); "message" => $message]);
@ -1133,25 +1133,32 @@ class Handler_Public extends Handler {
if ($op == "performupdate") { if ($op == "performupdate") {
if ($updater->isUpdateRequired()) { if ($updater->isUpdateRequired()) {
print "<h2>" . __("Performing updates") . "</h2>"; print "<h2>" . T_sprintf("Performing updates to schema version %d", SCHEMA_VERSION) . "</h2>";
print "<h3>" . T_sprintf("Updating to schema version %d", SCHEMA_VERSION) . "</h3>";
for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) { for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) {
print_notice(T_sprintf("Performing update up to version %d...", $i)); print "<ul>";
print "<li class='text-info'>" . T_sprintf("Updating to version %d", $i) . "</li>";
print "<li>";
$result = $updater->performUpdateTo($i, true); $result = $updater->performUpdateTo($i, true);
print "</li>";
if (!$result) { if (!$result) {
print "<span class='err'>".__("FAILED!")."</span></li></ul>"; print "</ul>";
print_warning("One of the updates failed. Either retry the process or perform updates manually."); print_error("One of the updates failed. Either retry the process or perform updates manually.");
print "<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>"; print "<form method='POST'>
<input type='hidden' name='subop' value='performupdate'>
<button type='submit' dojoType='dijit.form.Button' class='alt-danger' onclick='return confirmOP()'>".__("Try again")."</button>
<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>
</form>";
return; return;
} else { } else {
print "<span class='ok'>".__("OK!")."</span></li>"; print "<li class='text-success'>" . __("Completed.") . "</li>";
print "</ul>";
} }
} }

View File

@ -1,9 +1,9 @@
begin; begin;
alter table ttrss_archived_feeds add column created datetime; alter table ttrss_archived_feeds add column created datetime;
update ttrss_version set schema_version = 136;
alter table ttrss_archived_feeds alter column created set not null;
update ttrss_archived_feeds set created = NOW(); update ttrss_archived_feeds set created = NOW();
alter table ttrss_archived_feeds change created created bool not null;
update ttrss_version set schema_version = 136;
commit; commit;