/**
  * 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;
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 /**
  * 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);
     }
 }
Ejemplo n.º 4
0
 /**
  * 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);
     }
 }
Ejemplo n.º 5
0
 /**
  * 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);
 }
Ejemplo n.º 6
0
 /**
  * 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 />';
     }
 }
Ejemplo n.º 7
0
 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();
 }
Ejemplo n.º 8
0
	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 );
	}
Ejemplo n.º 9
0
 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']);
     }
 }
Ejemplo n.º 10
0
 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);
 }
Ejemplo n.º 11
0
 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);
     }
 }
Ejemplo n.º 12
0
 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);
     }
 }
Ejemplo n.º 13
0
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 );
		}
	}
}
Ejemplo n.º 14
0
 /**
  * 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>';
     }
 }
Ejemplo n.º 15
0
 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);
     }
 }
Ejemplo n.º 16
0
 /**
  * Method to uninstall the component.
  *
  * @param JInstallerAdapterComponent $parent
  *
  * @return  void
  */
 public function uninstall(\JInstallerAdapterComponent $parent)
 {
     $db = JFactory::getDbo();
     $q = $db->getQuery(true);
     $q->select('extension_id')->from('#__extensions')->where("element='mod_akquickicons'");
     $db->setQuery($q);
     $result = $db->loadResult();
     if ($result) {
         $installer = new JInstaller();
         $installer->uninstall('module', $result);
         $q = $db->getQuery(true);
         $q->delete('#__categories')->where("extension='com_akquickicons'");
         $db->setQuery($q);
         $db->execute();
     }
 }
Ejemplo n.º 17
0
 public function uninstall(JAdapterInstance $adapter)
 {
     $db = JFactory::getDBO();
     $app = JFactory::getApplication();
     jimport('joomla.installer.installer');
     $db->setQuery('SELECT `extension_id` FROM #__extensions WHERE `element` = "mod_fbconnct" AND `type` = "module"');
     $id = $db->loadResult();
     if ($id) {
         $installer = new JInstaller();
         $result = @$installer->uninstall('module', $id, 1);
         if ($result) {
             $app->enqueueMessage('Uninstalling module [mod_fbconnct] was successful.', 'message');
         } else {
             $app->enqueueMessage('Uninstalling module [mod_fbconnct] was unsuccessful. Module may not exist or need manual uninstallation.', 'error');
         }
     }
 }
Ejemplo n.º 18
0
 public function uninstall($parent)
 {
     $db = JFactory::getDBO();
     $manifest = $parent->getParent()->manifest;
     $plugins = $manifest->xpath('plugins/plugin');
     foreach ($plugins as $plugin) {
         $name = (string) $plugin->attributes()->plugin;
         $query = "SELECT `extension_id` FROM #__extensions WHERE `type`='plugin' AND element = " . $db->Quote($name);
         $db->setQuery($query);
         $extensions = $db->loadColumn();
         if (count($extensions)) {
             foreach ($extensions as $id) {
                 $installer = new JInstaller();
                 $result = $installer->uninstall('plugin', $id);
             }
         }
     }
 }
