Author: david
Date: Thu Nov 19 11:36:21 2009
New Revision: 3921

Log:
Migrate 1.0.7 year-only dates to proper MySQL 'year-only' date format (i.e. 
'yyyy-00-00'). Fixes issue #1136. --force

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

Modified: trunk/lib/task/migrate/QubitMigrate107to108.class.php
==============================================================================
--- trunk/lib/task/migrate/QubitMigrate107to108.class.php       Thu Nov 19 
00:11:14 2009        (r3920)
+++ trunk/lib/task/migrate/QubitMigrate107to108.class.php       Thu Nov 19 
11:36:21 2009        (r3921)
@@ -54,6 +54,7 @@
     $this->copyUserRoleRelationToAclUserGroup();
 
     // Alter qubit classes (methods ordered alphabetically)
+    $this->alterQubitEvents();
     $this->alterQubitMenus();
     $this->alterQubitProperties();
     $this->alterQubitSettings();
@@ -505,6 +506,31 @@
   }
 
   /**
+   * Alter QubitEvent data
+   *
+   * @return QubitMigrate107to108 this object
+   */
+  protected function alterQubitEvents()
+  {
+    // Convert legacy dates (which represented years only) from e.g.
+    // '1910-01-01' -> '1910-00-00'
+    foreach ($this->data['QubitEvent'] as $key => $event)
+    {
+      if (isset($event['start_date']) && preg_match('/(\d{4})-01-01/', 
$event['start_date']))
+      {
+        $this->data['QubitEvent'][$key]['start_date'] = 
substr($event['start_date'], 0, 4).'-00-00';
+      }
+
+      if (isset($event['end_date']) && preg_match('/(\d{4})-01-01/', 
$event['end_date']))
+      {
+        $this->data['QubitEvent'][$key]['end_date'] = 
substr($event['end_date'], 0, 4).'-00-00';
+      }
+    }
+
+    return $this;
+  }
+
+  /**
    * Alter QubitMenu data
    *
    * @return QubitMigrate107to108 this object

--

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=.


Reply via email to