[pLog-svn] r3498 - plog/trunk

oscar at devel.lifetype.net oscar at devel.lifetype.net
Wed May 31 21:50:57 GMT 2006


Author: oscar
Date: 2006-05-31 21:50:57 +0000 (Wed, 31 May 2006)
New Revision: 3498

Modified:
   plog/trunk/wizard.php
Log:
Finally, added support for paging in the upgrade path of the wizard.

The process may look a bit complex, but in exchange we got sort of a framework that will allow
to add more data transformations capable of using paging without much effort. There are some 
comments near the bottom of the file (on top of class UpdateStepThree) that describe how
to easily add new "data transformer" classes in future releases.

Code has been tested by upgrading an 1.0 instance to 1.1, and it's also possible now to install 1.1 on top of itself (although the installer will report some errors, they can be ignored)


Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php	2006-05-31 20:51:27 UTC (rev 3497)
+++ plog/trunk/wizard.php	2006-05-31 21:50:57 UTC (rev 3498)
@@ -27,6 +27,13 @@
     // minimum php version required
     //
     define( "MIN_PHP_VERSION", "4.2.0" );
+    
+    //
+    // whether data transformers should fail on error by default
+    // It might be convenient to set this to 'false' if we're running
+    // the wizard on top of an already updated installation
+    //
+    define( "DATABASE_DATA_TRANSFORMER_FAIL_ON_ERROR_DEFAULT", true );
 
     // many hosts don't have this enabled and we, for the time being, need it...
     ini_set("arg_seperator.output", "&");
@@ -84,14 +91,8 @@
     $_actionMap["Update1"] = "UpdateStepOne";
     $_actionMap["Update2"] = "UpdateStepTwo";
     $_actionMap["Update3"] = "UpdateStepThree";
-    
-    //
-    // array with tables added in 1.1
-    //
-    $tables_11_new = Array(
-      "phpbb2_users",  "blog_categories", "global_articles_categories"
-    );
 
+
     /**
      * Open a connection to the database
      */
@@ -190,6 +191,14 @@
         }
     }
     
+    class WizardAction extends Action
+    {
+        function WizardAction( $actionInfo, $request )
+        {
+            $this->Action( $actionInfo, $request );
+        }
+    }    
+    
     class WizardValidator
     {
         var $_desc;
@@ -443,7 +452,7 @@
         }        
     }               
     
-    class WizardChecks extends Action
+    class WizardChecks extends WizardAction
     {        
         function perform()
         {
@@ -499,15 +508,51 @@
             return true;
         }
     }
