Author: david
Date: Mon Feb 28 10:56:44 2011
New Revision: 9011
Log:
Provide progress info to user
Modified:
trunk/lib/task/digitalObjectLoadTask.class.php
Modified: trunk/lib/task/digitalObjectLoadTask.class.php
==============================================================================
--- trunk/lib/task/digitalObjectLoadTask.class.php Mon Feb 28 10:29:00
2011 (r9010)
+++ trunk/lib/task/digitalObjectLoadTask.class.php Mon Feb 28 10:56:44
2011 (r9011)
@@ -66,6 +66,8 @@
throw new sfException('You must specify a valid filename');
}
+ $this->logSection("Load digital objects from {$arguments['filename']}...");
+
// Get header (first) row
$header = fgetcsv($fh, 1000);
@@ -77,28 +79,40 @@
$idKey = array_search('information_object_id', $header);
$fileKey = array_search('filename', $header);
+ $count = 0;
while ($item = fgetcsv($fh, 1000))
{
if (null === $informationObject =
QubitInformationObject::getById($item[$idKey]))
{
+ $this->log("Invalid information_object id {$item[$idKey]}");
+
continue;
}
// read file contents
if (false === $content = file_get_contents($item[$fileKey]))
{
+ $this->log("Couldn't read file '{$item[$fileKey]}'");
+
continue;
}
+ $filename = basename($item[$fileKey]);
+ $this->log("Loading '$filename'");
+
// Create digital object
$do = new QubitDigitalObject;
$do->informationObject = $informationObject;
$do->usageId = QubitTerm::MASTER_ID;
- $do->assets[] = new QubitAsset(basename($item[$fileKey]), $content);
+ $do->assets[] = new QubitAsset($filename, $content);
// Save information object with attached digital object
$do->save($conn);
+
+ $count++;
}
+
+ $this->logSection('Successfully Loaded $count digital objects');
}
protected function getUploadDir($conn)
--
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.