function com_uninstall()
{
    $db =& JFactory::getDBO();
    $query = "SELECT id FROM #__plugins " . "WHERE element='sef_advance'";
    $db->setQuery($query);
    if ($id = $db->loadResult()) {
        // uninstall the plugin
        jimport('joomla.installer.installer');
        $installer = new JInstaller();
        $result = $installer->uninstall('plugin', $id, 0);
        if ($result) {
            echo 'SEF Advance system plugin also removed<br />';
        } else {
            echo 'SEF Advance system plugin could not be removed<br />Please remove this plugin manually';
        }
    }
    return true;
}
Ejemplo n.º 20
0
function com_uninstall()
{
    jimport('joomla.version');
    $version = new JVersion();
    if (version_compare($version->getShortVersion(), '1.6', '<')) {
        $db = JFactory::getDBO();
        $db->setQuery("Delete From #__components Where `admin_menu_link` Like 'option=com_contentbuilder%'");
        $db->query();
        $plugins = cbgetPlugins();
        $installer = new JInstaller();
        foreach ($plugins as $folder => $subplugs) {
            foreach ($subplugs as $plugin) {
                $db->setQuery('SELECT `id` FROM #__plugins WHERE `element` = "' . $plugin . '" AND `folder` = "' . $folder . '"');
                $id = $db->loadResult();
                if ($id) {
                    $installer->uninstall('plugin', $id, 1);
                }
            }
        }
    }
}
Ejemplo n.º 21
0
 public function uninstall($parent)
 {
     $db = JFactory::getDBO();
     $status = new stdClass();
     $status->modules = array();
     $status->plugins = array();
     $manifest = $parent->getParent()->manifest;
     $plugins = $manifest->xpath('plugins/plugin');
     foreach ($plugins as $plugin) {
         $name = (string) $plugin->attributes()->plugin;
         $db = JFactory::getDBO();
         $query = "SELECT `extension_id` FROM `#__extensions` WHERE `type`='plugin' AND element = " . $db->Quote($name) . "";
         $db->setQuery($query);
         $extensions = $db->loadColumn();
         if (count($extensions)) {
             foreach ($extensions as $id) {
                 $installer = new JInstaller();
                 $result = $installer->uninstall('plugin', $id);
             }
             $status->plugins[] = array('name' => $name, 'result' => $result);
         }
     }
     $modules = $manifest->xpath('modules/module');
     foreach ($modules as $module) {
         $name = (string) $module->attributes()->module;
         $client = (string) $module->attributes()->client;
         $db = JFactory::getDBO();
         $query = "SELECT `extension_id` FROM `#__extensions` WHERE `type`='module' AND element = " . $db->Quote($name) . "";
         $db->setQuery($query);
         $extensions = $db->loadColumn();
         if (count($extensions)) {
             foreach ($extensions as $id) {
                 $installer = new JInstaller();
                 $result = $installer->uninstall('module', $id);
             }
             $status->modules[] = array('name' => $name, 'client' => $client, 'result' => $result);
         }
     }
 }
 public function uninstall($parent)
 {
     $db = JFactory::getDBO();
     $status = new stdClass();
     $status->plugins = array();
     $manifest = $parent->getParent()->manifest;
     $plugins = $manifest->xpath('plugins/plugin');
     foreach ($plugins as $plugin) {
         $name = (string) $plugin->attributes()->plugin;
         $group = (string) $plugin->attributes()->group;
         $query = "SELECT `extension_id` FROM #__extensions WHERE `type`='plugin' AND element = " . $db->Quote($name) . " AND folder = " . $db->Quote($group);
         $db->setQuery($query);
         $extensions = $db->loadColumn();
         if (count($extensions)) {
             foreach ($extensions as $id) {
                 $installer = new JInstaller();
                 $result = $installer->uninstall('plugin', $id);
             }
             $status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result);
         }
     }
     $this->uninstallationResults($status);
 }
