本文整理汇总了PHP中JInstaller::uninstall方法的典型用法代码示例。如果您正苦于以下问题:PHP JInstaller::uninstall方法的具体用法?PHP JInstaller::uninstall怎么用?PHP JInstaller::uninstall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JInstaller
的用法示例。
在下文中一共展示了JInstaller::uninstall方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall
/**
* method to uninstall the component
*
* @return void
*/
function uninstall($parent)
{
$installer = new JInstaller();
$db = JFactory::getDbo();
$tableExtensions = "#__extensions";
//$db->quote("#__extensions");
$columnElement = "element";
//$db->quote("element");
$columnType = "type";
//$db->quote("type");
$columnFolder = "folder";
//$db->quote("folder");
// Find AdmirorGallery plugin ID
$db->setQuery("SELECT extension_id\n\t\t\t\tFROM \n\t\t\t\t\t{$tableExtensions}\n\t\t\t\tWHERE\n\t\t\t\t\t{$columnElement}='admirorgallery'\n\t\t\t\tAND\n\t\t\t\t\t{$columnType}='plugin'\n\t\t\t\tAND\n\t\t\t\t\t{$columnFolder}='content'");
$admirorgallery_id = $db->loadResult();
$this->gallery_uninstall_result = $installer->uninstall('plugin', $admirorgallery_id);
// Find AdmirorButton ID
$db->setQuery("SELECT extension_id\n\t\t\t\tFROM \n\t\t\t\t\t{$tableExtensions}\n\t\t\t\tWHERE\n\t\t\t\t\t{$columnElement}='admirorbutton'\n\t\t\t\tAND\n\t\t\t\t\t{$columnType}='plugin'\n\t\t\t\tAND\n\t\t\t\t\t{$columnFolder}='editors-xtd'");
$admirorbutton_id = $db->loadResult();
$this->button_uninstall_result = $installer->uninstall('plugin', $admirorbutton_id);
$gallery_status = $this->gallery_uninstall_result ? JText::_('Removed') : JText::_('Error');
$button_status = $this->button_uninstall_result ? JText::_('Removed') : JText::_('Error');
$html = '<h2>Admiror Gallery ' . JText::_('Uninstall') . '</h2>
<table class="adminlist">
<thead>
<tr>
<th class="title" colspan="2">' . JText::_('Extension') . '</th>
<th width="30%">' . JText::_('Status') . '</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3"></td>
</tr>
</tfoot>
<tbody>
<tr class="row0">
<td class="key" colspan="2">Admiror Gallery ' . JText::_('Component') . '</td>
<td><strong>' . JText::_('Removed') . '</strong></td>
</tr>
<tr class="row1">
<th>' . JText::_('Plugin') . '</th>
<th>' . JText::_('Group') . '</th>
<th></th>
</tr>
<tr class="row0">
<td class="key">' . ucfirst('Admiror Gallery Plugin') . '</td>
<td class="key">' . ucfirst('content') . '</td>
<td><strong>' . $gallery_status . '</strong></td>
</tr>
<tr class="row0">
<td class="key">' . ucfirst('Admiror Button') . '</td>
<td class="key">' . ucfirst('editors-xtd') . '</td>
<td><strong>' . $button_status . '</strong></td>
</tr>
</tbody>
</table>';
echo $html;
}
示例2: install
public function install($adapter)
{
/** @var $plugin JTableExtension */
$plugin = JTable::getInstance('extension');
if (!$plugin->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'communitybuilder'))) {
return false;
}
/** @var $legacy JTableExtension */
$legacy = JTable::getInstance('extension');
if ($legacy->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'cbcoreredirect'))) {
$pluginParams = new JRegistry();
$pluginParams->loadString($plugin->get('params'));
$legacyParams = new JRegistry();
$legacyParams->loadString($legacy->get('params'));
$pluginParams->set('rewrite_urls', $legacyParams->get('rewrite_urls', 1));
$pluginParams->set('itemids', $legacyParams->get('itemids', 1));
$plugin->set('params', $pluginParams->toString());
$installer = new JInstaller();
try {
$installer->uninstall('plugin', $legacy->get('extension_id'));
} catch (RuntimeException $e) {
}
}
$plugin->set('enabled', 1);
return $plugin->store();
}
示例3: updateDatabase
/**
* Method to update Database
*
* @return void
*/
protected function updateDatabase()
{
$db = JFactory::getDbo();
if (substr($db->name, 0, 5) == 'mysql') {
$db->setQuery('SHOW ENGINES');
try {
$results = $db->loadObjectList();
} catch (Exception $e) {
echo JText::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()) . '<br />';
return;
}
foreach ($results as $result) {
if ($result->Support == 'DEFAULT') {
$db->setQuery('ALTER TABLE #__update_sites_extensions ENGINE = ' . $result->Engine);
try {
$db->execute();
} catch (Exception $e) {
echo JText::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()) . '<br />';
return;
}
break;
}
}
}
// Check if the 2.5 EOS plugin is present and uninstall it if so
$id = $db->setQuery($db->getQuery(true)->select('extension_id')->from('#__extensions')->where('name = ' . $db->quote('PLG_EOSNOTIFY')))->loadResult();
if ($id) {
// We need to unprotect the plugin so we can uninstall it
$db->setQuery($db->getQuery(true)->update('#__extensions')->set('protected = 0')->where($db->quoteName('extension_id') . ' = ' . $id))->execute();
$installer = new JInstaller();
$installer->uninstall('plugin', $id);
}
}
示例4: uninstall
/**
* method to uninstall the component
*
* @return void
*/
function uninstall($parent)
{
return;
//XXX not working, need to install all plugins/modules separately
// $parent is the class calling this method
echo '<p>' . JText::_('COM_HELLOWORLD_UNINSTALL_TEXT') . '</p>';
$manifest = $parent->get("manifest");
$parent = $parent->getParent();
$source = $parent->getPath("source");
$installer = new JInstaller();
$db = JFactory::getDBO();
// Install plugins
foreach ($manifest->plugins->plugin as $plugin) {
$attributes = $plugin->attributes();
$plg = $source . '/' . $attributes['folder'] . '/' . $attributes['plugin'];
$plg = $source . '/' . $attributes['folder'];
$name = $attributes['plugin'];
/* print_r ($attributes);
echo "X";
$type = 'user';
$data = JPluginHelper::getPlugin ($type, 'joomdlehooks');
print_r ($data);
*/
$query = 'SELECT extension_id ' . ' FROM #__extensions' . " WHERE name = '{$name}'";
$db->setQuery($query);
$extension_id = $db->loadResult();
$installer->uninstall('plugin', $extension_id);
}
}
示例5: postflight
/**
* method to run after an install/update/uninstall method
*
* @return void
*/
function postflight($type, $parent)
{
$manifest = $parent->getParent()->getManifest();
if ($type != 'uninstall' && !$this->_installAllowed($manifest)) {
return false;
}
// Remove AjaxHelpAry
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('extension_id', 'name', 'params', 'element'));
$query->from('#__extensions');
$query->where($db->quoteName('element') . ' = ' . $db->quote('ajaxhelpary'));
$query->where($db->quoteName('folder') . ' = ' . $db->quote('ajax'));
$db->setQuery($query);
$row = $db->loadAssoc();
if (!empty($row)) {
$installer = new JInstaller();
$res = $installer->uninstall('plugin', $row['extension_id']);
if ($res) {
$msg = '<b style="color:green">' . JText::sprintf('COM_INSTALLER_UNINSTALL_SUCCESS', $row['name']) . '</b>';
} else {
$msg = '<b style="color:red">' . JText::sprintf('COM_INSTALLER_UNINSTALL_ERROR', $row['name']) . '</b>';
}
$this->messages[] = $msg;
}
parent::postflight($type, $parent, $publishPlugin = true);
}
示例6: uninstall
/**
* method to uninstall the component
*
* @return void
*/
function uninstall($parent)
{
// $parent is the class calling this method
//echo '<p>' . JText::_('COM_HELLOWORLD_UNINSTALL_TEXT') . '</p>';
$db =& JFactory::getDBO();
// uninstalling jumi module
$db->setQuery("select extension_id from #__extensions where name = 'Jumi' and type = 'module' and element = 'mod_jumi'");
$jumi_module = $db->loadObject();
$module_uninstaller = new JInstaller();
if (@$module_uninstaller->uninstall('module', $jumi_module->extension_id)) {
echo 'Module uninstall success', '<br />';
} else {
echo 'Module uninstall failed', '<br />';
}
// uninstalling jumi plugin
$db->setQuery("select extension_id from #__extensions where name = 'System - Jumi' and type = 'plugin' and element = 'jumi'");
$jumi_plugin = $db->loadObject();
$plugin_uninstaller = new JInstaller();
if ($plugin_uninstaller->uninstall('plugin', $jumi_plugin->extension_id)) {
echo 'Plugin uninstall success', '<br />';
} else {
echo 'Plugin uninstall failed', '<br />';
}
// uninstalling jumi router
$db->setQuery("select extension_id from #__extensions where name = 'System - Jumi Router' and type = 'plugin' and element = 'jumirouter'");
$jumi_router = $db->loadObject();
$plugin_uninstaller = new JInstaller();
if ($plugin_uninstaller->uninstall('plugin', $jumi_router->extension_id)) {
echo 'Router uninstall success', '<br />';
} else {
echo 'Router uninstall failed', '<br />';
}
}
示例7: uninstall
function uninstall($parent)
{
$db = JFactory::getDBO();
$manifest = $parent->getParent()->manifest;
$plugins = $manifest->xpath('plugins/plugin');
foreach ($plugins as $plugin) {
$name = (string) $plugin->attributes()->plugin;
$group = (string) $plugin->attributes()->group;
$query = $db->getQuery(true);
$query->select($db->quoteName('extension_id'));
$query->from($db->quoteName('#__extensions'));
$query->where($db->quoteName('type') . ' = ' . $db->Quote('plugin'));
$query->where($db->quoteName('element') . ' = ' . $db->Quote($name));
$query->where($db->quoteName('folder') . ' = ' . $db->Quote($group));
$db->setQuery($query);
$extensions = $db->loadColumn();
if (count($extensions)) {
foreach ($extensions as $id) {
$installer = new JInstaller();
$installer->uninstall('plugin', $id);
}
}
}
self::displayDonation();
}
示例8: uninstallLanguage
public function uninstallLanguage($tag, $name) {
$table = JTable::getInstance('extension');
$id = $table->find(array('type'=>'file', 'element'=>"com_kunena_{$tag}"));
if (!$id) return;
$installer = new JInstaller();
$installer->uninstall ( 'file', $id );
}
示例9: uninstall
function uninstall($path)
{
$installer = new JInstaller();
$manifest = $this->getmanifestObject($path);
$manifestdata =& $this->extractManifestData($manifest);
$cidlist =& $this->getCIDList($manifestdata);
foreach ($cidlist as $id) {
$installer->uninstall($manifestdata['type'], $id['id'], $id['client_id']);
}
}
示例10: uninstallModule
private function uninstallModule($name)
{
$this->db->setQuery("select extension_id from #__extensions where type = 'module' and element = " . $this->db->Quote($name));
$obj = $this->db->loadObject();
if (!$obj) {
return 0;
}
$installer = new JInstaller();
return $installer->uninstall('module', $obj->extension_id);
}
示例11: run
public function run($app)
{
// uninstall shortcut plugin
jimport('joomla.installer.installer');
// set query
$query = 'SELECT extension_id as id FROM #__extensions WHERE element = ' . $app->database->Quote('zooshortcut');
// query extension id and client id
if ($res = $app->database->queryObject($query)) {
$installer = new JInstaller();
$installer->uninstall('plugin', $res->id, 0);
}
}
示例12: uninstallPlugin
function uninstallPlugin($folder, $name)
{
// Joomla 2.5+
$query = "SELECT extension_id FROM #__extensions WHERE type='plugin' AND folder='{$folder}' AND element='{$name}'";
$db = JFactory::getDbo();
$db->setQuery($query);
$pluginid = $db->loadResult();
if ($pluginid) {
$installer = new JInstaller();
$installer->uninstall('plugin', $pluginid);
}
}
示例13: kunena_upgrade_160_old_mt12
function kunena_upgrade_160_old_mt12($parent) {
if (version_compare(JVERSION, '1.6','<') && is_dir ( JPATH_ROOT . '/plugins/system/mootools12' )) {
// Joomla 1.5: Only needed for K1.6.0 ALPHA releases
$query = "SELECT id FROM #__plugins WHERE element='mootools12'";
$parent->db->setQuery ( $query );
$id = $parent->db->loadResult ();
if ($id) {
jimport ( 'joomla.installer.installer' );
$installer = new JInstaller ();
$installer->uninstall ( 'plugin', $id );
return array ('action' => '', 'name' => JText::_ ( 'COM_KUNENA_INSTALL_160_OLD_MT12' ), 'success' => true );
}
}
}
示例14: uninstall
/**
* method to uninstall the component
*
* @return void
*/
function uninstall($parent)
{
// $parent is the class calling this method
//echo '<p>' . JText::_('COM_HELLOWORLD_UNINSTALL_TEXT') . '</p>';
$db = JFactory::getDBO();
$sql = 'SELECT `extension_id` AS id, `name`, `element`, `folder` FROM #__extensions WHERE `type` = "module" AND ( (`element` = "mod_sexycontactform") ) ';
$db->setQuery($sql);
$sexy_polling_module = $db->loadObject();
$module_uninstaller = new JInstaller();
if ($module_uninstaller->uninstall('module', $sexy_polling_module->id)) {
echo '<p>' . JText::_('COM_SEXYCONTACTFORM_MODULE_UNINSTALL_SUCCESS') . '</p>';
} else {
echo '<p>' . JText::_('COM_SEXYCONTACTFORM_MODULE_UNINSTALL_FAILED') . '</p>';
}
}
示例15: uninstall
public function uninstall($parent)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('extension_id')));
$query->from($db->quoteName('#__extensions'));
$query->where($db->quoteName('type') . ' = ' . $db->quote('module'));
$query->where($db->quoteName('element') . ' = ' . $db->quote('mod_sp_poll'));
$db->setQuery($query);
$id = $db->loadResult();
if (isset($id) && $id) {
$installer = new JInstaller();
$result = $installer->uninstall('module', $id);
}
}