Author: david
Date: Thu Oct  8 16:33:47 2009
New Revision: 3704

Log:
Migrate 'name access point (subject)' events to QubitRelations table. --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 Oct  8 
15:52:28 2009        (r3703)
+++ trunk/lib/task/migrate/QubitMigrate107to108.class.php       Thu Oct  8 
16:33:47 2009        (r3704)
@@ -945,6 +945,31 @@
       )
     );
 
+    // Migrate existing name access points (event type = 'subject') to
+    // QubitRelation table
+    if ($termKey = $this->getTermKey('<?php echo QubitTerm::SUBJECT_ID."\n" 
?>'))
+    {
+      while ($key = $this->getRowKey('QubitEvent', 'type_id', $termKey))
+      {
+        $event = $this->data['QubitEvent'][$key];
+
+        // Get a random, unique key
+        do
+        {
+          $newKey = rand();
+        }
+        while (isset($this->data['QubitRelation'][$newKey]));
+
+        $this->data['QubitRelation']['QubitRelation_'.$newKey] = array(
+          'subject_id' => $event['information_object_id'],
+          'object_id' => $event['actor_id'],
+          'type_id' => '<?php echo QubitTerm::NAME_ACCESS_POINT_ID."\n" ?>'
+        );
+
+        unset($this->data['QubitEvent'][$key]);
+      }
+    }
+
     return $this;
   }
 

--~--~---------~--~----~------------~-------~--~----~
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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to