Ejemplo n.º 23
0
 /**
  * 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_creativeimageslider") ) ';
     $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_CREATIVEIMAGESLIDER_MODULE_UNINSTALL_SUCCESS') . '</p>';
     } else {
         echo '<p>' . JText::_('COM_CREATIVEIMAGESLIDER_MODULE_UNINSTALL_FAILED') . '</p>';
     }
     // uninstalling creative image slider plugin
     $db->setQuery("select extension_id from #__extensions where name = 'System - Creative Image Slider' and type = 'plugin' and element = 'creativeimageslider'");
     $cis_plugin = $db->loadObject();
     $plugin_uninstaller = new JInstaller();
     if ($plugin_uninstaller->uninstall('plugin', $cis_plugin->extension_id)) {
         echo '<p>' . JText::_('COM_CREATIVEIMAGESLIDER_PLUGIN_UNINSTALL_SUCCESS') . '</p>';
     } else {
         echo '<p>' . JText::_('COM_CREATIVEIMAGESLIDER_PLUGIN_UNINSTALL_FAILED') . '</p>';
     }
 }
Ejemplo n.º 24
0
 /**
  * Custom update method
  * @access public
  * @return boolean True on success
  * @since  1.5
  */
 public function update()
 {
     // since this is just files, an update removes old files
     // Get the extension manifest object
     $this->manifest = $this->parent->getManifest();
     /**
      * ---------------------------------------------------------------------------------------------
      * Manifest Document Setup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Set the extensions name
     $name = (string) $this->manifest->name;
     $name = JFilterInput::getInstance()->clean($name, 'string');
     $element = str_replace('.xml', '', basename($this->parent->getPath('manifest')));
     $this->set('name', $name);
     $this->set('element', $element);
     $installer = new JInstaller();
     // we don't want to compromise this instance!
     $db = $this->parent->getDbo();
     $db->setQuery('SELECT extension_id FROM #__extensions WHERE type="library" AND element = "' . $element . '"');
     $result = $db->loadResult();
     if ($result) {
         // already installed, which would make sense
         $installer->uninstall('library', $result);
     }
     // now create the new files
     return $this->install();
 }
Ejemplo n.º 25
0
 function uninstallPlugin($folder, $name)
 {
     if (version_compare(JVERSION, '1.6', '>')) {
         // Joomla 1.6+
         $query = "SELECT extension_id FROM #__extensions WHERE type='plugin' AND folder='{$folder}' AND element='{$name}'";
     } else {
         // Joomla 1.5
         $query = "SELECT id FROM #__plugins WHERE folder='{$folder}' AND element='{$name}'";
     }
     $this->db->setQuery($query);
     $pluginid = $this->db->loadResult();
     if ($pluginid) {
         $installer = new JInstaller();
         $installer->uninstall('plugin', $pluginid);
     }
 }
Ejemplo n.º 26
0
 }
 if (is_a($plugins, 'JSimpleXMLElement') && count($plugins->children())) {
     foreach ($plugins->children() as $plugin) {
         $pname = $plugin->attributes('plugin');
         $pgroup = $plugin->attributes('group');
         if ($pgroup == 'finder' || $pgroup == 'josetta_ext') {
             continue;
         }
         $db = JFactory::getDBO();
         $query = 'SELECT `id` FROM #__plugins WHERE element = ' . $db->Quote($pname) . ' AND folder = ' . $db->Quote($pgroup);
         $db->setQuery($query);
         $plugins = $db->loadResultArray();
         if (count($plugins)) {
             foreach ($plugins as $plugin) {
                 $installer = new JInstaller();
                 $result = $installer->uninstall('plugin', $plugin, 0);
             }
         }
         $status->plugins[] = array('name' => $pname, 'group' => $pgroup, 'result' => $result);
     }
 }
 if (JFolder::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomfish' . DS . 'contentelements')) {
     $elements = $this->manifest->getElementByPath('joomfish/files');
     if (is_array($elements)) {
         foreach ($elements as $element) {
             if (JFile::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomfish' . DS . 'contentelements' . DS . $element->data())) {
                 JFile::delete(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomfish' . DS . 'contentelements' . DS . $element->data());
             }
         }
     }
 }
Ejemplo n.º 27
0
 /**
  * Custom update method
  * @access public
  * @return boolean True on success
  * @since  1.5
  */
 function update()
 {
     // since this is just files, an update removes old files
     // Get the extension manifest object
     $manifest =& $this->parent->getManifest();
     $this->manifest = $this->parent->getManifest();
     $this->route = 'update';
     /**
      * ---------------------------------------------------------------------------------------------
      * Manifest Document Setup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Set the extensions name
     $name = JFilterInput::getInstance()->clean((string) $this->manifest->name, 'string');
     $installer = new JInstaller();
     // we don't want to compromise this instance!
     $installer->uninstall('file', $name, 0);
     // ...and adds new files
     return $this->install();
 }
Ejemplo n.º 28
0
 /**
  * Custom uninstall method
  *
  * @param   integer  $id  The id of the package to uninstall.
  *
  * @return  boolean  True on success
  *
  * @since   3.1
  */
 public function uninstall($id)
 {
     $row = null;
     $retval = true;
     $row = JTable::getInstance('extension');
     $row->load($id);
     if ($row->protected) {
         JLog::add(JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_WARNCOREPACK'), JLog::WARNING, 'jerror');
         return false;
     }
     $manifestFile = JPATH_MANIFESTS . '/packages/' . $row->get('element') . '.xml';
     $manifest = new JInstallerManifestPackage($manifestFile);
     // Set the package root path
     $this->parent->setPath('extension_root', JPATH_MANIFESTS . '/packages/' . $manifest->packagename);
     // Because packages may not have their own folders we cannot use the standard method of finding an installation manifest
     if (!file_exists($manifestFile)) {
         // TODO: Fail?
         JLog::add(JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_MISSINGMANIFEST'), JLog::WARNING, 'jerror');
         return false;
     }
     $xml = simplexml_load_file($manifestFile);
     // If we cannot load the XML file return false
     if (!$xml) {
         JLog::add(JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_LOAD_MANIFEST'), JLog::WARNING, 'jerror');
         return false;
     }
     // Check for a valid XML root tag.
     if ($xml->getName() != 'extension') {
         JLog::add(JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_INVALID_MANIFEST'), JLog::WARNING, 'jerror');
         return false;
     }
     // If there is an manifest class file, let's load it
     $this->scriptElement = $manifest->scriptfile;
     $manifestScript = (string) $manifest->scriptfile;
     if ($manifestScript) {
         $manifestScriptFile = $this->parent->getPath('extension_root') . '/' . $manifestScript;
         if (is_file($manifestScriptFile)) {
             // Load the file
             include_once $manifestScriptFile;
         }
         // Set the class name
         $classname = $row->element . 'InstallerScript';
         if (class_exists($classname)) {
             // Create a new instance
             $this->parent->manifestClass = new $classname($this);
             // And set this so we can copy it later
             $this->set('manifest_script', $manifestScript);
         }
     }
     ob_start();
     ob_implicit_flush(false);
     // Run uninstall if possible
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'uninstall')) {
         $this->parent->manifestClass->uninstall($this);
     }
     $msg = ob_get_contents();
     ob_end_clean();
     if ($msg != '') {
         $this->parent->set('extension_message', $msg);
     }
     $error = false;
     foreach ($manifest->filelist as $extension) {
         $tmpInstaller = new JInstaller();
         $id = $this->_getExtensionID($extension->type, $extension->id, $extension->client, $extension->group);
         $client = JApplicationHelper::getClientInfo($extension->client, true);
         if ($id) {
             if (!$tmpInstaller->uninstall($extension->type, $id, $client->id)) {
                 $error = true;
                 JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_NOT_PROPER', basename($extension->filename)), JLog::WARNING, 'jerror');
             }
         } else {
             JLog::add(JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_UNKNOWN_EXTENSION'), JLog::WARNING, 'jerror');
         }
     }
     // Remove any language files
     $this->parent->removeFiles($xml->languages);
     // Clean up manifest file after we're done if there were no errors
     if (!$error) {
         JFile::delete($manifestFile);
         $folder = $this->parent->getPath('extension_root');
         if (JFolder::exists($folder)) {
             JFolder::delete($folder);
         }
         $row->delete();
     } else {
         JLog::add(JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_MANIFEST_NOT_REMOVED'), JLog::WARNING, 'jerror');
     }
     // Return the result up the line
     return $retval;
 }
Ejemplo n.º 29
0
 /**
  * Uninstall the 2.5 EOS plugin
  *
  * @return  void
  */
 protected function uninstallEosPlugin()
 {
     $db = JFactory::getDbo();
     // 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) {
         return;
     }
     // 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);
 }
Ejemplo n.º 30
0
    }
    $id = $db->loadResult();
    if ($id) {
        $installer = new JInstaller();
        $result = $installer->uninstall('plugin', $id, 1);
    }
    # ----- System - Akeeba Update Check
    if (version_compare(JVERSION, '1.6.0', 'ge')) {
        $db->setQuery('SELECT `extension_id` FROM #__extensions WHERE `type` = "plugin" AND `element` = "akeebaupdatecheck" AND `folder` = "system"');
    } else {
        $db->setQuery('SELECT `id` FROM #__plugins WHERE `element` = "akeebaupdatecheck" AND `folder` = "system"');
    }
    $id = $db->loadResult();
    if ($id) {
        $installer = new JInstaller();
        $result = $installer->uninstall('plugin', $id, 1);
    }
}
// -- Icon module
$installer = new JInstaller();
$result = $installer->install($src . '/mod_akadmin');
$status->modules[] = array('name' => 'mod_akadmin', 'client' => 'administrator', 'result' => $result);
$query = "UPDATE #__modules SET position='icon', ordering=97, published=1 WHERE `module`='mod_akadmin'";
$db->setQuery($query);
$db->query();
$query = "SELECT `id` FROM `#__modules` WHERE `module` = 'mod_akadmin'";
$db->setQuery($query);
$modID = $db->loadResult();
$query = "REPLACE INTO `#__modules_menu` (`moduleid`,`menuid`) VALUES ({$modID}, 0)";
$db->setQuery($query);
$db->query();