Author: david
Date: Mon Jun 27 10:06:11 2011
New Revision: 9183

Log:
Differentiate between major milestones (releases) and data version

Modified:
   trunk/lib/task/migrate/MigrateTask.class.php

Modified: trunk/lib/task/migrate/MigrateTask.class.php
==============================================================================
--- trunk/lib/task/migrate/MigrateTask.class.php        Fri Jun 24 21:31:48 
2011        (r9182)
+++ trunk/lib/task/migrate/MigrateTask.class.php        Mon Jun 27 10:06:11 
2011        (r9183)
@@ -32,8 +32,8 @@
     $dataModified = false,
     $initialVersion,
     $targetVersion,
-    // list of migratable versions
-    $validVersions = array(
+    // list of migratable releases
+    $validReleases = array(
       '1.0.3',
       '1.0.4',
       '1.0.5',
@@ -77,7 +77,7 @@
     // Get target application version for data migration
     if (isset($options['target-version']))
     {
-      if (!preg_match('/^\d+$/', $options['target-version']) || 
!in_array($options['target-version'], $this->validVersions))
+      if (!preg_match('/^\d+$/', $options['target-version']) || 
!in_array($options['target-version'], $this->validReleases))
       {
         throw new Exception('Invalid target version 
"'.$options['target-version'].'".');
       }
@@ -124,42 +124,42 @@
 
   protected function migratePre108()
   {
-    // If target version is not set, then use last valid version (1.0.7)
+    // If target release is not set, then use last valid release (1.0.7)
     $targetVersion = $this->targetVersion;
     if (null == $targetVersion)
     {
       $targetVersion = '1.0.7';
     }
 
-    // Incrementally call the upgrade task for each intervening version from
-    // initial version to the target version
-    $initialIndex = array_search($this->initialVersion, $this->validVersions);
+    // Incrementally call the upgrade task for each intervening release from
+    // initial release to the target release
+    $initialIndex = array_search($this->initialVersion, $this->validReleases);
     if (false === $initialIndex)
     {
-      $initialIndex = count($this->validVersions) - 2;
+      $initialIndex = count($this->validReleases) - 2;
     }
 
-    $finalIndex = array_search($targetVersion, $this->validVersions);
+    $finalIndex = array_search($targetVersion, $this->validReleases);
 
     if ($initialIndex !== false && $finalIndex !== false && $initialIndex < 
$finalIndex)
     {
       for ($i = $initialIndex; $i < $finalIndex; $i++)
       {
-        $this->migrator = QubitMigrateFactory::getMigrator($this->data, 
$this->validVersions[$i]);
+        $this->migrator = QubitMigrateFactory::getMigrator($this->data, 
$this->validReleases[$i]);
         $this->data = $this->migrator->execute();
         $this->dataModified = true;
 
-        // Set version
-        if ('1.0.7' == $this->validVersions[$i])
+        // Set release
+        if ('1.0.7' == $this->validReleases[$i])
         {
-          $this->version = 0;
+          $this->version = 0; // After 1.0.7 use integer versions
         }
         else
         {
-          $this->version = $this->validVersions[$i+1];
+          $this->version = $this->validReleases[$i+1];
         }
 
-        $this->logSection('migrate', 'Data migrated to version 
'.$this->validVersions[$i]);
+        $this->logSection('migrate', 'Data migrated to Release 
'.$this->validReleases[$i+1]);
       }
     }
   }

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to