[pLog-svn] r3104 - plog/trunk

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Fri Mar 24 01:00:13 GMT 2006


Author: jondaley
Date: 2006-03-24 01:00:13 +0000 (Fri, 24 Mar 2006)
New Revision: 3104

Modified:
   plog/trunk/wizard.php
Log:
delete columns that might still be there from 0.3.2, but ignore the error if the DROP fails.  check if variable exists (probably is a notice in php5) but caused my php4 to hang.  I think maybe because my trackbacks array would be null?  Not sure why it hung.  But, this fixes it.

Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php	2006-03-24 00:47:14 UTC (rev 3103)
+++ plog/trunk/wizard.php	2006-03-24 01:00:13 UTC (rev 3104)
@@ -468,6 +468,13 @@
    // ---
    // changes needed in 1.1
    // ---
+// leftover changes from 0.3.2.  It doesn't matter if these fail.
+// ignore the failures
+$Changes["Deletions"] = Array(
+    "ALTER TABLE {dbprefix}articles DROP COLUMN category_id",
+    "ALTER TABLE {dbprefix}blogs DROP COLUMN show_in_summary",
+);
+
 $Changes["Articles"] = Array(    
     "ALTER TABLE {dbprefix}articles ADD COLUMN num_comments INTEGER(10) NOT NULL DEFAULT 0",
     "ALTER TABLE {dbprefix}articles ADD COLUMN num_nonspam_comments INTEGER(10) NOT NULL DEFAULT 0",
@@ -1412,8 +1419,10 @@
                     // and run the query
                     $query = str_replace( "{dbprefix}", $this->_dbPrefix, $changeCode );
                     if( !$this->_db->Execute( $query )) {
-                        $errors = true;                    
-                        $errorMessage .= $this->_db->ErrorMsg()."<br/>";
+                        if($tableId != "Deletions"){
+                            $errors = true;                    
+                            $errorMessage .= $this->_db->ErrorMsg()."<br/>";
+                        }
                     }
                 }
 
@@ -1558,12 +1567,20 @@
             while( $row = $res4->FetchRow()) {
                 $artId = $row["id"];
                 // load the counters
-                $totalComments = $numComments[$artId];
-                if( $totalComments == '' ) $totalComments = 0;
-                $totalActiveComments = $numActiveComments[$artId];
-                if( $totalActiveComments == '' ) $totalActiveComments = 0;
-                $totalTrackbacks = $numTrackbacks[$artId];
-                if( $totalTrackbacks == '' ) $totalTrackbacks = 0;
+                if(isset($numComments[$artId]))
+                    $totalComments = $numComments[$artId];
+                else
+                    $totalComments = 0;
+
+                if(isset($numActiveComments[$artId]))
+                    $totalActiveComments = $numActiveComments[$artId];
+                else
+                    $totalActiveComments = 0;
+
+                if(isset($numTrackbacks[$artId]))
+                    $totalTrackbacks = $numTrackbacks[$artId];
+                else
+                    $totalTrackbacks = 0;
                 
                 // build the update query
                 $query = "UPDATE ".$this->dbPrefix."articles SET num_comments = {$totalComments},



More information about the pLog-svn mailing list