Example #1
0
    public function delete()
    {
        $result = parent::delete();

        // Also delete related file if not attached to any other document.
        if ($result && ($this->storage_type == 'file'))
        {
            $state = array(
                'storage_type' => 'file',
                'storage_path' => $this->storage_path
            );

            if (!$this->getObject('com://admin/docman.model.documents')->setState($state)->count())
            {
                $file = $this->storage;

                if (!$file->isNew())
                {
                    $file->delete();

                    // Clear com_files cache
                    JCache::getInstance('output', array('defaultgroup' => 'com_docman.files'))->clean();
                }
            }
        }

        return $result;
    }
Example #2
0
 /**
  * Overridden for deleting the attached file.
  */
 public function delete()
 {
     $result = parent::delete();
     if ($result) {
         $file = $this->file;
         if (!$file->isNew()) {
             $file->delete();
         }
     }
     return $result;
 }
Example #3
0
 public function delete()
 {
     $this->_setCoreExtension(false);
     $client_id = $this->type == 'component' ? 1 : 0;
     $result = $this->getInstaller()->uninstall($this->type, $this->joomla_extension_id, $client_id);
     if ($result) {
         $result = parent::delete();
     }
     if ($result) {
         // Uninstall dependencies (if they are dependent to this extension only)
         foreach ($this->getDependents() as $dependency) {
             $count = $this->getObject('com://admin/extman.model.dependencies')->dependent_id($dependency->dependent_id)->count();
             if ($count === 1) {
                 $extension = $this->getObject('com://admin/extman.model.extensions')->id($dependency->dependent_id)->fetch();
                 $extension->delete();
             }
             $dependency->delete();
         }
     }
     return $result;
 }