[pLog-svn] r5492 - plog/trunk
mark at devel.lifetype.net
mark at devel.lifetype.net
Tue Jun 5 14:42:12 EDT 2007
Author: mark
Date: 2007-06-05 14:42:12 -0400 (Tue, 05 Jun 2007)
New Revision: 5492
Modified:
plog/trunk/wizard.php
Log:
Revert the wizard.php to 5158, and re-merge the changes from 1.2 trunk (from 5158 to 5491).
Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php 2007-06-05 14:36:56 UTC (rev 5491)
+++ plog/trunk/wizard.php 2007-06-05 18:42:12 UTC (rev 5492)
@@ -31,14 +31,15 @@
// many hosts don't have this enabled and we, for the time being, need it...
ini_set("arg_seperator.output", "&");
-
- include( PLOG_CLASS_PATH."class/bootstrap.php" );
+
+ include_once( PLOG_CLASS_PATH."class/bootstrap.php" );
lt_include( PLOG_CLASS_PATH."class/controller/controller.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
lt_include( PLOG_CLASS_PATH."class/action/action.class.php" );
lt_include( PLOG_CLASS_PATH."class/database/db.class.php" );
lt_include( PLOG_CLASS_PATH."class/template/template.class.php" );
lt_include( PLOG_CLASS_PATH."class/view/view.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/emailvalidator.class.php" );
@@ -67,15 +68,14 @@
lt_include( PLOG_CLASS_PATH."class/dao/permissions.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/permission.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/userpermission.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/userpermission.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/dao/userinfo.class.php" );
lt_include( PLOG_CLASS_PATH."class/misc/integritychecker.class.php" );
// table schemas
- lt_include( PLOG_CLASS_PATH."install/dbschemas.properties.php" );
+ include( PLOG_CLASS_PATH."install/dbschemas.properties.php" );
// default configuration values for 1.1
- lt_include( PLOG_CLASS_PATH."install/defaultconfig.properties.php" );
- // post schema changes after upgrade
- lt_include( PLOG_CLASS_PATH."install/changes_10_11.properties.php" );
+ include( PLOG_CLASS_PATH."install/defaultconfig.properties.php" );
define( "TEMP_FOLDER", "./tmp" );
@@ -90,6 +90,8 @@
$_actionMap["Step5"] = "WizardStepFive";
$_actionMap["Update1"] = "UpdateStepOne";
$_actionMap["Update2"] = "UpdateStepTwo";
+ $_actionMap["Update3"] = "UpdateStepThree";
+ $_actionMap["Fix120"] = "Fix120StepOne";
/**
@@ -368,7 +370,7 @@
{
function WizardSafeModeValidator()
{
- $this->WizardValidator( "Checking if <b>safe mode</b> is enabled",
+ $this->WizardValidator( "Checking if <b>safe mode</b> is disabled",
"LifeType can run when PHP's safe mode is enabled, but it may cause some problems.",
false );
}
@@ -456,7 +458,7 @@
function validate()
{
- lt_include( PLOG_CLASS_PATH."install/files.properties.php");
+ include( PLOG_CLASS_PATH."install/files.properties.php");
$result = IntegrityChecker::checkIntegrity(
$data
@@ -989,7 +991,7 @@
}
// load the core permissions
- lt_include( PLOG_CLASS_PATH."install/corepermissions.properties.php" );
+ include( PLOG_CLASS_PATH."install/corepermissions.properties.php" );
// process permissions
$total = 0;
@@ -1057,7 +1059,7 @@
{
$this->WizardAction( $actionInfo, $request );
- $this->registerFieldValidator( "userName", new StringValidator());
+ $this->registerFieldValidator( "userName", new UsernameValidator());
$this->registerFieldValidator( "userPassword", new PasswordValidator());
$this->registerFieldValidator( "userPasswordCheck", new PasswordValidator());
$this->registerFieldValidator( "userEmail", new EmailValidator());
@@ -1296,6 +1298,20 @@
$this->setCommonData();
}
}
+
+ class UpdateStepTwo extends WizardAction
+ {
+ function perform()
+ {
+ lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
+ $config =& Config::getConfig();
+ $resourcesNamingRule = $config->getValue( "resources_naming_rule", "original_file_name" );
+
+ $this->_view = new WizardView( "update2" );
+ $this->_view->setValue( "resourcesNamingRule", $resourcesNamingRule );
+ $this->setCommonData();
+ }
+ }
/**
* Generic class that performs data updates on the database
@@ -1412,13 +1428,11 @@
$tablesArray = array_keys( $Tables );
$curTable = $tablesArray[$this->page-1];
- //print("Processing page: ".$this->page." - table: ".$curTable."<br/>" );
-
$db =& Db::getDb();
$dict = NewPDbDataDictionary( $db );
$errors = false;
- $this->message = "Performing changes to the dabase schema, please wait (step 1 of 6)<br/>";
+ $this->message = "Performing changes to the dabase schema, please wait (step %s of %s)<br/>";
$errorMessage = "";
$table_errors = false;
@@ -1470,7 +1484,7 @@
function perform()
{
- $this->message = "<b>Updating user permissions (step 4 of 6)</b><br/><br/>";
+ $this->message = "Updating user permissions (step %s of %s)<br/>";
$query3 = "SELECT * FROM ".Db::getPrefix()."tmp_users_permissions";
$res3 = $this->Execute( $query3, $this->page, $this->itemsPerPage );
@@ -1504,7 +1518,7 @@
}
}
- $this->message .= "{$this->updatedRecords} users updated (".$this->getPercentProcessed()."%)<br/>";
+ $this->message .= "{$this->updatedRecords} users updated (".$this->getPercentProcessed()."%%)<br/>";
$this->Execute("DROP TABLE ".Db::getPrefix()."tmp_users_permissions");
@@ -1526,11 +1540,11 @@
function perform()
{
// initial message, no errors yet
- $this->message = "<b>Loading new permissions (step 2 of 6)</b><br/><br/>";
+ $this->message = "Loading new permissions (step %s of %s)<br/>";
$errors = false;
// load the core permissions
- lt_include( PLOG_CLASS_PATH."install/corepermissions.properties.php" );
+ include( PLOG_CLASS_PATH."install/corepermissions.properties.php" );
// process permissions
$total = 0;
@@ -1581,7 +1595,7 @@
{
global $Inserts;
- $this->message = "<b>Adding new configuration parameters (step 4 of 6)</b><br/><br/>";
+ $this->message = "Adding new configuration parameters (step %s of %s)<br/>";
$errors = false;
// Find some of the tools we are going to need (last one is for os x, with fink installed), this will be needed later on
@@ -1662,7 +1676,7 @@
}
if( !$errors ) {
- $this->message = "Configuration settings updated successfully";
+ $this->message .= "Configuration settings updated successfully";
}
return( !$errors );
@@ -1681,40 +1695,47 @@
function perform()
{
- $this->message = "<b>Updating admin user permissions (step 3 of 6)</b><br/><br/>";
+ $this->message = "Updating admin user permissions (step %s of %s)<br/>";
// load each one of the categories and update them
// list of categories
- $query3 = "SELECT id, site_admin FROM ".$this->dbPrefix."users";
+ /*$query3 = "SELECT id, site_admin FROM ".$this->dbPrefix."users";
$res3 = $this->Execute( $query3, $this->page, $this->itemsPerPage );
if( $res3->RecordCount() == 0 ) {
$this->message .= "No more records to process";
return( true );
- }
+ }*/
+ $users = new Users();
+ $allUsers = $users->getAllUsers( USER_STATUS_ALL, "", "", $this->page, $this->itemsPerPage );
+
$permissions = new Permissions();
$userPermissions = new UserPermissions();
$loginPerm = $permissions->getPermissionByName( "login_perm" );
$allPerms = $permissions->getAllPermissions();
- while( $row = $res3->FetchRow()) {
- if( $row["site_admin"] > 0 ) {
+ //while( $row = $res3->FetchRow()) {
+ foreach( $allUsers as $user ) {
+ print("Processing user: ".$user->getUsername()."<br/>");
+ //if( $row["site_admin"] > 0 ) {
+ if( $user->isSiteAdmin()) {
// it's an admin, let's grant all the appropriate permissions
foreach( $allPerms as $perm ) {
if( $perm->isAdminOnlyPermission() && $perm->getName() != "login_perm" ) {
- $userPerm = new UserPermission( $row["id"], 0, $perm->getId());
+ //$userPerm = new UserPermission( $row["id"], 0, $perm->getId());
+ $userPerm = new UserPermission( $user->getId(), 0, $perm->getId());
$userPermissions->grantPermission( $userPerm );
}
}
}
// grant the login_perm permission or else users won't be able to log in
- $newPerm = new UserPermission( $row["id"], 0, $loginPerm->getId());
+ $newPerm = new UserPermission( $user->getId(), 0, $loginPerm->getId());
$userPermissions->grantPermission( $newPerm );
$this->updatedRecords++;
}
- $this->message .= "{$this->updatedRecords} users updated (".$this->getPercentProcessed()."%)<br/>";
+ $this->message .= "{$this->updatedRecords} users updated (".$this->getPercentProcessed()."%%)<br/>";
return true;
}
}
@@ -1722,7 +1743,7 @@
/**
* processes all resource files and renames the files to their "real" names
*/
- class ResourcesDataTransformer extends DatabaseDataTransformer
+ class ResourcesOriginalFileNameDataTransformer extends DatabaseDataTransformer
{
function getNumSteps()
{
@@ -1731,7 +1752,7 @@
function perform()
{
- $this->message = "<b>Updating resource files (step 6 of 6)</b><br/><br/>";
+ $this->message = "Updating resource files with original file naming rule (step %s of %s)<br/>";
$query1 = "SELECT id, owner_id, file_name, resource_type, thumbnail_format FROM ".$this->dbPrefix."gallery_resources";
@@ -1774,13 +1795,12 @@
}
}
}
-
// if it's an image, we also need to process the previews
if( $row["resource_type"] == "1" ) {
// calculate the extension of the preview file, depending on how it was saved
if( $row["thumbnail_format"] == "same" ) {
- $previewExt = $fileExt;
+ $previewExt = strtolower( $fileExt );
$destFileName = $row["file_name"];
}
else {
@@ -1811,17 +1831,183 @@
}
}
}
+
+ $this->updatedRecords++;
+ }
+ $res1->Close();
+ $this->message .= "{$this->updatedRecords} resource files updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%%)<br/>";
+ return true;
+ }
+ }
+
+ /**
+ * processes all resource files and renames the files to their "encoded" names
+ */
+ class ResourcesEncodedFileNameDataTransformer extends DatabaseDataTransformer
+ {
+ function getNumSteps()
+ {
+ return( parent::getNumSteps( "gallery_resources" ));
+ }
+
+ function perform()
+ {
+ $this->message = "Updating resource files with encoded file naming rule (step %s of %s)<br/>";
+
+ $query1 = "SELECT id, owner_id, file_name, resource_type, thumbnail_format FROM ".$this->dbPrefix."gallery_resources";
+
+ $config =& Config::getConfig();
+ $galleryFolder = $config->getValue( "resources_folder" );
+
+ // total number of comments
+ $res1 = $this->Execute( $query1, $this->page, $this->itemsPerPage );
+ if( !$res1 ) {
+ $this->message .= "Error performing loading resource data";
+ return false;
+ }
+ if( $res1->RecordCount() == 0 ) {
+ $this->message .= "No more records to process";
+ return( true );
+ }
+ $numComments = Array();
+ while( $row = $res1->FetchRow()) {
+ //
+ // process each one of the rows and rename the main file
+ //
+ // get the file extension
+ if(( $extPos = strrpos( $row["file_name"], "." )) !== false ) {
+ $fileExt = substr( $row["file_name"], $extPos+1, strlen( $row["file_name"] ));
+ }
+ else {
+ $fileExt = "";
+ }
+
+ $fileName = $galleryFolder.$row["owner_id"]."/".$row["owner_id"]."-".$row["id"].".".$fileExt;
+ $destFileName = $galleryFolder.$row["owner_id"]."/".$row["owner_id"]."-".$row["id"].".".strtolower($fileExt);
+ if( $fileName != $destFileName ) {
+ if( File::exists( $fileName )) {
+ if( !File::exists( $destFileName)) {
+ if( !File::rename( $fileName, $destFileName )) {
+ $this->message .= "Error updating resource file with id ".$row["id"].", while attempting to rename file from $fileName to $destFileName<br/>";
+ }
+ }
+ }
+ }
$this->updatedRecords++;
}
$res1->Close();
- $this->message .= "{$this->updatedRecords} resource files updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%)<br/>";
+ $this->message .= "{$this->updatedRecords} resource files updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%%)<br/>";
return true;
}
}
+
+ /**
+ * processes all resource files that we did not convert correctly in 1.2.0
+ */
+ class ResourcesFix120FileNameDataTransformer extends DatabaseDataTransformer
+ {
+ function getNumSteps()
+ {
+ return( parent::getNumSteps( "gallery_resources" ));
+ }
+
+ function perform()
+ {
+ $this->message = "Fixing resource files with original file naming rule (step %s of %s)<br/>";
+ $query1 = "SELECT id, owner_id, file_name, resource_type, thumbnail_format FROM ".$this->dbPrefix."gallery_resources";
+
+ $config =& Config::getConfig();
+ $galleryFolder = $config->getValue( "resources_folder" );
+
+ // total number of comments
+ $res1 = $this->Execute( $query1, $this->page, $this->itemsPerPage );
+ if( !$res1 ) {
+ $this->message .= "Error performing loading resource data";
+ return false;
+ }
+ if( $res1->RecordCount() == 0 ) {
+ $this->message .= "No more records to process";
+ return( true );
+ }
+ $numComments = Array();
+ while( $row = $res1->FetchRow()) {
+ //
+ // process each one of the rows and rename the main file
+ //
+
+ // get the file extension
+ if(( $extPos = strrpos( $row["file_name"], "." )) !== false ) {
+ $fileExt = substr( $row["file_name"], $extPos+1, strlen( $row["file_name"] ));
+ }
+ else {
+ $fileExt = "";
+ }
+
+ // Only convert the preview file name if the file extension does not lower case
+ if( strtolower( $fileExt ) != $fileExt ) {
+ // if it's an image, we also need to process the previews
+ if( $row["resource_type"] == "1" ) {
+ // calculate the extension of the preview file, depending on how it was saved
+ if( $row["thumbnail_format"] == "same" ) {
+ $previewExt = strtolower( $fileExt );
+ $destFileName = $row["file_name"];
+ }
+ else {
+ $previewExt = $row["thumbnail_format"];
+ // remove the old extension and put the new one in place
+ //print("file name = ".$row["file_name"]." - file ext = $fileExt - previewExt = $previewExt" );
+ $destFileName = str_replace( $fileExt, $previewExt, $row["file_name"] );
+ }
+
+ // file names for the preview and medium preview
+ $previewFileName = $galleryFolder.$row["owner_id"]."/previews/".$row["owner_id"]."-".$row["id"].".".$previewExt;
+ $medPreviewFileName = $galleryFolder.$row["owner_id"]."/previews-med/".$row["owner_id"]."-".$row["id"].".".$previewExt;
+ // destination file names for the preview and medium preview
+ $destPreviewFileName = $galleryFolder.$row["owner_id"]."/previews/".$destFileName;
+ $destMedPreviewFileName = $galleryFolder.$row["owner_id"]."/previews-med/".$destFileName;
+
+ //print(" -- renaming preview: $previewFileName -- $destPreviewFileName<br/>");
+ //print(" -- renaming medium preview: $medPreviewFileName -- $destMedPreviewFileName<br/>");
+
+ if( File::exists( $previewFileName )) {
+ if( !File::exists( $destPreviewFileName)) {
+ File::rename( $previewFileName, $destPreviewFileName );
+ }
+ }
+ if( File::exists( $medPreviewFileName )) {
+ if( !File::exists( $destMedPreviewFileName)) {
+ File::rename( $medPreviewFileName, $destMedPreviewFileName );
+ }
+ }
+ }
+ }
+
+ $this->updatedRecords++;
+ }
+ $res1->Close();
+ $this->message .= "{$this->updatedRecords} resource files updated, ".$this->getTotalProcessedRecords()." processed so far (".$this->getPercentProcessed()."%%)<br/>";
+ return true;
+ }
+ }
+
+ // Dummy Transformer
+ class DummyDataTransformer extends DatabaseDataTransformer
+ {
+ function getNumSteps()
+ {
+ return( 0 );
+ }
+
+ function perform()
+ {
+ 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
@@ -1844,31 +2030,54 @@
* 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 UpdateStepTwo::transformers array,
+ * - Add the name of the transformer class to the the UpdateStepThree::transformers array,
* and the class will take care of everything else.
*/
- class UpdateStepTwo extends WizardPagedAction
+ class UpdateStepThree extends WizardPagedAction
{
- var $message;
+ var $resourcesNamingRule;
+ var $message;
var $currentTransformerId;
+ var $totalTransformers;
- function UpdateStepTwo( $actionInfo, $httpRequest )
+ function UpdateStepThree( $actionInfo, $httpRequest )
{
$this->WizardPagedAction( $actionInfo, $httpRequest );
+ // data validation
+ $this->registerFieldValidator( "resourcesNamingRule", new StringValidator());
+ $errorView = new WizardView( "update2" );
+ $errorView->setErrorMessage( "Some data was incorrect or missing." );
+ $this->setValidationErrorView( $errorView );
/**
* array with the data transformers that will be run
*/
- $this->transformers = Array(
- "DatabaseSchemaDataTransformer",
- "PermissionLoader",
- "AdminUserPermissionsDataTransformer",
- "UserPermissionsDataTransformer",
- "ConfigDataTransformer",
- "ResourcesDataTransformer"
- );
-
+ $this->resourcesNamingRule = $this->_request->getValue( "resourcesNamingRule" );
+ if( $this->resourcesNamingRule == 'encoded_file_name' ) {
+ $this->transformers = Array(
+ "DatabaseSchemaDataTransformer",
+ "PermissionLoader",
+ "AdminUserPermissionsDataTransformer",
+ "UserPermissionsDataTransformer",
+ "ConfigDataTransformer",
+ "ResourcesEncodedFileNameDataTransformer",
+ "DummyDataTransformer"
+ );
+ }
+ else {
+ $this->transformers = Array(
+ "DatabaseSchemaDataTransformer",
+ "PermissionLoader",
+ "AdminUserPermissionsDataTransformer",
+ "UserPermissionsDataTransformer",
+ "ConfigDataTransformer",
+ "ResourcesOriginalFileNameDataTransformer",
+ "DummyDataTransformer"
+ );
+ }
+
$this->currentTransformerId = $this->getTransformerIdFromRequest();
+ $this->totalTransformers = count( $this->transformers ) - 1;
}
/**
@@ -1892,11 +2101,12 @@
$step = $this->getPageFromRequest();
// get the current transformer class so that we can continue where we left
- $transformerClass = $this->transformers[$this->currentTransformerId];
+ $transformerClass = $this->transformers[$this->currentTransformerId];
$transformer = new $transformerClass( $step );
$result = $transformer->perform();
$complete = $transformer->isComplete();
$message = $transformer->message;
+ $message = sprintf( $message, $this->currentTransformerId + 1, $this->totalTransformers );
//print("transformer = $transformerClass<br/>");
@@ -1905,6 +2115,7 @@
if( !$result && $transformer->failOnError ) {
//print("Error in step = $step<br/>");
$this->_view = new WizardView( "update3" );
+ $this->_view->setValue( "resourcesNamingRule", $this->resourcesNamingRule );
// current and next step
$this->_view->setValue( "currentStep", $step );
$this->_view->setValue( "nextStep", $step+1 );
@@ -1913,8 +2124,8 @@
// transformer id
$this->_view->setValue( "transformerId", $this->currentTransformerId );
$this->_view->setValue( "error", true );
- if( $transformer->ErrorMsg() != "" ) {
- $message .= "<br/>The database error message was: ".$transformer->ErrorMsg()."<br/>";
+ if( $transformer->DbError() != "" ) {
+ $message .= "<br/>The database error message was: ".$transformer->DbError()."<br/>";
}
$this->_view->setErrorMessage( $message );
@@ -1923,6 +2134,7 @@
if( !$complete ) {
//print("it's not complete! step = $step<br/>");
$this->_view = new WizardView( "update3" );
+ $this->_view->setValue( "resourcesNamingRule", $this->resourcesNamingRule );
// current and next step
$this->_view->setValue( "currentStep", $step );
$this->_view->setValue( "nextStep", $step+1 );
@@ -1938,6 +2150,7 @@
if( $moreTransformers ) {
//print("Starting new transformer!<br/>");
$this->_view = new WizardView( "update3" );
+ $this->_view->setValue( "resourcesNamingRule", $this->resourcesNamingRule );
// current and next step
$this->_view->setValue( "currentStep", 0 );
$this->_view->setValue( "nextStep", 1 );
@@ -1953,6 +2166,9 @@
$config =& Config::getConfig();
$tmpFolder = $config->getValue( "temp_folder", TEMP_FOLDER );
WizardTools::cleanTmpFolder();
+
+ // save the resources naming rule to config table
+ $config->saveValue( "resources_naming_rule", $this->resourcesNamingRule );
$this->_view = new WizardView( "update4" );
}
@@ -1963,9 +2179,132 @@
return true;
}
+ }
- }
+ // Fix those resources that we did not convert correctly in 1.2.0
+ class Fix120StepOne extends WizardPagedAction
+ {
+ var $message;
+ var $currentTransformerId;
+ var $totalTransformers;
+
+ function Fix120StepOne( $actionInfo, $httpRequest )
+ {
+ $this->WizardPagedAction( $actionInfo, $httpRequest );
+
+ /**
+ * array with the data transformers that will be run
+ */
+ $this->transformers = Array(
+ "ResourcesFix120FileNameDataTransformer",
+ "DummyDataTransformer"
+ );
+ $this->currentTransformerId = $this->getTransformerIdFromRequest();
+ $this->totalTransformers = count( $this->transformers ) - 1;
+ }
+
+ /**
+ * 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()
+ {
+ $step = $this->getPageFromRequest();
+
+ // 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;
+ $message = sprintf( $message, $this->currentTransformerId + 1, $this->totalTransformers );
+
+ //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/>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( "fix120" );
+ // 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( "fix120" );
+ // 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!
+ // delete the contents of the temporary folder
+ lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
+ $config =& Config::getConfig();
+ $tmpFolder = $config->getValue( "temp_folder", TEMP_FOLDER );
+ WizardTools::cleanTmpFolder();
+
+ // User upgrade LifeType from 1.1.x to 1.2.0, they have to use "original_file_name",
+ // becasue there is no option for user to choose he want to use encoded file name
+ // or original file name.
+ // save the resources naming rule to config table
+ $config->saveValue( "resources_naming_rule", "original_file_name" );
+
+ $this->_view = new WizardView( "update4" );
+ }
+ }
+ }
+
+ $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
// from Smarty
@@ -1977,4 +2316,4 @@
//// main part ////
$controller = new Controller( $_actionMap, "nextStep" );
$controller->process( HttpVars::getRequest());
-?>
+?>
\ No newline at end of file
More information about the pLog-svn
mailing list