+    
+    class WizardPagedAction extends WizardAction
+    {
+        var $willRefresh;
+    
+        function WizardPagedAction( $actionInfo, $request ) 
+        {
+            $this->WizardAction( $actionInfo, $request );
+            
+            $this->willRefresh = false;
+        }
+        
+        /**
+         * @private
+         */
+        function getPageFromRequest()
+        {
+            include_once( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php");    	
+			// get the value from the request
+			$page = HttpVars::getRequestValue( "page" );
+			// but first of all, validate it
+			$val = new IntegerValidator();
+			if( !$val->validate( $page ))
+				$page = 1;			
+							
+			return $page;        
+        }
+        
+        /**
+         * @private
+         */
+        function willRefresh()
+        {
+            return( $this->willRefresh );
+        }
+    }
 
     /**
      * Gets the information about the database from the user.
      */
-    class WizardIntro extends Action
+    class WizardIntro extends WizardAction
     {
         function WizardIntro( $actionInfo, $request )
         {
-            $this->Action( $actionInfo, $request );
+            $this->WizardAction( $actionInfo, $request );
         }
 
         function perform()
@@ -531,7 +576,7 @@
      * Saves data to the configuration file
      *
      */
-    class WizardStepOne extends Action
+    class WizardStepOne extends WizardAction
     {
 
         var $_dbServer;
@@ -543,7 +588,7 @@
 
         function WizardStepOne( $actionInfo, $request )
         {
-            $this->Action( $actionInfo, $request );
+            $this->WizardAction( $actionInfo, $request );
 
             // data validation
             $this->registerFieldValidator( "dbServer", new StringValidator());
@@ -722,7 +767,7 @@
      * Second step where we connect to the database and create the tables.
      *
      */
-    class WizardStepTwo extends Action
+    class WizardStepTwo extends WizardAction
     {
 
         var $_db;
@@ -965,7 +1010,7 @@
      * this action only shows some feedback
      *
      */
-    class WizardStepThree extends Action
+    class WizardStepThree extends WizardAction
     {
         function perform()
         {
@@ -979,7 +1024,7 @@
      * Create the first user in the database
      *
      */
-    class WizardStepFour extends Action
+    class WizardStepFour extends WizardAction
     {
 
         var $_userName;
@@ -990,7 +1035,7 @@
 
         function WizardStepFour( $actionInfo, $request )
         {
-            $this->Action( $actionInfo, $request );
+            $this->WizardAction( $actionInfo, $request );
 
             $this->registerFieldValidator( "userName", new StringValidator());
             $this->registerFieldValidator( "userPassword", new PasswordValidator());
@@ -1063,7 +1108,7 @@
 
     }
 
-    class WizardStepFive extends Action
+    class WizardStepFive extends WizardAction
     {
 
         var $_blogName;
@@ -1072,7 +1117,7 @@
 
         function WizardStepFive( $actionInfo, $request )
         {
-              $this->Action( $actionInfo, $request );
+              $this->WizardAction( $actionInfo, $request );
 
               $this->registerFieldValidator( "blogName", new StringValidator());
               $this->registerFieldValidator( "ownerid", new IntegerValidator());
@@ -1209,7 +1254,7 @@
         }
     }
 
-    class UpdateStepOne extends Action
+    class UpdateStepOne extends WizardAction
     {
 
         function perform()
@@ -1220,7 +1265,7 @@
         }
     }
 
-    class UpdateStepTwo extends Action
+    class UpdateStepTwo extends WizardAction
     {
 
         var $_db;
@@ -1292,7 +1337,11 @@
             }
 
             if( !$errors ) {
-                $message .= "** Modifications to old tables carried out successfully **<br/><br/>";
+                $message .= "<br/><b>** Modifications to the database schema carried out successfully **</b><br/><br/>";
+                $message .= "The next step will update some of the data in your database. This process may take a while
+                             depending on the amount of data in your database, and the browser will periodically refresh
+                             to avoid timeout issues. <b>Please do not attempt to interrupt this process.</b>";
+                             
             }
 
             // check the configuration and add the new configuration settings that were added for 1.1
@@ -1391,69 +1440,241 @@
             return true;
         }
     }
-
+    
     /**
-     * this is the first step of the transformations to some of the fields in the tables.
-     * Precisely, it is in this step where we regenerate the indexes for the search engine... However, it
-     * could take it a while...
+     * Generic class that performs data updates on the database
      */
-    class UpdateStepThree extends Action
+    class DatabaseDataTransformer extends Model
     {
-        var $message;    
-        var $db;
+        /**
+         * @public
+         * Public fields, may be accessed by other classes
+         */
+        var $updatedRecords;
+        var $message;
+        var $errorRecords;
+        var $notModifiedRecords;
+        var $failOnError;
+        var $page;
+        var $itemsPerPage;
         var $dbPrefix;
     
-        function UpdateStepThree( $actionInfo, $httpRequest )
+        function DatabaseDataTransformer( $page = -1, $itemsPerPage = WIZARD_MAX_RECORDS_PER_STEP )
         {
-            $this->Action( $actionInfo, $httpRequest );
+            $this->Model();
+            
+            $this->updatedRecords = 0;
+            $this->errorRecords   = 0;
+            $this->notModifiedRecords = 0;
+            $this->addedRecords = 0;
+            $this->deletedRecords = 0;
+            $this->failOnError = DATABASE_DATA_TRANSFORMER_FAIL_ON_ERROR_DEFAULT;
+            $this->message = "";
+            
+            $this->page = $page;
+            $this->itemsPerPage = $itemsPerPage;
+            
+            $this->dbPrefix = $this->getPrefix();
         }
         
-        function updateAdminUsers()
-        {   
-            $numUpdated = 0;        
-            $query1 = "SELECT DISTINCT user_id FROM ".$this->dbPrefix."users_permissions WHERE permission_id = 1";
-
-            // total number of comments
-            $res1 = $this->db->Execute( $query1 );
+        /**
+         * Rerforms the transformation. Returns true if the step was successful or false otherwise.
+         * Upon finalization, please check the $message string to get more information. Use the $updatedRecords,
+         * $errorRecords, $notModifiedRecords, $addedRecords and $deletedRecords for some figures regarding the 
+         * previous step
+         */
+        function perform()
+        {
+            // must be implemented by child classes
+            return true;        
+        }
+        
+        /**
+         * Returns true if there is no more data for this transformer to upgrade, or false otherwise
+         *
+         * @return True if ready or false if not
+         */
+        function isComplete()
+        {
+            return( $this->getNumSteps() <= $this->page );
+        }
+        
+        /**
+         * returns the number of steps needed to process this data
+         */
+        function getNumSteps( $table = "" )
+        {
+            // if there is a table name, we can take a shortcut or else we expect child
+            // classes to reimplement this method
+            if( $table ) {
+                $numItems = $this->getNumItems( $this->getPrefix().$table );
+                
+                $numSteps = ceil( $numItems / $this->itemsPerPage );
+            }
+            else {
+                $numSteps = 0;
+            }
+            
+            return( $numSteps );
+        }
+        
+        /**
+         * returns the total number of records processed so far based on the current page and the
+         * number of items per page
+         */
+        function getTotalProcessedRecords()
+        {
+            return( $this->page * $this->itemsPerPage );
+        }
+        
+        /**
+         * returns an approximate percentage of records processed so far
+         */
+        function getPercentProcessed()
+        {
+            $processed = $this->getTotalProcessedRecords();
+            return((int)($processed / ( $this->getNumSteps() * $this->itemsPerPage ) * 100 ));
+        }
+    }
+    
+    /**
+     * updates the article category counters based on the number of posts that have
+     * been assigned to each category
+     */
+    class CategoryCountersDataTransformer extends DatabaseDataTransformer
+    {        
+        function getNumSteps()
+        {
+            return( parent::getNumSteps( "articles_categories" ));
+        }
+    
+        function perform()
+        {
+            $this->message = "<b>Updating article categories (step 2 of 9)</b><br/><br/>";        
+        
+            // load each one of the categories and update them
+            // list of categories
+            $query3 = "SELECT id FROM ".$this->dbPrefix."articles_categories";            
+            $res3 = $this->Execute( $query3, $this->page, $this->itemsPerPage );
+            $catIds = Array();
+            if( $res3->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";
+				return( true );
+			}
+            while( $row = $res3->FetchRow()) {
+            	$catIds[] = $row["id"];
+            }
+            $where = "(".implode( $catIds, "," ).")";
+            
+            // total number of articles
+            $query1 = "SELECT category_id, COUNT(*) AS total FROM ".$this->dbPrefix."article_categories_link ".
+                      "WHERE category_id IN {$where} GROUP BY category_id";
+            // number of active articles
+            $query2 = "SELECT l.category_id AS category_id, COUNT(*) AS total FROM ".
+                       $this->dbPrefix."article_categories_link l, ".$this->dbPrefix."articles a ".
+                       "WHERE a.id = l.article_id AND a.status = ".POST_STATUS_PUBLISHED." AND l.category_id IN {$where} ".
+                       "GROUP BY l.category_id";                   
+                      
+            // execute the 1st query
+            $res1 = $this->Execute( $query1 );
             if( !$res1 ) {
-                $this->message .= "Error performing changes to the users table (1)";
+                $this->message .= "Error performing changes to the categories table";
                 return false;
             }
-            $numComments = Array();
+            $numArticles = Array();
             while( $row = $res1->FetchRow()) {
-                $userId = $row["user_id"];
-                $update = "UPDATE ".$this->dbPrefix."users SET site_admin = ".Db::qstr($userId);
-                $result = $this->db->Execute( $update );
+                $numArticles[$row["category_id"]] = $row["total"];
+            }
+            $res1->Close();
+                        
+            // total number of active comments
+            $res2 = $this->Execute( $query2 );
+            if( !$res2 ) {
+                $this->message .= "Error performing changes to the categories table";
+                return false;
+            }
+            $numActiveArticles = Array();
+            while( $row = $res2->FetchRow()) {
+                $numActiveArticles[$row["category_id"]] = $row["total"];
+            }
+            $res2->Close();                       
+            
+			foreach( $catIds as $catId ) {
+                // load the counters
+                $totalArticles = '';
+                $totalActiveArticles = '';
+                if( isset( $numArticles[$catId] ))
+                    $totalArticles = $numArticles[$catId];                    
+                if( $totalArticles == '' ) $totalArticles = 0;
+                if( isset( $numActiveArticles[$catId] ))
+                    $totalActiveArticles = $numActiveArticles[$catId];
+                if( $totalActiveArticles == '' ) $totalActiveArticles = 0;
+                
+                // build the update query
+                $query = "UPDATE ".$this->dbPrefix."articles_categories SET num_articles = {$totalArticles},
+                          num_published_articles = {$totalActiveArticles},
+                          last_modification = last_modification
+                          WHERE id = {$catId}";
+                          
+                // and execute it
+                $result = $this->Execute( $query );
                 if( !$result ) {
-                    $this->message .= "Error updating user with id {$userId}<br/>";
+                    $this->message .= "Error updating category with id {$catId}<br/>";
                 }
                 else
-                    $numUpdated++;
+                    $this->updatedRecords++;
             }
-            $res1->Close();
-            $this->message .= "{$numUpdated} users updated.<br/>";
-            return true;                        
+            $res3->Close();
+        
+            $this->message .= "{$this->updatedRecords} categories updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%)<br/>";
+            return true;        
         }
+    }
+    
+    /**
+     * updates blog article counters
+     */
+    class ArticleCountersDataTransformer extends DatabaseDataTransformer
+    {        
+        function getNumSteps()
+        {
+            return( parent::getNumSteps( "articles" ));
+        }
         
-        function updateArticleCounters()
+        function perform()
         {
             include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
             include_once( PLOG_CLASS_PATH."class/dao/articlecommentstatus.class.php" );
             
-            $numUpdated = 0;
+            $this->message = "<b>Updating articles (step 3 of 9)</b><br/><br/>";           
+                        
+            // article ids
+            $artIds = Array();            
+            $query4 = "SELECT id FROM ".$this->dbPrefix."articles";            
+            $res4 = $this->Execute( $query4, $this->page, $this->itemsPerPage );
+            if( $res4->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";				
+				return( true );
+            }
+            while( $row = $res4->FetchRow()) {
+            	$artIds[] = $row["id"];
+            }
+            $where = "(".implode( $artIds, "," ).")";
             
             // build the queries
-            $query1 = "SELECT article_id, COUNT(*) AS total FROM ".$this->dbPrefix."articles_comments GROUP BY article_id";
-            $query2 = "SELECT article_id, COUNT(*) AS total FROM ".$this->dbPrefix."articles_comments WHERE status = ".COMMENT_STATUS_NONSPAM." GROUP BY article_id";
-            $query3 = "SELECT article_id, COUNT(*) AS total FROM ".$this->dbPrefix."trackbacks GROUP BY article_id";
-            $query4 = "SELECT id FROM ".$this->dbPrefix."articles";
+            $query1 = "SELECT article_id, COUNT(*) AS total FROM ".$this->dbPrefix."articles_comments ".
+                      "WHERE article_id IN {$where} GROUP BY article_id";
+            $query2 = "SELECT article_id, COUNT(*) AS total FROM ".$this->dbPrefix."articles_comments ".
+                      "WHERE article_id IN {$where} AND status = ".COMMENT_STATUS_NONSPAM." GROUP BY article_id";
+            $query3 = "SELECT article_id, COUNT(*) AS total FROM ".$this->dbPrefix."trackbacks ".
+                      "WHERE article_id IN {$where} GROUP BY article_id";
             
             // and execute all of them...
             
             // total number of comments
-            $res1 = $this->db->Execute( $query1 );
+            $res1 = $this->Execute( $query1 );
             if( !$res1 ) {
-                $this->message .= "Error performing changes to the articles table (1)";
+                $this->message .= "Error performing changes to the articles table";
                 return false;
             }
             $numComments = Array();
@@ -1463,9 +1684,9 @@
             $res1->Close();
             
             // total number of active comments
-            $res2 = $this->db->Execute( $query2 );
+            $res2 = $this->Execute( $query2 );
             if( !$res2 ) {
-                $this->message .= "Error performing changes to the articles table (2)";
+                $this->message .= "Error performing changes to the articles table";
                 return false;
             }
             $numActiveComments = Array();
@@ -1475,25 +1696,18 @@
             $res2->Close();
             
             // number of trackbacks
-            $res3 = $this->db->Execute( $query3 );
+            $res3 = $this->Execute( $query3 );
             if( !$res3 ) {
-                $this->message .= "Error performing changes to the articles table (3)";
+                $this->message .= "Error performing changes to the articles table";
                 return false;
             }
             $numTrackbacks = Array();            
             while( $row = $res3->FetchRow()) {
                 $numTrackbacks[$row["article_id"]] = $row["total"];
             }           
-            $res3->Close();
+            $res3->Close();            
             
-            // article ids
-            $res4 = $this->db->Execute( $query4 );
-            if( !$res4 ) {
-                $this->message .= "Error loading articles (3)";
-                return false;
-            }            
-            while( $row = $res4->FetchRow()) {
-                $artId = $row["id"];
+            foreach( $artIds as $artId ) {
                 // load the counters
                 if(isset($numComments[$artId]))
                     $totalComments = $numComments[$artId];
@@ -1519,117 +1733,127 @@
                           WHERE id = {$artId}";
                           
                 // and execute it
-                $result = $this->db->Execute( $query );
+                $result = $this->Execute( $query );
                 if( !$result ) {
                     $this->message .= "Error updating article with id {$artId}<br/>";
                 }
                 else
-                    $numUpdated++;
+                    $this->updatedRecords++;
             }
             $res4->Close();
             
-            $this->message .= "{$numUpdated} articles updated.<br/>";
-            return true;
+            $processed = $this->page * $this->itemsPerPage;            
+            $this->message .= "{$this->updatedRecords} articles updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%)<br/>";
+            
+            return( true );
         }
+    }
+    
+    /**
+     * Moves trackbacks from their own table to the comments table
+     */
+    class BlogTrackbacksDataTransformer extends DatabaseDataTransformer
+    {        
+        function getNumSteps()
+        {
+            return( parent::getNumSteps( "trackbacks" ));
+        }
+    
+        function perform()
+        {
+            $this->message = "<b>Updating trackbacks (step 4 of 9)</b><br/><br/>";        
         
-        function updateCategoryCounters()
-        {
-            // total number of articles
-            $query1 = "SELECT category_id, COUNT(*) AS total FROM ".$this->dbPrefix."article_categories_link GROUP BY category_id";
-            // number of active articles
-            $query2 = "SELECT l.category_id AS category_id, COUNT(*) AS total FROM ".$this->dbPrefix."article_categories_link l, ".
-                       $this->dbPrefix."articles a WHERE a.id = l.article_id AND a.status = ".POST_STATUS_PUBLISHED." GROUP BY l.category_id";
-            // list of categories
-            $query3 = "SELECT id FROM ".$this->dbPrefix."articles_categories";
-                      
-            // execute the 1st query
-            $res1 = $this->db->Execute( $query1 );
-            if( !$res1 ) {
-                $this->message .= "Error performing changes to the categories table (1)";
-                return false;
+            $query = "SELECT t.id AS id, a.blog_id AS blog_id, t.url AS url, t.title AS title, t.article_id as article_id,
+                      t.excerpt AS excerpt, t.blog_name AS blog_name, t.date AS date 
+                      FROM ".$this->dbPrefix."trackbacks t, ".$this->dbPrefix."articles a 
+                      WHERE t.article_id = a.id";
+
+            $result = $this->Execute( $query, $this->page, $this->itemsPerPage );
+            if( !$result ) {
+                $this->message .= "Error updating trackbacks.<br/>";
+                return true;
             }
-            $numArticles = Array();
-            while( $row = $res1->FetchRow()) {
-                $numArticles[$row["category_id"]] = $row["total"];
+            if( $result->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";
+				return( true );            
             }
-            $res1->Close();
-                        
-            // total number of active comments
-            $res2 = $this->db->Execute( $query2 );
-            if( !$res2 ) {
-                $this->message .= "Error performing changes to the categories table (2)";
-                return false;
-            }
-            $numActiveArticles = Array();
-            while( $row = $res2->FetchRow()) {
-                $numActiveArticles[$row["category_id"]] = $row["total"];
-            }
-            $res2->Close();
             
-            // load each one of the categories and update them
-            $res3 = $this->db->Execute( $query3 );
-            if( !$res3 ) {
-                $this->message .= "Error loading categories (3)";
-                return false;
-            }            
-            $numUpdated = 0;
-            while( $row = $res3->FetchRow()) {
-                $catId = $row["id"];
-                // load the counters
-                $totalArticles = $numArticles[$catId];
-                if( $totalArticles == '' ) $totalArticles = 0;
-                $totalActiveArticles = $numActiveArticles[$catId];
-                if( $totalActiveArticles == '' ) $totalActiveArticles = 0;
+            // process all trackbacks and insert them again to the comments table
+            include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+            while( $row = $result->FetchRow()) {
+                // build the insert query
+                $insert = "INSERT INTO ".$this->dbPrefix."articles_comments
+                           (article_id, blog_id, topic, text, date, user_email, user_url, user_name, parent_id, 
+                           client_ip, send_notification, status, spam_rate, normalized_text, normalized_topic,
+                           type) 
+                           VALUES (".$row["article_id"].",".$row["blog_id"].",'".Db::qstr($row["title"])."','".
+                                     Db::qstr($row["excerpt"])."','".$row["date"]."','','".$row["url"]."','".
+                                     Db::qstr($row["blog_name"])."', '0', '0.0.0.0','0', '0', '0','".
+                                     Textfilter::urlize( $row["excerpt"] )."','".
+                                     Textfilter::urlize( $row["title"] )."','2')";                            
                 
-                // build the update query
-                $query = "UPDATE ".$this->dbPrefix."articles_categories SET num_articles = {$totalArticles},
-                          num_published_articles = {$totalActiveArticles},
-                          last_modification = last_modification
-                          WHERE id = {$catId}";
-                          
-                // and execute it
-                $result = $this->db->Execute( $query );
-                if( !$result ) {
-                    $this->message .= "Error updating category with id {$catId}<br/>";
-                }
+                $insertRes = $this->Execute( $insert );
+                if( $insertRes )
+                    $this->updatedRecords++;
                 else
-                    $numUpdated++;
+                    $this->message .= "Error adding trackback with id ".$row["id"]."<br/>";
             }
-            $res3->Close();
+            $result->Close();
             
-            $this->message .= "{$numUpdated} categories updated.<br/>";
-            return true;
+            $processed = $this->page * $this->itemsPerPage;            
+            $this->message .= "{$this->updatedRecords} trackbacks modified, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%)<br/>";            
+        
+            return true;        
         }
-        
-        function updateBlogCounters()
+    }
+    
+    /**
+     * Updates the blog counters (number of posts, number of comments, etc)
+     */
+    class BlogCountersDataTransformer extends DatabaseDataTransformer 
+    {
+        function getNumSteps()
         {
-        	/**
-        	 * :TODO:
-        	 *
-        	 * The last_update_date and create_date fields must be updated!
-        	 */        	 
-        
+            return( parent::getNumSteps( "blogs" ));
+        }
+    
+        function perform()
+        {
+            $this->message = "<b>Updating blogs (step 1 of 9)</b><br/><br/>";
+                                
+            // list of blog ids
+            $query4 = "SELECT id, blog, owner_id FROM ".$this->dbPrefix."blogs";            
+            $res4 = $this->Execute( $query4, $this->page, $this->itemsPerPage );
+            $blogIds = Array();
+			if( $res4->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";
+				return( true );
+			}
+            while( $row = $res4->FetchRow()) {
+            	// gather the blog ids and use them to reduce the amount of data that the other queries need to process            
+            	$blogIds[] = $row["id"];
+            }
+            $where = "(".implode( $blogIds, "," ).")";
+
             // number of active articles
             $query1 = "SELECT blog_id, COUNT(*) AS total FROM ".$this->dbPrefix."articles ".
-                      "WHERE status = ".POST_STATUS_PUBLISHED." GROUP BY blog_id";
+                      "WHERE status = ".POST_STATUS_PUBLISHED." AND blog_id IN {$where} GROUP BY blog_id";
             // number of active comments
             $query2 = "SELECT a.blog_id AS blog_id, COUNT(*) AS total FROM ".$this->dbPrefix."articles_comments c, ".
-                      $this->dbPrefix."articles a WHERE a.id = c.article_id AND a.status = ".POST_STATUS_PUBLISHED.
-                      " GROUP BY a.blog_id";
+                      $this->dbPrefix."articles a WHERE a.id = c.article_id AND a.status = ".POST_STATUS_PUBLISHED." ".
+                      "AND a.blog_id IN {$where} GROUP BY a.blog_id";
             // number of trackbacks
             $query3 = "SELECT blog_id, COUNT(*) AS total FROM ".$this->dbPrefix."trackbacks t,".
                       $this->dbPrefix."articles a WHERE a.id = t.article_id ".
-                      "GROUP BY a.blog_id";
-            // list of blog ids
-            $query4 = "SELECT id FROM ".$this->dbPrefix."blogs";
+                      "AND blog_id IN {$where} GROUP BY a.blog_id";
             // create_date and last_update_date
             $query5 = "SELECT blog_id, MIN(date) AS create_date, MAX(date) AS last_update_date
-                       FROM ".$this->dbPrefix."articles GROUP BY blog_id";                       
+                       FROM ".$this->dbPrefix."articles WHERE blog_id IN {$where} GROUP BY blog_id";                     
                       
             // execute the 1st query
-            $res1 = $this->db->Execute( $query1 );
+            $res1 = $this->Execute( $query1 );
             if( !$res1 ) {
-                $this->message .= "Error performing changes to the blogs table (1)";
+                $this->message .= "Error performing changes to the blogs table";
                 return false;
             }
             $numArticles = Array();
@@ -1639,9 +1863,9 @@
             $res1->Close();
                         
             // total number of active comments
-            $res2 = $this->db->Execute( $query2 );
+            $res2 = $this->Execute( $query2 );
             if( !$res2 ) {
-                $this->message .= "Error performing changes to the blogs table (2)";
+                $this->message .= "Error performing changes to the blogs table";
                 return false;
             }
             $numComments = Array();
@@ -1651,9 +1875,9 @@
             $res2->Close();
             
             // total number of trackbacks
-            $res3 = $this->db->Execute( $query3 );
+            $res3 = $this->Execute( $query3 );
             if( !$res3 ) {
-                $this->message .= "Error performing changes to the blogs table (3)";
+                $this->message .= "Error performing changes to the blogs table";
                 return false;
             }
             $numTrackbacks = Array();
@@ -1663,9 +1887,9 @@
             $res3->Close();
             
             // update and create dates
-            $res5 = $this->db->Execute( $query5 );
+            $res5 = $this->Execute( $query5 );
             if( !$res5 ) {
-                $this->message .= "Error performing changes to the blogs table (5)";
+                $this->message .= "Error performing changes to the blogs table";
                 return false;
             }
             $createDates = Array();
@@ -1674,17 +1898,9 @@
                 $createDates[$row["blog_id"]] = $row["create_date"];
                 $lastUpdateDates[$row["blog_id"]] = $row["last_update_date"];
             }
-            $res5->Close();
-                        
-            // load each one of the categories and update them
-            $res4 = $this->db->Execute( $query4 );
-            if( !$res4 ) {
-                $this->message .= "Error loading list of blogs";
-                return false;
-            }
-            $numUpdated=0;
-            while( $row = $res4->FetchRow()) {
-                $blogId = $row["id"];
+            $res5->Close();            
+
+            foreach( $blogIds as $blogId ) {
                 // load the counters
                 isset( $numArticles[$blogId] ) ? $totalArticles = $numArticles[$blogId] : $totalArticles = 0;
                 isset( $numComments[$blogId] ) ? $totalComments = $numComments[$blogId] : $totalComments = 0;
@@ -1712,76 +1928,100 @@
                           WHERE id = {$blogId}";
                           
                 // and execute it
-                $result = $this->db->Execute( $query );
+                $result = $this->Execute( $query );
                 if( !$result ) {
                     $this->message .= "Error updating blog with id {$catId}<br/>";
                 }
                 else
-                    $numUpdated++;
+                    $this->updatedRecords++;
             }
             $res4->Close();
             
-            $this->message .= "{$numUpdated} blogs updated.<br/>";
-            return true;            
+            $processed = $this->page * $this->itemsPerPage;            
+            $this->message .= "{$this->updatedRecords} blogs updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%)<br/>";
+            return true;         
+        } 
+    }
+    
+    /**
+     * populates the site_admin field in the users table
+     */
+    class AdminUsersDataTransformer extends DatabaseDataTransformer
+    {
+        function getNumSteps()
+        {
+            return( parent::getNumSteps( "users_permissions" ));
         }
+    
+        function perform()
+        {
+            $this->message = "<b>Updating users (step 5 of 9)</b><br/><br/>";        
         
-        function updateTrackbacks()
-        {
-            /**
-             * :TODO:
-             *
-             * move all the trackbacks to the articles_comments table and set the 'type' field 
-             * to '3'
-             */
-             
-            $query = "SELECT t.id AS id, a.blog_id AS blog_id, t.url AS url, t.title AS title, t.article_id as article_id,
-                      t.excerpt AS excerpt, t.blog_name AS blog_name, t.date AS date 
-                      FROM ".$this->dbPrefix."trackbacks t, ".$this->dbPrefix."articles a 
-                      WHERE t.article_id = a.id";
+            $query1 = "SELECT DISTINCT user_id FROM ".$this->dbPrefix."users_permissions WHERE permission_id = 1";
 
-            $result = $this->db->Execute( $query );
-            if( !$result ) {
-                $this->message .= "Error updating trackbacks.<br/>";
-                return true;
+            // total number of comments
+            $res1 = $this->Execute( $query1, $this->page, $this->itemsPerPage );
+            if( !$res1 ) {
+                $this->message .= "Error performing changes to the users table";
+                return false;
             }
-            
-            // process all trackbacks and insert them again to the comments table
-            include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
-            $totalAdded=0;
-            while( $row = $result->FetchRow()) {
-                // build the insert query
-                $insert = "INSERT INTO ".$this->dbPrefix."articles_comments
-                           (article_id, blog_id, topic, text, date, user_email, user_url, user_name, parent_id, 
-                           client_ip, send_notification, status, spam_rate, normalized_text, normalized_topic,
-                           type) 
-                           VALUES (".$row["article_id"].",".$row["blog_id"].",'".Db::qstr($row["title"])."','".
-                                     Db::qstr($row["excerpt"])."','".$row["date"]."','','".$row["url"]."','".
-                                     Db::qstr($row["blog_name"])."', '0', '0.0.0.0','0', '0', '0','".
-                                     Textfilter::urlize( $row["excerpt"] )."','".
-                                     Textfilter::urlize( $row["title"] )."','2')";                            
-                
-                $insertRes = $this->db->Execute( $insert );
-                if( $insertRes )
-                    $totalAdded++;
+            if( $res1->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";
+				return( true );            
+            }
+            $numComments = Array();
+            while( $row = $res1->FetchRow()) {
+                $userId = $row["user_id"];
+                $update = "UPDATE ".$this->dbPrefix."users SET site_admin = ".Db::qstr($userId);
+                $result = $this->Execute( $update );
+                if( !$result ) {
+                    $this->message .= "Error updating user with id {$userId}<br/>";
+                }
                 else
-                    $this->message .= "Error adding trackback with id ".$row["id"]."<br/>";
+                    $this->updatedRecords++;
             }
-            $result->Close();
-            
-            $this->message .= "{$totalAdded} trackbacks modified.<br/>";            
-        
-            return true;
+            $res1->Close();
+            $this->message .= "{$this->updatedRecords} users updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%)<br/>";
+            return true;        
         }
         
-        function updateLinkCategories()
+        
+    }
+    
+    /**
+     * populates the article categories counter
+     */
+    class LinkCategoriesDataTransformer extends DatabaseDataTransformer
+    {
+        function getNumSteps()
         {
+            return( parent::getNumSteps( "mylinks_categories" ));
+        }           
+    
+        function perform()
+        {
+            $this->message = "<b>Updating link categories (step 6 of 9)</b><br/><br/>";        
+        
+            // load each one of the categories and update them
+            // list of categories
+            $query2 = "SELECT id FROM ".$this->dbPrefix."mylinks_categories";            
+            $res2 = $this->Execute( $query2, $this->page, $this->itemsPerPage );
+            $catIds = Array();
+            if( $res2->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";
+				return( true );
+            }
+            while( $row = $res2->FetchRow()) {
+            	$catIds[] = $row["id"];
+            }
+            $where = "(".implode( $catIds, "," ).")";
+            
             // total number of articles
-            $query1 = "SELECT category_id, COUNT(*) AS total FROM ".$this->dbPrefix."mylinks GROUP BY category_id";
-            // list of categories
-            $query2 = "SELECT id FROM ".$this->dbPrefix."mylinks_categories";
+            $query1 = "SELECT category_id, COUNT(*) AS total FROM ".$this->dbPrefix."mylinks ".
+                      "WHERE category_id IN {$where} GROUP BY category_id";
                       
             // execute the 1st query
-            $res1 = $this->db->Execute( $query1 );
+            $res1 = $this->Execute( $query1 );
             if( !$res1 ) {
                 $this->message .= "Error performing changes to the link categories table";
                 return false;
@@ -1790,17 +2030,9 @@
             while( $row = $res1->FetchRow()) {
                 $numLinks[$row["category_id"]] = $row["total"];
             }
-            $res1->Close();
+            $res1->Close();                       
             
-            // load each one of the categories and update them
-            $res2 = $this->db->Execute( $query2 );
-            if( !$res2 ) {
-                $this->message .= "Error loading link categories";
-                return false;
-            }
-            $numUpdated = 0;
-            while( $row = $res2->FetchRow()) {
-                $catId = $row["id"];
+            foreach( $catIds as $catId ) {
                 // load the counters
                 isset( $numLinks[$catId] ) ? $totalLinks = $numLinks[$catId] : $totalLinks = 0;
                 
@@ -1809,73 +2041,128 @@
                           WHERE id = {$catId}";
                           
                 // and execute it
-                $result = $this->db->Execute( $query );
+                $result = $this->Execute( $query );
                 if( !$result ) {
                     $this->message .= "Error updating links category with id {$catId}<br/>";
                 }
                 else
-                    $numUpdated++;
+                    $this->updatedRecords++;
             }
             $res2->Close();
             
-            $this->message .= "{$numUpdated} links categories updated.<br/>";
-            return true;
-        }
+            $processed = $this->page * $this->itemsPerPage;            
+            $this->message .= "{$this->updatedRecords} links categories updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%)<br/>";
+            return true;        
+        }    
+    }
+    
+    /**
+     * populates some fields in the comments table
+     */
+    class CommentsDataTransformer extends DatabaseDataTransformer
+    {                
+        function getNumSteps()
+        {
+            return( parent::getNumSteps( "articles_comments" ));
+        }          
+            
+        function perform()
+        {        
+            $this->message = "<b>Updating article comments (step 7 of 9)</b><br/><br/>";
         
-        function updateComments()
-        {
+            // now process all the comments
+            $query2 = "SELECT id FROM ".$this->dbPrefix."articles_comments";
+            $res2 = $this->Execute( $query2, $this->page, $this->itemsPerPage );
+            if( !$res2 ) {
+                $this->message.= "Error loading comments<br/>";
+                return false;
+            }
+            if( $res2->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";
+				return( true );            
+            }
+            $commentIds = Array();
+            while( $row = $res2->FetchRow()) {
+            	$commentIds[] = $row["id"];
+            }
+            $where = "(".implode( $commentIds, "," ).")";
+            
             // build the query
             $query1 = "SELECT a.blog_id AS blog_id, c.id AS comment_id
                        FROM ".$this->dbPrefix."articles a, ".$this->dbPrefix."articles_comments c
-                       WHERE a.id = c.article_id"; 
-            $res1 = $this->db->Execute( $query1 );
+                       WHERE a.id = c.article_id AND c.id IN {$where}"; 
+            $res1 = $this->Execute( $query1 );
             if( !$res1 ) {
-                $this->message .= "Error loading comments (1)<br/>";
+                $this->message .= "Error loading comments<br/>";
                 return false;
             }
             $commentBlogIds = Array();
             while( $row = $res1->FetchRow()) {
                 $commentBlogIds[$row["comment_id"]] = $row["blog_id"];
             }
-            $res1->Close();
+            $res1->Close();                       
             
-            // now process all the comments
-            $query2 = "SELECT id FROM ".$this->dbPrefix."articles_comments";
-            $res2 = $this->db->Execute( $query2 );
-            if( !$res2 ) {
-                $this->message.= "Error loading comments (2)<br/>";
-                return false;
-            }
-            $numUpdated = 0;
-            while( $row = $res2->FetchRow()) {
-                // build the query
-                $commentId = $row["id"];                
+            foreach( $commentIds as $commentId ) {
+                // build the query      
                 $blogId = $commentBlogIds[$commentId];
                 $query = "UPDATE ".$this->dbPrefix."articles_comments
                           SET blog_id = {$blogId}, date = date WHERE id = {$commentId}";
                 // and execute it
-                $res = $this->db->Execute( $query );
+                $res = $this->Execute( $query );
                 if( !$res )
                     $this->message .= "Error updating comment with id {$commentId}<br/>";
                 else
-                    $numUpdated++;
+                    $this->updatedRecords++;
             }
             $res2->Close();
             
-            $this->message .= "{$numUpdated} comments updated.<br/>";
+            $processed = $this->page * $this->itemsPerPage;            
+            $this->message .= "{$this->updatedRecords} comments updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%)<br/>";
         	 
-        	return true;
+        	return true;        
         }
+    }
+    
+    /**
+     * populates album counters
+     */
+    class AlbumsDataTransformer extends DatabaseDataTransformer
+    {            
+        function getNumSteps()
+        {
+            return( parent::getNumSteps( "gallery_albums" ));
+        }  
         
-        function updateAlbums()
+        function perform()
         {
+            $this->message = "<b>Updating resource albums (step 8 of 9)</b><br/><br/>";        
+        
+            // now update all albums
+            $query3 = "SELECT id FROM ".$this->dbPrefix."gallery_albums";
+            $res3 = $this->Execute( $query3, $this->page, $this->itemsPerPage );
+            $albumIds = Array();
+            if( !$res3 ) {
+                $this->message .= "Error updating gallery albums<br/>";
+                return false;
+            }
+            if( $res3->RecordCount() == 0 ) {
+				$this->message .= "No more records to process";
+				return( true );            
+            }
+            $albumIds = Array();
+            while( $row = $res3->FetchRow()) {
+            	$albumIds[] = $row["id"];
+            }
+            $where = "(".implode( $albumIds, "," ).")";
+            
             // load the resource counter
-        	$query1 = "SELECT album_id, COUNT(*) AS total FROM ".$this->dbPrefix."gallery_resources GROUP BY album_id";
+        	$query1 = "SELECT album_id, COUNT(*) AS total FROM ".$this->dbPrefix."gallery_resources ".
+        	          "WHERE album_id IN {$where} GROUP BY album_id";
         	// and the child counter
-        	$query2 = "SELECT parent_id,COUNT(*) AS total FROM ".$this->dbPrefix."gallery_albums 
-        	           WHERE parent_id > 0 GROUP BY parent_id";
+        	$query2 = "SELECT parent_id, COUNT(*) AS total FROM ".$this->dbPrefix."gallery_albums 
+        	           WHERE parent_id > 0 AND id IN {$where} GROUP BY parent_id";
         	           
-            $res1 = $this->db->Execute( $query1 );
+            $res1 = $this->Execute( $query1 );
             if( !$res1 ) {
                 $this->message .= "Error loading resources<br/>";
                 return false;
@@ -1886,7 +2173,7 @@
             }
             $res1->Close();
             
-            $res2 = $this->db->Execute( $query2 );
+            $res2 = $this->Execute( $query2 );
             if( !$res2 ) {
                 $this->message .= "Error loading albums<br/>";
                 return false;
@@ -1895,18 +2182,9 @@
             while( $row = $res2->FetchRow()) {
                 $numChildren[$row["parent_id"]] = $row["total"];
             }
-            $res2->Close();
-
-                // now update all albums
-            $query3 = "SELECT id FROM ".$this->dbPrefix."gallery_albums";
-            $res3 = $this->db->Execute( $query3 );
-            if( !$res3 ) {
-                $this->message .= "Error updating gallery albums<br/>";
-                return false;
-            }
-            $numUpdated = 0;
-            while( $row = $res3->FetchRow()) {
-                $albumId = $row["id"];
+            $res2->Close();            
+            
+            foreach( $albumIds as $albumId ) {
                 isset( $numResources[$albumId] ) ? $resources = $numResources[$albumId] : $resources = 0;
                 isset( $numChildren[$albumId]) ? $children = $numChildren[$albumId] : $children = 0;
                 
@@ -1915,68 +2193,193 @@
                           SET num_children = {$children}, num_resources = {$resources}, date = date
                           WHERE id = {$albumId}";
                 // and execute it
-                $res = $this->db->Execute( $query );
+                $res = $this->Execute( $query );
                 if( !$res )
                     $this->message .= "Error updating gallery album with id {$albumId}<br/>";
                 else
-                    $numUpdated++;
+                    $this->updatedRecords++;
             }
             $res3->Close();
              
-            $this->message .= "{$numUpdated} gallery albums updated.<br/>";
+            $processed = $this->page * $this->itemsPerPage;
+            $this->message .= "{$this->updatedRecords} gallery albums updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%)<br/>";
             
             return true;
         }
+    }
+    
+    /**
+     * drops a few fields and tables that are not needed anymore
+     */
+    class PostSchemaDataTransformer extends DatabaseDataTransformer
+    {
+        function getNumSteps()
+        {
+            // everything's done in one step
+            return( 1 );
+        }       
+            
+        function perform()
+        {
+            $this->message = "<b>Removing unneeded database fields and tables (step 9 of 9)</b><br/><br/>";        
         
-        function postSchemaUpdate()
-        {
         	global $Changes;
         	
             foreach( $Changes as $change ) {
                 // replace the de prefix and base url
                 $query = str_replace( "{dbprefix}", $this->dbPrefix, $change );
-                $result = $this->db->Execute( $query  );
+                $result = $this->Execute( $query  );
                 if( !$result ) {
                 	$this->message .= "Error updating database schema {$query}<br/>";
                 }
             }
             
-            $this->message .= "Post database schema updated.<br/>";
+            $this->message .= "Database schema updated.<br/>";
             
-            return true;      	
+            return true;        
         }
+    }
+    
+    /**
+     * This class is basically now a "data transformer runner", because now it works
+     * like class that executes data transformers, collects their results and refreshes
+     * the page to execute the next step of the transformer. If the current transformer
+     * reported that its processing is complete, this class will continue with the next
+     * transformer unless there are no more transformer to run.
+     *
+     * In order to coordinate the current step and the current transformer, two parameters
+     * are needed in each request:
+     *
+     * - page
+     * - transformerId
+     *
+     * The 'page' parameter holds the current page, while 'transformerId' is the index of 
+     * the current transformer in the $this->transformers array.
+     *
+     * In order to add new transformers, follow these steps:
+     *
+     * - Create your own transfomer class by extending DatabaseDataTransformer and implementing
+     * the methods DatabaseDataTransformer::perform() and DatabaseDataTransformer::getNumSteps(). The
+     * first does the data processing while the second one returns the number of needed steps to the
+     * class running the transformer.
+     * - Add the name of the transformer class to the the UpdateStepThree::transformers array,
+     * and the class will take care of everything else. 
+     */
+    class UpdateStepThree extends WizardPagedAction
+    {
+        var $message;    
+        var $currentTransformerId;
+    
+        function UpdateStepThree( $actionInfo, $httpRequest )
+        {
+            $this->WizardPagedAction( $actionInfo, $httpRequest );
+            
+            /**
+             * array with the data transformers that will be run
+             */
+            $this->transformers = Array(
+                "BlogCountersDataTransformer",
+                "CategoryCountersDataTransformer",
+                "ArticleCountersDataTransformer",
+                "BlogTrackbacksDataTransformer",
+                "AdminUsersDataTransformer",
+                "LinkCategoriesDataTransformer",
+                "CommentsDataTransformer",
+                "AlbumsDataTransformer",
+                "PostSchemaDataTransformer"
+            );
+            
+            $this->currentTransformerId = $this->getTransformerIdFromRequest();
+        }
+        
+        /**
+         * gets the id of the transformer from the request. If it is not available, it
+         * will return the id of the first transformer available (which is '0')
+         *
+         * @private
+         */
+        function getTransformerIdFromRequest()
+        {    	
+			$id = HttpVars::getRequestValue( "transformerId" );
+			$val = new IntegerValidator();
+			if( !$val->validate( $id ))
+				$id = 0;
+							
+			return $id;        
+        }        
 
        function perform()
        {
-            // get a connection to the db
-            $this->db = connectDb();
-            $this->dbPrefix = getDbPrefix();
-            $this->db->debug=false;
-
-            $this->message = "";
+            $step = $this->getPageFromRequest();
             
-            $methods = Array( "updateArticleCounters", "updateCategoryCounters", "updateBlogCounters", "updateTrackbacks", 
-                              "updateLinkCategories", "updateAlbums", "updateComments", "updateAdminUsers", "postSchemaUpdate" );
+            // get the current transformer class so that we can continue where we left
+            $transformerClass = $this->transformers[$this->currentTransformerId];                              
+            $transformer = new $transformerClass( $step );
+            $result = $transformer->perform();
+            $complete = $transformer->isComplete();
+            $message = $transformer->message;
             
-            foreach( $methods as $method ) {
-                $result = $this->$method();
-            
-                if( !$result ) {
+            //print("transformer = $transformerClass<br/>");
+             
+            // error during processing and the processor is configured
+            // to fail on error   
+            if( !$result && $transformer->failOnError ) {
+                //print("Error in step = $step<br/>");
+                $this->_view = new WizardView( "update3" );
+                // current and next step
+                $this->_view->setValue( "currentStep", $step );
+                $this->_view->setValue( "nextStep", $step+1 );                
+                // whether this transformer is ready
+                $this->_view->setValue( "complete", $complete );
+                // transformer id
+                $this->_view->setValue( "transformerId", $this->currentTransformerId );            
+                $this->_view->setValue( "error", true );
+                if( $transformer->DbError() != "" ) {
+                    $message .= "<br/><br/>The database error message was: ".$transformer->DbError()."<br/>";
+                }
+
+                $this->_view->setErrorMessage( $message );
+            }                
+            else {
+                if( !$complete ) {
+                    //print("it's not complete! step = $step<br/>");
                     $this->_view = new WizardView( "update3" );
-                    $this->_view->setErrorMessage( $this->message );
-                    return false;
+                    // current and next step
+                    $this->_view->setValue( "currentStep", $step );
+                    $this->_view->setValue( "nextStep", $step+1 );                
+                    // whether this transformer is ready
+                    $this->_view->setValue( "complete", $complete );
+                    // transformer id
+                    $this->_view->setValue( "transformerId", $this->currentTransformerId );
+                }            
+                else {
+                    // have we already been through all transformers?
+                    //print("transformer complete! - num transformers = ".count($this->transformers)."<br/>");
+                    $moreTransformers = ( $this->currentTransformerId+1 < count( $this->transformers ));
+                    if( $moreTransformers ) {
+                        //print("Starting new transformer!<br/>");
+                        $this->_view = new WizardView( "update3" );
+                        // current and next step
+                        $this->_view->setValue( "currentStep", 0 );
+                        $this->_view->setValue( "nextStep", 1 );  
+                        // whether this transformer is ready
+                        $this->_view->setValue( "complete", false );
+                        // transformer id
+                        $this->_view->setValue( "transformerId", $this->currentTransformerId+1 );
+                    }
+                    else {
+                        // no more data to transform, we can finalize the installation!
+                        $this->_view = new WizardView( "update4" );
+                    }
                 }
             }
-
-            // everything went fine so we can show the final page!
-            $this->_view = new WizardView( "update4" );
             
-            $this->_view->setValue( "message", $this->message );
+            $this->_view->setValue( "message", $message );            
 
             return true;
         }
 
-    }
+    }    
 
     // check if the "./tmp" folder is writable by us, otherwise
     // throw an error before the user gets countless errors



More information about the pLog-svn mailing list