add before update to fill in empty name
[Pman.Core] / DataObjects / Images.php
index 4c4feed..10089ae 100644 (file)
@@ -203,7 +203,16 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
         ));
           
     }
-     
+    
+    /**
+     * does the files exist?
+     */
+    function exists()
+    {
+        return file_exists($this->getStoreName());
+    }
+    
+    
     /**
      * deletes all the image instances of it...
      * 
@@ -212,6 +221,10 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
     function beforeDelete($dependants_array, $roo)
     {
         
+        if (!empty($dependants_array)) {
+            return;
+        }
+        
         $opts = HTML_FlexyFramework::get()->Pman;
         $deldir = $opts['storedir']. '/_deleted_images_';
         if (!file_exists( $deldir )) {
@@ -500,6 +513,9 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
         if (!$this->id) {
             return 'about:blank';
         }
+        if (!$this->exists()) {
+            return 'about:missing';
+        }
         
         $shorten_name = $this->shorten_name();