[pLog-svn] r3384 - plog/trunk

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Thu May 11 14:45:23 GMT 2006


Author: jondaley
Date: 2006-05-11 14:45:23 +0000 (Thu, 11 May 2006)
New Revision: 3384

Modified:
   plog/trunk/wizard.php
Log:
another attempt. This should work for both 4.1 and 4.0 mysql versions.  Do people still run mysql3?  Can I get access to a database to try this out?

Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php	2006-05-11 12:32:19 UTC (rev 3383)
+++ plog/trunk/wizard.php	2006-05-11 14:45:23 UTC (rev 3384)
@@ -1368,7 +1368,6 @@
                     $result->Close();
                 }
             }
-
                 // check to see if we need to remove duplicates and the id index
             $query = "SELECT id FROM ".$this->_dbPrefix."config LIMIT 1";
             $result = $this->_db->Execute($query);
@@ -1382,10 +1381,19 @@
 
                 $result = $this->_db->Execute($query);
                 if(!$result){
-                    $message .= "Error removing duplicates in config table: ".$this->_db->ErrorMsg()."<br/>";
-                    $errors = true;
+                        // On 4.0, the above query won't work, so let's try it in 4.0 syntax
+                        // remove all duplicates in plog_config table
+                    $query = "DELETE ".$this->_dbPrefix."config FROM ".$this->_dbPrefix."config a ".
+                        "LEFT JOIN ".$this->_dbPrefix."config b ".
+                        "ON a.config_key = b.config_key WHERE a.id > b.id ";
+                    $result = $this->_db->Execute($query);
+                    if(!$result){
+                        $message .= "Error removing duplicates (tried 4.0 and 4.1 syntax) in config table: ".
+                            $this->_db->ErrorMsg()."<br/>";
+                        $errors = true;
+                    }
                 }
-                else{
+                if($result){
                     $result->Close();
 
                     // remove index id field, we don't need it any more!



More information about the pLog-svn mailing list