summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2010-02-20 10:57:52 +0100
committerChristian Weiske <cweiske@cweiske.de>2010-02-20 10:57:52 +0100
commit1fd4d4d9fc4952cd14fb1b62a24ae168a8e9ebda (patch)
tree1f84e5310a60426b453da40d406962d3fa314330
parent10c6863b9eec625d0cba709f1645c2aae77446fb (diff)
downloadSemanticScuttle-1fd4d4d9fc4952cd14fb1b62a24ae168a8e9ebda.zip
SemanticScuttle-1fd4d4d9fc4952cd14fb1b62a24ae168a8e9ebda.tar.gz
SemanticScuttle-1fd4d4d9fc4952cd14fb1b62a24ae168a8e9ebda.tar.bz2
sql optimization: reduce by 9 sql queries when logged in and looking at bookmarks
-rw-r--r--data/templates/bookmarks.tpl.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/data/templates/bookmarks.tpl.php b/data/templates/bookmarks.tpl.php
index 8f502d3..ad2ecd3 100644
--- a/data/templates/bookmarks.tpl.php
+++ b/data/templates/bookmarks.tpl.php
@@ -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'])