Exemple #1
0
 function delete()
 {
     if ($image_db_id = $this->db_id()) {
         require_once 'AMP/Content/Image/Image.php';
         $image = new AMP_Content_Image(AMP_Registry::getDbcon(), $image_db_id);
         $image->delete();
         AMP_lookup_clear_cached('images');
         AMP_lookup_clear_cached('db_images');
     }
     $image_classes = AMP_lookup('image_classes');
     foreach ($image_classes as $class => $class_desc) {
         $path = AMP_image_path($this->getName(), $class);
         # delete of current copy handled by parent class below
         if ($path == $this->getPath()) {
             continue;
         }
         if (file_exists($path)) {
             unlink($path);
         }
     }
     return parent::delete();
 }
Exemple #2
0
 function clear($key_token = null)
 {
     foreach ($this->_index as $authorized_key => $time_stored) {
         if (isset($key_token) && strpos($authorized_key, $key_token) === FALSE) {
             continue;
         }
         $this->delete($authorized_key);
     }
     $file_set = AMPfile_list($this->_path_cache);
     $this->_load_file();
     foreach ($file_set as $file_name => $file_display) {
         if (!$file_name) {
             continue;
         }
         if (isset($key_token) && strpos($file_name, $key_token) === FALSE) {
             continue;
         }
         $entry_ref = new AMP_System_File($this->_path($file_name));
         if ($entry_ref->getTime() + AMP_SYSTEM_CACHE_TIMEOUT < time()) {
             $entry_ref->delete();
         }
     }
 }