Author: david
Date: Thu Oct 14 16:35:54 2010
New Revision: 8140
Log:
Set an explicit publication status for *every* information object. Fixes issue
#1714.
Modified:
trunk/data/fixtures/settings.yml
trunk/lib/task/migrate/QubitMigrate109.class.php
Modified: trunk/data/fixtures/settings.yml
==============================================================================
--- trunk/data/fixtures/settings.yml Thu Oct 14 16:34:00 2010 (r8139)
+++ trunk/data/fixtures/settings.yml Thu Oct 14 16:35:54 2010 (r8140)
@@ -3,7 +3,7 @@
name: version
editable: 0
deleteable: 0
- value: 52
+ value: 53
QubitSetting_2:
name: upload_dir
editable: 0
Modified: trunk/lib/task/migrate/QubitMigrate109.class.php
==============================================================================
--- trunk/lib/task/migrate/QubitMigrate109.class.php Thu Oct 14 16:34:00
2010 (r8139)
+++ trunk/lib/task/migrate/QubitMigrate109.class.php Thu Oct 14 16:35:54
2010 (r8140)
@@ -74,6 +74,9 @@
case 51:
$this->addDefaultPubStatusSetting();
+
+ case 52:
+ $this->setPubStatusExplictly();
}
// Delete "stub" objects
@@ -445,6 +448,54 @@
}
/**
+ * Ver 53: Explicitly set publication status on all info objects
+ *
+ * @return QubitMigrate109 this object
+ */
+ protected function setPubStatusExplictly()
+ {
+ foreach ($this->data['QubitInformationObject'] as $key => $item)
+ {
+ var_dump($key, $this->getRowKey('QubitStatus', 'object_id', $key));
+ if (false === $this->getRowKey('QubitStatus', 'object_id', $key))
+ {
+ $statusKey = false;
+ $keys = array($key);
+
+ // Build array of all descriptions from the current one until we reach
+ // an ancestor with a publication status
+ while
(isset($this->data['QubitInformationObject'][$keys[0]]['parent_id']))
+ {
+ $parentKey =
$this->data['QubitInformationObject'][$keys[0]]['parent_id'];
+ $statusKey = $this->getRowKey('QubitStatus', 'object_id',
$parentKey);
+
+ if ($statusKey)
+ {
+ break;
+ }
+ else
+ {
+ array_unshift($keys, $parentKey);
+ }
+ }
+
+ // Duplicate ancestor's publication status. Assign status to all
+ // descendents in $keys stack
+ while ($statusKey && 0 < count($keys))
+ {
+ $status['object_id'] = array_shift($keys);
+ $status['type_id'] =
$this->data['QubitStatus'][$statusKey]['type_id'];
+ $status['status_id'] =
$this->data['QubitStatus'][$statusKey]['status_id'];
+
+ $this->data['QubitStatus']["QubitStatus_{$status['object_id']}"] =
$status;
+ }
+ }
+ }
+
+ return $this;
+ }
+
+ /**
* Sort information objects by lft value so that parent objects are inserted
* before their children.
*
--
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.