From 3d0bbafc9a605a4b6ce119b71a0f733e4afcce9d Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 22 May 2013 16:03:02 +0200 Subject: [PATCH] Small optimizations --- .../visitTracker/VisitTracker.class.php | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/wcfsetup/install/files/lib/system/visitTracker/VisitTracker.class.php b/wcfsetup/install/files/lib/system/visitTracker/VisitTracker.class.php index b27cacdce6..f9c1803441 100644 --- a/wcfsetup/install/files/lib/system/visitTracker/VisitTracker.class.php +++ b/wcfsetup/install/files/lib/system/visitTracker/VisitTracker.class.php @@ -165,16 +165,8 @@ class VisitTracker extends SingletonFactory { */ public function trackObjectVisit($objectType, $objectID, $time = TIME_NOW) { if (WCF::getUser()->userID) { - // delete old visit - $sql = "DELETE FROM wcf".WCF_N."_tracked_visit - WHERE objectTypeID = ? - AND objectID = ? - AND userID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->getObjectTypeID($objectType), $objectID, WCF::getUser()->userID)); - // save visit - $sql = "INSERT INTO wcf".WCF_N."_tracked_visit + $sql = "REPLACE INTO wcf".WCF_N."_tracked_visit (objectTypeID, objectID, userID, visitTime) VALUES (?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); @@ -193,15 +185,8 @@ class VisitTracker extends SingletonFactory { */ public function trackTypeVisit($objectType, $time = TIME_NOW) { if (WCF::getUser()->userID) { - // delete old visit - $sql = "DELETE FROM wcf".WCF_N."_tracked_visit_type - WHERE objectTypeID = ? - AND userID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->getObjectTypeID($objectType), WCF::getUser()->userID)); - // save visit - $sql = "INSERT INTO wcf".WCF_N."_tracked_visit_type + $sql = "REPLACE INTO wcf".WCF_N."_tracked_visit_type (objectTypeID, userID, visitTime) VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); -- 2.20.1