]> git.wh0rd.org - tt-rss.git/blobdiff - include/functions.php
auth/base: PDO
[tt-rss.git] / include / functions.php
index 07f4f0f641023488d5aca5ba2720485ba8444c07..e7d74df04e23727b33c30c9e5d86f351ad38edec 100644 (file)
                                marked = false AND
                                feed_id = ? AND
                                $query_limit
-                               ttrss_entries.date_updated < NOW() - INTERVAL ?");
-                       $sth->execute([$feed_id, "$purge_interval days"]);
+                               ttrss_entries.date_updated < NOW() - INTERVAL ? days");
+                       $sth->execute([$feed_id, $purge_interval]);
 
                } else {
             $sth  = $pdo->prepare("DELETE FROM ttrss_user_entries
 
                if (get_schema_version() < 63) $profile_qpart = "";
 
-               ////db_query("BEGIN");
-
         $pdo = DB::pdo();
 
+        $pdo->beginTransaction();
+
                $sth = $pdo->query("SELECT pref_name,def_value FROM ttrss_prefs");
 
         $profile = $profile ? $profile : null;
                        }
                }
 
-               ////db_query("COMMIT");
+               $pdo->commit();
 
        }
 
 
                if (!$feed_cat) return false;
 
-               ////db_query("BEGIN");
-
                $feed_cat = mb_substr($feed_cat, 0, 250);
 
                $pdo = Db::pdo();
+               $pdo->beginTransaction();
 
                $sth = $pdo->prepare("SELECT id FROM ttrss_feed_categories
                                WHERE (:parent IS NULL AND parent_cat IS NULL OR parent_cat = :parent) 
                                        VALUES (?, ?, ?)");
                        $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id]);
 
-                       //db_query("COMMIT");
+                       $pdo->commit();
 
                        return true;
                }
 
+        $pdo->commit();
+
                return false;
        }