]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
sql optimization: reduce by 9 sql queries when logged in and looking at bookmarks
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Sat, 20 Feb 2010 11:41:01 +0000 (11:41 +0000)
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Sat, 20 Feb 2010 11:41:01 +0000 (11:41 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@681 b3834d28-1941-0410-a4f8-b48e95affb8f

data/templates/bookmarks.tpl.php

index 8f502d3bb69a28d7351f43ae4f9baabedc412085..ad2ecd3b01ac175e4ae86a8c092b4ba80c47a29d 100644 (file)
@@ -222,6 +222,11 @@ if($currenttag!= '') {
         $addresses[$row['bId']] = $row['bAddress'];
     }
     $otherCounts = $bookmarkservice->countOthers($addresses);
+    if ($userservice->isLoggedOn()) {
+        $existence = $bookmarkservice->bookmarksExist(
+            $addresses, $currentUser->getId()
+        );
+    }
 
        foreach ($bookmarks as $key => &$row) {
                switch ($row['bStatus']) {
@@ -284,7 +289,7 @@ if($currenttag!= '') {
                // Copy link
                if ($userservice->isLoggedOn()
             && ($currentUser->getId() != $row['uId'])
-            && !$bookmarkservice->bookmarkExists($row['bAddress'], $currentUser->getId())
+            && !$existence[$row['bAddress']]
         ) {
                        $copy .= ' - <a href="'
                 . createURL('bookmarks', $currentUser->getUsername() .'?action=add&amp;copyOf='. $row['bId'])