Author: david
Date: Fri Sep 23 15:01:33 2011
New Revision: 9806
Log:
Keep a running total of disk usage + uploaded files
Modified:
trunk/apps/qubit/modules/digitalobject/actions/uploadAction.class.php
Modified: trunk/apps/qubit/modules/digitalobject/actions/uploadAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/actions/uploadAction.class.php
Fri Sep 23 14:51:25 2011 (r9805)
+++ trunk/apps/qubit/modules/digitalobject/actions/uploadAction.class.php
Fri Sep 23 15:01:33 2011 (r9806)
@@ -23,7 +23,8 @@
{
ProjectConfiguration::getActive()->loadHelpers('Qubit');
- $uploadLimt = 0;
+ $uploadLimt = -1;
+ $diskUsage = 0;
$uploadFiles = array();
$warning = null;
@@ -49,6 +50,8 @@
{
$uploadLimit *= pow(10,9); // Convert to bytes
}
+
+ $diskUsage = $repo->getDiskUsage();
}
// Create tmp dir, if it doesn't exist already
@@ -61,7 +64,7 @@
foreach ($_FILES as $file)
{
- if (null != $repo && 0 <= $uploadLimit && $uploadLimit <
$repo->getDiskUsage() + $file['size'])
+ if (null != $repo && 0 <= $uploadLimit && $uploadLimit < $diskUsage +
$file['size'])
{
$uploadFiles = array('error' => $this->context->i18n->__(
'%1% upload limit of %2% GB exceeded for %3%', array(
@@ -94,7 +97,7 @@
if (!move_uploaded_file($file['tmp_name'], $tmpFilePath))
{
$errorMessage = $this->context->i18n->__('File %1% could not be moved
to %2%', array('%1%' => $file['name'], '%2%' => $tmpDir));
- $uploadFiles[] = array('error' => $errorMessage);
+ $uploadFiles = array('error' => $errorMessage);
continue;
}
@@ -139,6 +142,9 @@
'thumb' => $thumbName,
'tmpName' => $tmpFileName,
'warning' => $warning);
+
+ // Keep running total of disk usage
+ $diskUsage += $file['size'];
}
// Pass file data back to caller for processing on form submit
--
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.