コード例 #1
0
 /**
  * Save parameters, then delete a plugin
  *
  * @param string $pluginName, the plugin name, mathcing 'element' column in plugins table
  * @param string $folder, the plugin folder (ie : 'content', 'search', 'system',...
  */
 private function _shSaveDeletePluginParams($pluginName, $folder, $folders = null)
 {
     try {
         $result = Sh404sefHelperDb::selectAssoc('#__extensions', array('*'), array('type' => 'plugin', 'element' => $pluginName, 'folder' => $folder));
         if (empty($result)) {
             // invalid plugin name?
             return false;
         }
         // remove plugin db id
         unset($result['id']);
         // write everything on disk
         $this->_shWriteExtensionConfig($pluginName, array('shConfig' => $result));
         // now remove plugin details from db
         Sh404sefHelperDb::delete('#__extensions', array('type' => 'plugin', 'element' => $pluginName, 'folder' => $folder));
     } catch (Sh404sefExceptionDefault $e) {
     }
     // delete the plugin files
     $basePath = JPATH_ROOT . DS . 'plugins' . DS . $folder . DS . $pluginName;
     if (JFolder::exists($basePath)) {
         JFolder::delete($basePath);
     }
 }