[pLog-svn] r3205 - plugins/trunk/hostblock/class/dao
    oscar at devel.lifetype.net 
    oscar at devel.lifetype.net
       
    Fri Apr  7 19:57:20 GMT 2006
    
    
  
Author: oscar
Date: 2006-04-07 19:57:20 +0000 (Fri, 07 Apr 2006)
New Revision: 3205
Modified:
   plugins/trunk/hostblock/class/dao/blockedhosts.class.php
Log:
with this query is now easier for mysql which index to use, as long as we have the right index in place...
Modified: plugins/trunk/hostblock/class/dao/blockedhosts.class.php
===================================================================
--- plugins/trunk/hostblock/class/dao/blockedhosts.class.php	2006-04-07 19:36:53 UTC (rev 3204)
+++ plugins/trunk/hostblock/class/dao/blockedhosts.class.php	2006-04-07 19:57:20 UTC (rev 3205)
@@ -46,10 +46,13 @@
          */
         function getBlogBlacklist( $blogId, $blockType = BLOCK_COMMENT_POSTING, $includeGlobal = false )
         {
-        	$query = "SELECT * FROM ".$this->getPrefix()."host_blocking_rules ".
-                     "WHERE blog_id = $blogId";
+        	$query = "SELECT * FROM ".$this->getPrefix()."host_blocking_rules WHERE";
+        	
             if( $includeGlobal )
-            	$query .=" OR blog_id = ".GLOBALLY_BLOCKED_HOST;
+            	$query .=" blog_id IN ('".Db::qstr( $blogId )."', '".GLOBALLY_BLOCKED_HOST."') ";
+            else
+                $query .= " blog_id = '".Db::qstr( $blogId )."'";
+                
             $query .= " AND block_type = $blockType";
 
             $result = $this->Execute( $query );
@@ -129,4 +132,4 @@
             return $blockedHost;
         }
     }
-?>
+?>
\ No newline at end of file
    
    
More information about the pLog-svn
mailing list