Author: david
Date: Wed Nov 30 10:54:14 2011
New Revision: 10359
Log:
Ensure all info objects get an explicit publication status during migration.
Fixes issue 2196
Modified:
trunk/data/fixtures/settings.yml
trunk/lib/task/migrate/QubitMigrate110.class.php
Modified: trunk/data/fixtures/settings.yml
==============================================================================
--- trunk/data/fixtures/settings.yml Wed Nov 30 08:09:37 2011 (r10358)
+++ trunk/data/fixtures/settings.yml Wed Nov 30 10:54:14 2011 (r10359)
@@ -3,7 +3,7 @@
name: version
editable: 0
deleteable: 0
- value: 74
+ value: 75
QubitSetting_2:
name: upload_dir
editable: 0
Modified: trunk/lib/task/migrate/QubitMigrate110.class.php
==============================================================================
--- trunk/lib/task/migrate/QubitMigrate110.class.php Wed Nov 30 08:09:37
2011 (r10358)
+++ trunk/lib/task/migrate/QubitMigrate110.class.php Wed Nov 30 10:54:14
2011 (r10359)
@@ -85,6 +85,9 @@
case 73:
$this->addGlobalReplaceMenu();
+
+ case 74:
+ $this->ensurePublicationStatus();
}
// Delete "stub" objects
@@ -808,6 +811,56 @@
}
/**
+ * Ensure all information objects get an explicit publication status
+ *
+ * @return QubitMigrate110 SELF
+ */
+ protected function ensurePublicationStatus()
+ {
+ foreach ($this->data['QubitInformationObject'] as $key => &$item)
+ {
+ // Ignore ROOT
+ if ('<?php echo QubitInformationObject::ROOT_ID."\n" ?>' == $item['id'])
+ {
+ continue;
+ }
+
+ // Don't do anything if this node already has a publication status
+ if ($this->findRowKeyForColumnValue($this->data['QubitStatus'],
'object_id', $key) ||
+ $this->findRowKeyForColumnValue($this->data['QubitStatus'],
'object_id', $item['id']))
+ {
+ continue;
+ }
+
+ // Search up hierarchy for ancestor with status
+ $inheritedStatusKey = null;
+ $node = $item;
+
+ while (!isset($inheritedStatusKey))
+ {
+ $parentKey = $node['parent_id'];
+ $statusKey =
$this->findRowKeyForColumnValue($this->data['QubitStatus'], 'object_id',
$parentKey);
+
+ if ($statusKey)
+ {
+ $inheritedStatusKey = $statusKey;
+ }
+ else
+ {
+ $node = $this->data['QubitInformationObject'][$parentKey];
+ }
+ }
+
+ $this->data['QubitStatus']['QubitStatus_'.$key] = array(
+ 'object_id' => $key,
+ 'type_id' =>
$this->data['QubitStatus'][$inheritedStatusKey]['type_id'],
+ 'status_id' =>
$this->data['QubitStatus'][$inheritedStatusKey]['status_id']);
+ }
+
+ return $this;
+ }
+
+ /**
* Slugs are inserted when some resources are inserted, but slugs are dumped
* separately when data is dumped. So loading slug data will try to insert
* duplicate slugs. To work around this, turn slugs into resource properties
--
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.