[pLog-svn] r6453 - in plog/trunk: . templates/wizard
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Fri May 9 10:42:43 EDT 2008
Author: jondaley
Date: 2008-05-09 10:42:43 -0400 (Fri, 09 May 2008)
New Revision: 6453
Modified:
plog/trunk/templates/wizard/checks.template
plog/trunk/wizard
Log:
removed 1.2 fixup
Modified: plog/trunk/templates/wizard/checks.template
===================================================================
--- plog/trunk/templates/wizard/checks.template 2008-05-09 14:38:39 UTC (rev 6452)
+++ plog/trunk/templates/wizard/checks.template 2008-05-09 14:42:43 UTC (rev 6453)
@@ -14,12 +14,8 @@
{else}
<div class="wizardInfo">
<img src="imgs/admin/icon_info-16.png" alt="Info" class="wizardInfoIcon" />
- <p class="wizardInfoText">Welcome to the configuration wizard of LifeType. These are some basic checks of your current
- system in order to ensure that LifeType can run properly.
- <br/><br/>
- <b>IMPORTANT NOTE:</b>If you previously upgraded from LifeType 1.1.x to 1.2.0, there are some changes that need to be done to some of your resources.
- This is a known issue in the upgrade process of LifeType 1.1.x to 1.2.0 that did not convert the name of some preview files correctly.
- In order to have this issue fixed, click <a href="?nextStep=Fix120">here</a> and let the browser window reload.</p>
+ <p class="wizardInfoText">Welcome to the configuration wizard of LifeType. These are some basic checks of your current system in order to ensure that LifeType can run properly.
+ </p>
</div>
{/if}
Modified: plog/trunk/wizard
===================================================================
--- plog/trunk/wizard 2008-05-09 14:38:39 UTC (rev 6452)
+++ plog/trunk/wizard 2008-05-09 14:42:43 UTC (rev 6453)
@@ -88,7 +88,6 @@
$_actionMap["Update1"] = "UpdateStepOne";
$_actionMap["Update2"] = "UpdateStepTwo";
$_actionMap["Update3"] = "UpdateStepThree";
- $_actionMap["Fix120"] = "Fix120StepOne";
/**
@@ -1965,96 +1964,7 @@
}
}
- /**
- * 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
{
@@ -2242,130 +2152,6 @@
}
}
- // 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
More information about the pLog-svn
mailing list