Author: david
Date: Mon Aug 22 17:54:17 2011
New Revision: 9565
Log:
Move digital assets to per repository paths
Modified:
trunk/lib/task/migrate/QubitMigrate110.class.php
Modified: trunk/lib/task/migrate/QubitMigrate110.class.php
==============================================================================
--- trunk/lib/task/migrate/QubitMigrate110.class.php Mon Aug 22 17:30:27
2011 (r9564)
+++ trunk/lib/task/migrate/QubitMigrate110.class.php Mon Aug 22 17:54:17
2011 (r9565)
@@ -597,6 +597,12 @@
*/
protected function updatePathToAssets()
{
+ // Create "uploads/r" subdirectory
+ if (!file_exists(sfConfig::get('sf_web_dir').'uploads/r'))
+ {
+ mkdir(sfConfig::get('sf_web_dir').'uploads/r');
+ }
+
foreach ($this->data['QubitDigitalObject'] as $key => &$item)
{
if (!isset($item['information_object_id']))
@@ -625,15 +631,17 @@
// Get repository
$repo = $this->getRowByKeyOrId('QubitRepository',
$infoObject['repository_id']);
- // Update path
- $item['path'] = str_replace('uploads', 'uploads/repo/'.$repo['slug'],
$item['path']);
-
- // Update derivative paths
+ // Update digital object and derivatives
foreach ($this->data['QubitDigitalObject'] as $key2 => &$item2)
{
- if (isset($item2['parent_id']) && $key == $item2['parent_id'])
+ if ($key == $key2 || (isset($item2['parent_id']) && $key ==
$item2['parent_id']))
{
- $item2['path'] = str_replace('uploads',
'uploads/repo/'.$repo['slug'], $item2['path']);
+ // Move assets
+ $newpath = str_replace('uploads', 'uploads/r/'.$repo['slug'],
$item2['path'].$item2['name']);
+ rename(sfConfig::get('sf_web_dir').$item2['path'].$item2['name'],
sfConfig::get('sf_web_dir').$newpath);
+
+ // Update path
+ $item2['path'] = $newpath;
}
}
}
--
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.