diff --git a/classes/dlg.php b/classes/dlg.php
index 324b741fa..6f22c81e6 100644
--- a/classes/dlg.php
+++ b/classes/dlg.php
@@ -18,16 +18,12 @@ class Dlg extends Handler_Protected {
print "
";
- $this->pdo->beginTransaction();
-
print "
";
$opml = new Opml($_REQUEST);
$opml->opml_import($_SESSION["uid"]);
- $this->pdo->commit();
-
print "
";
print "
";
diff --git a/classes/labels.php b/classes/labels.php
index 9c6f22f51..973732b99 100644
--- a/classes/labels.php
+++ b/classes/labels.php
@@ -131,8 +131,13 @@ class Labels
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
$pdo = Db::pdo();
+ $tr_in_progress = false;
- $pdo->beginTransaction();
+ try {
+ $pdo->beginTransaction();
+ } catch (Exception $e) {
+ $tr_in_progress = true;
+ }
$sth = $pdo->prepare("SELECT caption FROM ttrss_labels2
WHERE id = ?");
@@ -163,7 +168,7 @@ class Labels
}
- $pdo->commit();
+ if (!$tr_in_progress) $pdo->commit();
}
static function create($caption, $fg_color = '', $bg_color = '', $owner_uid = false) {
@@ -172,7 +177,13 @@ class Labels
$pdo = Db::pdo();
- $pdo->beginTransaction();
+ $tr_in_progress = false;
+
+ try {
+ $pdo->beginTransaction();
+ } catch (Exception $e) {
+ $tr_in_progress = true;
+ }
$sth = $pdo->prepare("SELECT id FROM ttrss_labels2
WHERE caption = ? AND owner_uid = ?");
@@ -187,7 +198,7 @@ class Labels
$result = $sth->rowCount();
}
- $pdo->commit();
+ if (!$tr_in_progress) $pdo->commit();
return $result;
}
diff --git a/classes/logger/sql.php b/classes/logger/sql.php
index f9f88aac7..120584014 100644
--- a/classes/logger/sql.php
+++ b/classes/logger/sql.php
@@ -7,6 +7,12 @@ class Logger_SQL {
if ($pdo && get_schema_version() > 117) {
+ try {
+ $pdo->rollBack();
+ } catch (Exception $e) {
+ //
+ }
+
$owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : null;
$sth = $pdo->prepare("INSERT INTO ttrss_error_log
diff --git a/classes/opml.php b/classes/opml.php
index 2c2c2ac0e..03156b79f 100644
--- a/classes/opml.php
+++ b/classes/opml.php
@@ -14,7 +14,10 @@ class Opml extends Handler_Protected {
$show_settings = $_REQUEST["settings"];
$owner_uid = $_SESSION["uid"];
- return $this->opml_export($output_name, $owner_uid, false, ($show_settings == 1));
+
+ $rc = $this->opml_export($output_name, $owner_uid, false, ($show_settings == 1));
+
+ return $rc;
}
function import() {
@@ -35,6 +38,7 @@ class Opml extends Handler_Protected {
add_feed_category("Imported feeds");
$this->opml_notice(__("Importing OPML..."));
+
$this->opml_import($owner_uid);
print "