Author: sevein
Date: Thu Dec  8 03:21:16 2011
New Revision: 10377

Log:
Cosmetic change, and do checksums comparition always

Modified:
   trunk/lib/QubitAsset.class.php
   trunk/lib/model/QubitDigitalObject.php

Modified: trunk/lib/QubitAsset.class.php
==============================================================================
--- trunk/lib/QubitAsset.class.php      Thu Dec  8 03:06:26 2011        (r10376)
+++ trunk/lib/QubitAsset.class.php      Thu Dec  8 03:21:16 2011        (r10377)
@@ -45,15 +45,15 @@
 
       $this->name = $path_parts['basename'];
       $this->path = $args[0];
-      $this->generateChecksum('sha256');
     }
     // File name and contents passed
     else if (2 == func_num_args())
     {
       $this->name = $args[0];
       $this->contents = $args[1];
-      $this->generateChecksum('sha256');
     }
+
+    $this->generateChecksum('sha256');
   }
 
   public function setName($value)

Modified: trunk/lib/model/QubitDigitalObject.php
==============================================================================
--- trunk/lib/model/QubitDigitalObject.php      Thu Dec  8 03:06:26 2011        
(r10376)
+++ trunk/lib/model/QubitDigitalObject.php      Thu Dec  8 03:21:16 2011        
(r10377)
@@ -470,17 +470,14 @@
       throw new sfException('File write to '.$filePathName.' failed. See 
setting directory and file permissions documentation.');
     }
 
-    if (null === $assetPath)
+    // Test asset checksum against generated checksum from file
+    $this->generateChecksumFromFile($filePathName);
+    if ($this->getChecksum() != $asset->getChecksum())
     {
-      // Test asset checksum against generated checksum from file
-      $this->generateChecksumFromFile($filePathName);
-      if ($this->getChecksum() != $asset->getChecksum())
-      {
-        unlink($filePathName);
-        rmdir($infoObjectPath);
+      unlink($filePathName);
+      rmdir($infoObjectPath);
 
-        throw new sfException('Checksum values did not validate.');
-      }
+      throw new sfException('Checksum values did not validate.');
     }
 
     // set file permissions

-- 
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.

Reply via email to