Exemplo n.º 1
0
 public function save()
 {
     $this->_setup();
     $result = true;
     if ($this->install_method === 'discover_install' && $this->dependency) {
         $result = $this->_installFromFilesystem();
     } elseif ($this->package) {
         $result = $this->_installFromPackage();
     }
     $path = JPATH_ROOT . '/libraries/koowa/components/com_' . $this->name;
     $this->getObject('object.bootstrapper')->registerComponent($this->name, $path, 'koowa');
     if ($result) {
         parent::save();
         if ($this->parent_id) {
             $this->_addDependency();
         }
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * @return bool
  */
 public function save()
 {
     $result = parent::save();
     if ($result) {
         $this->_createFilesContainer();
         $this->_createIconsContainer();
         $this->_createImagesContainer();
         if (file_exists(dirname(__FILE__) . '/../../resources/install/mimetypes.sql')) {
             $mimetypes = file_get_contents(dirname(__FILE__) . '/../../resources/install/mimetypes.sql');
             if ($mimetypes) {
                 try {
                     $db = JFactory::getDBO();
                     $queries = $db->splitSql($mimetypes);
                     foreach ($queries as $query) {
                         if (trim($query)) {
                             $db->setQuery($query)->execute();
                         }
                     }
                 } catch (Exception $e) {
                 }
             }
         }
         if ($this->event === 'install') {
             // Add a rule to authorize Public group to download
             $asset = JTable::getInstance('Asset');
             $asset->loadByName('com_docman');
             $rules = new JAccessRules($asset->rules);
             $rules->mergeAction('com_docman.download', new JAccessRule(array(1 => true)));
             $asset->rules = (string) $rules;
             if ($asset->check()) {
                 $asset->store();
             }
             // Disable finder plugin by default
             $finder_id = $this->getExtensionId(array('type' => 'plugin', 'element' => 'docman', 'folder' => 'finder'));
             if ($finder_id) {
                 $query = sprintf('UPDATE #__extensions SET enabled = 0 WHERE extension_id = %d', $finder_id);
                 JFactory::getDBO()->setQuery($query)->query();
             }
         }
         if ($this->old_version) {
             JCache::getInstance('output', array('defaultgroup' => 'com_docman.files'))->clean();
             $this->_migrate();
         }
     }
     return $result;
 }