]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
first sql optimization: fetch countOthers() for all bookmarks at once instead of...
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Sat, 20 Feb 2010 11:06:12 +0000 (11:06 +0000)
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Sat, 20 Feb 2010 11:06:12 +0000 (11:06 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@661 b3834d28-1941-0410-a4f8-b48e95affb8f

data/templates/bookmarks.tpl.php

index 0050ec879a26abe2700179e1a63bb1264b636258..b1a6eb00c1a049736fa71c71dcee208af6629042 100644 (file)
@@ -216,7 +216,13 @@ if($currenttag!= '') {
 <ol <?php echo ($start > 0 ? ' start="'. ++$start .'"' : ''); ?>
        id="bookmarks">
 
-       <?php
+    <?php
+    $addresses = array();
+    foreach ($bookmarks as $key => &$row) {
+        $addresses[$row['bId']] = $row['bAddress'];
+    }
+    $otherCounts = $bookmarkservice->countOthers($addresses);
+
        foreach ($bookmarks as $key => &$row) {
                switch ($row['bStatus']) {
                        case 0:
@@ -261,7 +267,7 @@ if($currenttag!= '') {
 
                // Udders!
                if (!isset($hash)) {
-                       $others = $bookmarkservice->countOthers($row['bAddress']);
+                       $others = $otherCounts[$row['bAddress']];
                        $ostart = '<a href="'. createURL('history', $row['bHash']) .'">';
                        $oend = '</a>';
                        switch ($others) {