Пример #1
0
 /**
  * Save params, then delete plugin, for all plugins
  * in a given group
  *
  * @param $group the group to be deleted
  * @return none
  */
 private function _shSaveDeletePluginGroup($group)
 {
     $unsafe = array('authentication', 'content', 'editors', 'editors-xtd', 'search', 'system', 'xmlrpc');
     if (in_array($group, $unsafe)) {
         // safety net : we don't want to delete the whole system or content folder
         return false;
     }
     // read plugin param from db
     try {
         $pluginList = ShlDbHelper::selectAssocList('#__extensions', array('*'), array('type' => 'plugin', 'folder' => $group));
         if (empty($pluginList)) {
             return true;
         }
         // for each plugin
         foreach ($pluginList as $plugin) {
             // remove plugin db id
             unset($plugin['id']);
             // write everything on disk
             $this->_shWriteExtensionConfig($plugin['folder'] . '.' . $plugin['element'], array('shConfig' => $plugin));
             // now remove plugin details from db
             ShlDbHelper::delete('#__extensions', array('type' => 'plugin', 'element' => $plugin['element'], 'folder' => $plugin['folder']));
         }
     } catch (Exception $e) {
         echo $e->getMessage() . '<br />';
     }
     // now delete the files for the whole group
     if (JFolder::exists(JPATH_ROOT . '/plugins/' . $group)) {
         JFolder::delete(JPATH_ROOT . '/plugins/' . $group);
     }
 }