sql optimization: reduce by 9 sql queries when logged in and looking at bookmarks

This commit is contained in:
Christian Weiske 2010-02-20 10:57:52 +01:00
parent 10c6863b9e
commit 1fd4d4d9fc

View 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'])