Author: sevein
Date: Fri Jan 6 11:48:57 2012
New Revision: 10585
Log:
Use dirname() if the passed path includes '/objects', use preg_match_all to
catch last match in case a dirname includes multiple UUIDs in the whole string
Modified:
trunk/lib/task/archivematicaDipImportTask.class.php
Modified: trunk/lib/task/archivematicaDipImportTask.class.php
==============================================================================
--- trunk/lib/task/archivematicaDipImportTask.class.php Fri Jan 6 11:08:16
2012 (r10584)
+++ trunk/lib/task/archivematicaDipImportTask.class.php Fri Jan 6 11:48:57
2012 (r10585)
@@ -84,7 +84,7 @@
$this->logSection("Link digital objects from {$arguments['filename']}...");
// If DIP directory is specified then digital objects will be in the
- // "objects" subfolder. Capture dipUUID from the DIP directory name.
+ // "objects" subfolder. Capture dipUUID.
if (file_exists(rtrim($arguments['path'], '/').'/objects'))
{
$dipUUID = $this->getUUID(basename($arguments['path']));
@@ -92,7 +92,7 @@
}
else
{
- $dipUUID = $this->getUUID(basename($arguments['path']));
+ $dipUUID = $this->getUUID(dirname($arguments['path']));
}
if (null === $dipUUID)
@@ -265,8 +265,8 @@
protected function getUUID($subject)
{
-
preg_match('/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/',
$subject, $matches);
+
preg_match_all('/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/',
$subject, $matches);
- return @$matches[0];
+ return @end(@$matches[0]);
}
}
--
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.