/** * @todo Decide how to Implement. */ public function testGetParent() { require_once(JPATH_BASE.'/libraries/joomla/base/adapterinstance.php'); $this->object = new JAdapter(dirname(__FILE__), 'Test', 'adapters'); $this->assertThat( $this->object->getAdapter('Testadapter3')->getParent(), $this->identicalTo($this->object) ); }
/** * Called after any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param jadapterinstance $adapter The object responsible for running this script * * @return boolean True on success */ public function postflight($route, JAdapterInstance $adapter) { if (strtolower($route) == 'install') { // Get the XML manifest data $manifest = $adapter->get('manifest'); // Set the module params PFInstallerHelper::setModuleParams($manifest); } return true; }
/** * Called before any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param JAdapterInstance $adapter The object responsible for running this script * * @return boolean True on success */ function preflight($route, JAdapterInstance $adapter) { if ($adapter instanceof JInstallerAdapterComponent) { $this->installPlugins($adapter->get('parent')->get('paths')); } elseif ($adapter instanceof JInstallerComponent) { $this->installPlugins($adapter->get('parent')->get('_paths')); } // Installing component manifest file version $this->release = $adapter->get('manifest')->version; // Show the essential information at the install/update back-end echo '<h3>Installing SobiPro version ' . $this->release . ' ...'; }
/** * Called after any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param jadapterinstance $adapter The object responsible for running this script * * @return boolean True on success */ public function postflight($route, JAdapterInstance $adapter) { $action = strtolower($route); if ($action == 'install') { // Get the XML manifest data $manifest = $adapter->get('manifest'); // Get plugin published state $name = $manifest->name; $state = isset($manifest->published) ? (int) $manifest->published : 0; if ($state) { PFInstallerHelper::publishPlugin($name, $state); } } // Move CLI scripts to cli folder if ($action == 'install' || $action == 'update') { $cli_j2_source = JPATH_SITE . '/plugins/content/pfnotifications/pfnotifications_j2.php'; $cli_j2_dest = JPATH_SITE . '/cli/pfnotifications_j2.php'; $cli_j3_source = JPATH_SITE . '/plugins/content/pfnotifications/pfnotifications_j3.php'; $cli_j3_dest = JPATH_SITE . '/cli/pfnotifications_j3.php'; if (file_exists($cli_j2_source)) { if (file_exists($cli_j2_dest)) { if (JFile::delete($cli_j2_dest)) { JFile::copy($cli_j2_source, $cli_j2_dest); } } else { JFile::copy($cli_j2_source, $cli_j2_dest); } } if (file_exists($cli_j3_source)) { if (file_exists($cli_j3_dest)) { if (JFile::delete($cli_j3_dest)) { JFile::copy($cli_j3_source, $cli_j3_dest); } } else { JFile::copy($cli_j3_source, $cli_j3_dest); } } } // Remove CLI scripts if ($action == 'uninstall') { $cli_j2_dest = JPATH_SITE . '/cli/pfnotifications_j2.php'; $cli_j3_dest = JPATH_SITE . '/cli/pfnotifications_j3.php'; if (file_exists($cli_j2_dest)) { JFile::delete($cli_j2_dest); } if (file_exists($cli_j3_dest)) { JFile::delete($cli_j3_dest); } } return true; }
/** * Called after any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param jadapterinstance $adapter The object responsible for running this script * * @return boolean True on success */ public function postflight($route, JAdapterInstance $adapter) { if (strtolower($route) == 'install' || strtolower($route) == 'update') { // Get the XML manifest data $manifest = $adapter->get('manifest'); // Get plugin published state $name = $manifest->name; $state = isset($manifest->published) ? (int) $manifest->published : 0; if ($state) { PFInstallerHelper::publishPlugin($name, $state); } } return true; }
/** * Called on uninstallation * * @param jadapterinstance $adapter The object responsible for running this script */ public function uninstall(JAdapterInstance $adapter) { // Skip this step if the user is removing the entire projectfork package if ($this->isRemovingAll()) { return true; } $element = $adapter->get('element'); $asset = JTable::getInstance('Asset'); // Backup any assets for another component that might take over if ($asset->loadByName($element)) { $asset->name = $asset->name . '_bak'; $asset->store(); } return true; }
public function install(JAdapterInstance $adapter) { $lib = $adapter->getParent()->getPath('source') . '/library/'; $installer = new JInstaller(); $installer->install($lib); $src = $adapter->getParent()->getPath('source'); foreach ($this->cli as $script) { if (JFile::exists(JPATH_ROOT . '/cli/' . $script)) { JFile::delete(JPATH_ROOT . '/cli/' . $script); } if (JFile::exists($src . '/cli/' . $script)) { JFile::move($src . '/cli/' . $script, JPATH_ROOT . '/cli/' . $script); } } }
/** * Called after any type of action. * * @param string $route Which action is happening (install|uninstall|discover_install). * @param JAdapterInstance $adapter The object responsible for running this script. * * @return boolean True on success. * * @since 3.1 */ public function postflight($route, JAdapterInstance $adapter) { // Initialiase variables. $db = JFactory::getDbo(); $query = $db->getQuery(true); // Create the base update statement. $query->update($db->quoteName('#__extensions'))->set($db->quoteName('enabled') . ' = ' . $db->quote('1'))->where($db->quoteName('name') . ' = ' . $db->quote($adapter->get('name'))); // Set the query and execute the update. $db->setQuery($query); try { $db->execute(); } catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage()); return false; } }
/** * Called after any type of action * * @param string $route Which action is happening (install|uninstall|discover_install|update) * @param JAdapterInstance $adapter The object responsible for running this script * * @return boolean True on success */ public function postflight($route, JAdapterInstance $adapter) { $parent = $adapter->getParent(); // install update server for new installation or when updating module older than 3.2.4 require_once $parent->getPath('source') . '/helpers/updateserver.php'; $version = $parent->getManifest()->version; $updateServer = new modPWebContactUpdateServer(); // delete old md5 files $updateServer->deleteMd5($parent->getPath('extension_root') . '/form'); // add new md5 file if ($download_id = $updateServer->getMd5($parent->getPath('source'))) { $buffer = ''; JFile::write($parent->getPath('extension_root') . '/form/' . $download_id, $buffer); } $updateServer->add($version, $download_id); }
/** * Called after any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param jadapterinstance $adapter The object responsible for running this script * * @return boolean True on success */ public function postflight($route, JAdapterInstance $adapter) { $src = JPATH_SITE . "/plugins/system/pftaskexpirynotifier/cron_pf_notifier.php"; $dest = JPATH_SITE . "/cli/cron_pf_notifier.php"; if (strtolower($route) == 'install') { // Get the XML manifest data $manifest = $adapter->get('manifest'); // Get plugin published state $name = $manifest->name; $state = isset($manifest->published) ? (int) $manifest->published : 0; if (!$state) { $state = 1; $this->_publishPlugin($name, $state); } //let's move the cron file into Joomla's cli directory. JFile::move($src, $dest); } return true; }
/** * install all integrated third party plugins and the xmap system plugin * * @param JAdapterInstance $adapter */ public function install(JAdapterInstance $adapter) { $path = $adapter->getParent()->getPath('source'); $folders = JFolder::folders($path . '/plugins/xmap/'); $plugins = array(); foreach ($folders as $component) { $plugins[$component] = $path . '/plugins/xmap/' . $component; } // install each third party plugin if component installed foreach ($plugins as $component => $plugin) { if (JComponentHelper::isInstalled($component)) { $installer = new JInstaller(); $installer->install($plugin); } } // install xmap system plugin // TODO implement plugin features in XmapDisplayerHtml //$installer = new JInstaller; //$installer->install($path . '/plugins/system/xmap/'); }
/** * Called after any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param jadapterinstance $adapter The object responsible for running this script * * @return boolean True on success */ public function postflight($route, JAdapterInstance $adapter) { if (strtolower($route) == 'install') { $element = $adapter->get('element'); // Restore assets from backup PFInstallerHelper::restoreAssets($element); // Make the admin component menu item a child of com_projectfork PFInstallerHelper::setComponentMenuItem($element); // Create a menu item in the projectfork site menu $com = JComponentHelper::getComponent($element); $eid = is_object($com) && isset($com->id) ? $com->id : 0; if ($eid) { $item = array(); $item['title'] = 'Designs'; $item['alias'] = 'designs'; $item['link'] = 'index.php?option=' . $element . '&view=designs'; $item['component_id'] = $eid; PFInstallerHelper::addMenuItem($item); } } if (strtolower($route) == 'update') { $element = $adapter->get('element'); // Make the admin component menu item a child of com_projectfork PFInstallerHelper::setComponentMenuItem($element); // Delete duplicate top-level admin menu entry if it exists $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id')->from('#__menu')->where('level = 1')->where('menutype = ' . $db->quote('main'))->where('link = "index.php?option=' . $element . '&view=designs"'); $db->setQuery($query); $item_id = (int) $db->loadResult(); if ($item_id) { $menu = JTable::getInstance('menu'); $menu->delete($item_id); } } if (in_array(strtolower($route), array('install', 'update'))) { $this->installPlugins($adapter); } return true; }
/** * Called before any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param jadapterinstance $adapter The object responsible for running this script * * @return boolean True on success */ public function preflight($route, JAdapterInstance $adapter) { // Joomla version check if (!version_compare(JVERSION, '2.5.5', 'ge')) { $adapter->get('parent')->abort('Unsupported version! Projectfork requires Joomla 2.5.5 or newer.'); return false; } // Memory Check if (file_exists(dirname(__FILE__) . '/memcheck.php')) { require_once dirname(__FILE__) . '/memcheck.php'; $mem = new pkg_projectforkMemory(); $check = $mem->check(); if ($check !== true) { $msg = 'Not enough memory available: Missing ' . $check . 'k. ' . 'You can delete the "memcheck.php" file from this install package to disable the memory check and try again.'; $adapter->get('parent')->abort($msg); return false; } } if (JDEBUG) { JProfiler::getInstance('Application')->mark('before' . ucfirst($route) . 'Projectfork'); } return true; }
/** * * install the modules from "modules" folder */ public function installModules(JAdapterInstance &$adapter, $type = "install") { $ds = ""; if (defined("DIRECTORY_SEPARATOR")) { $ds = DIRECTORY_SEPARATOR; } else { $ds = DS; } $manifest = $adapter->get("manifest"); $installer = new JInstaller(); $p_installer = $adapter->getParent(); // Install modules if (is_object($manifest->modules->module)) { foreach ($manifest->modules->module as $module) { $attributes = $module->attributes(); $modulePath = $p_installer->getPath("source") . $ds . $attributes['folder'] . $ds . $attributes['module']; if ($type == "install") { $installer->install($modulePath); } else { $installer->update($modulePath); } } } }
public function update(JAdapterInstance $adapter) { $src = $adapter->getParent()->getPath('source'); $site = $adapter->getParent()->getPath('extension_site'); $admin = $adapter->getParent()->getPath('extension_administrator'); $attributes = $adapter->getParent()->get('manifest')->media->attributes(); $attributes = reset($attributes); $extension = \Joomla\Utilities\ArrayHelper::getValue($attributes, 'destination'); $exclude = array(); $exclude[] = $adapter->get('manifest_script'); $exclude[] = JFile::getName($adapter->getParent()->getPath('manifest')); $this->removeRedundantFiles($site, $src . '/site'); $this->removeRedundantFiles($admin, $src . '/admin', $exclude); if ($extension) { $media = JPATH_ROOT . '/media/' . $extension; $this->removeRedundantFiles($media, $src . '/media', $exclude); } }
/** * Called before any type of action * * @param string $type Which action is happening (install|uninstall|discover_install|update) * @param JAdapterInstance $parent The object responsible for running this script * * @return boolean True on success */ public function preflight($type, JAdapterInstance $parent) { $app = JFactory::getApplication(); $session = JFactory::getSession(); $jversion = new JVersion(); $this->parentInstaller = $parent->getParent(); // Get component manifest file version $this->release = $parent->get("manifest")->version; $session->set('release', $this->release->__toString(), 'bwpostman'); // Manifest file minimum Joomla version $this->minimum_joomla_release = $parent->get("manifest")->attributes()->version; // abort if the current Joomla release is older if (version_compare($jversion->getShortVersion(), $this->minimum_joomla_release, 'lt')) { $app->enqueueMessage(JText::sprintf('COM_BWPOSTMAN_INSTALL_ERROR_JVERSION', $this->minimum_joomla_release), 'error'); return false; } if (floatval(phpversion()) < 5) { $app->enqueueMessage(JText::_('COM_BWPOSTMAN_USES_PHP5'), 'error'); return false; } // abort if the component being installed is not newer than the currently installed version if ($type == 'update') { $oldRelease = $this->getManifestVar('version'); $app->setUserState('com_bwpostman.update.oldRelease', $oldRelease); if (version_compare($this->release, $oldRelease, 'lt')) { $app->enqueueMessage(JText::sprintf('COM_BWPOSTMAN_INSTALL_ERROR_INCORRECT_VERSION_SEQUENCE', $oldRelease, $this->release), 'error'); return false; } // delete existing files in frontend and backend to prevent conflicts with previous relicts jimport('joomla.filesystem.folder'); $admin_path = JPATH_ADMINISTRATOR . '/components/com_bwpostman'; $site_path = JPATH_SITE . '/components/com_bwpostman'; if (JFolder::exists($admin_path) === true) { JFolder::delete($admin_path); } if (JFolder::exists($site_path) === true) { JFolder::delete($site_path); } } $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName('params')); $query->from($db->quoteName('#__extensions')); $query->where($db->quoteName('element') . " = " . $db->quote('com_bwpostman')); $db->SetQuery($query); $params_default = $db->loadResult(); $app->setUserState('com_bwpostman.install.params', $params_default); return true; }
/** * Method for checking compatibility installation environment * * @param JAdapterInstance $adapter The object responsible for running this script. * * @return boolean True if the installation environment is compatible * * @since 0.1.0 */ private function _checkCompatible($route, JAdapterInstance $adapter) { // Get the application. $this->_release = (string) $adapter->get('manifest')->version; $min_version = (string) $adapter->get('manifest')->attributes()->version; $jversion = new JVersion(); if (version_compare($jversion->getShortVersion(), $min_version, 'lt')) { JFactory::getApplication()->enquequeMessage(JText::sprintf('PLG_SYSTEM_EXTRAFIELDS_VERSION_UNSUPPORTED', $this->_extension, $this->_release, $min_version), 'error'); return false; } // Storing old release number for process in postflight. if ($route == 'update') { $oldRelease = $this->_getParam('version'); if (version_compare($this->_release, $oldRelease, 'lt')) { JFactory::getApplication()->enquequeMessage(JText::sprintf('PLG_SYSTEM_EXTRAFIELDS_UPDATE_UNSUPPORTED', $this->_extension, $oldRelease, $this->_release), 'error'); return false; } } return true; }
/** * Called after any type of action * * @param string $route Which action is happening (install|uninstall|discover_install|update) * @param JAdapterInstance $adapter The object responsible for running this script * * @return boolean True on success */ public function postflight($route, JAdapterInstance $adapter) { $app = JFactory::getApplication(); $install_jdom = false; $remove_jdom = false; $manifest = $adapter->get('manifest'); $old_params = $this->old_params; $parent = $adapter->get('parent'); $paths = $parent->get('paths'); if (!$paths) { $paths = $parent->get('_paths'); } //Legacy 2.5 $src = $paths['source'] . DS . 'jdom'; $dest = JPATH_SITE . DS . 'libraries' . DS . 'jdom'; $params = array(); $params['update'] = '1'; switch ($route) { case 'install': $params = array(); $params['update'] = '1'; $params['jdomversion'] = $manifest->jdomversion; // clean installation $install_jdom = true; // enable plugin self::enablePlugin(); break; case 'uninstall': // remove the jdom library folder $remove_jdom = true; break; case 'update': switch (intVal($old_params['update'])) { case 0: break; case 2: $vers_compare = version_compare($manifest->jdomversion, $old_params['jdomversion']); if ($vers_compare > 0) { // clean update jdom folder $remove_jdom = true; $install_jdom = true; } elseif ($vers_compare < 0) { $params['jdomversion'] = $old_params['jdomversion']; } break; case 1: default: // clean update jdom folder $remove_jdom = true; $install_jdom = true; $params['jdomversion'] = $manifest->jdomversion; break; } break; default: break; } // remove JDOM if ($remove_jdom and file_exists($dest)) { if (JFolder::delete($dest)) { $app->enqueueMessage(JText::_("PLG_JDOM_SUCCESSFULL_REMOVED")); } else { $app->enqueueMessage(JText::_("PLG_JDOM_ERROR_REMOVED"), 'error'); } } // install JDOM if ($install_jdom) { if (JFolder::copy($src, $dest, '', true)) { $app->enqueueMessage(JText::sprintf('PLG_JDOM_SUCCESSFULL_INSTALLATION', $params['jdomversion'])); self::setParams($params); } else { $app->enqueueMessage(JText::_("PLG_JDOM_ERROR_INSTALLATION"), 'error'); } } }
/** * Constructor * * @param JInstaller $parent Parent object * @param JDatabaseDriver $db Database object * @param array $options Configuration Options * * @since 3.4 */ public function __construct(JInstaller $parent, JDatabaseDriver $db, array $options = array()) { parent::__construct($parent, $db, $options); // Get a generic JTableExtension instance for use if not already loaded if (!$this->extension instanceof JTableInterface) { $this->extension = JTable::getInstance('extension'); } // Sanity check, make sure the type is set by taking the adapter name from the class name if (!$this->type) { $this->type = strtolower(str_replace('JInstallerAdapter', '', get_called_class())); } }
public function installExtensions($route, JAdapterInstance $adapter) { JLog::add("*** Try to install extensions ***", JLog::INFO, 'com_visforms'); $db = JFactory::getDbo(); $src = $adapter->getParent()->getPath('source'); $manifest = $adapter->getParent()->manifest; $types = array(array('libraries', 'library'), array('plugins', 'plugin'), array('modules', 'module')); foreach ($types as $type) { $xmldefs = $manifest->xpath($type[0] . '/' . $type[1]); foreach ($xmldefs as $xmldef) { $name = (string) $xmldef->attributes()->{$type}[1]; $newVersion = (string) $xmldef->attributes()->version; $version = ""; $extWhere = $db->quoteName('type') . ' = ' . $db->quote($type[1]) . ' AND ' . $db->quoteName('element') . ' = ' . $db->quote($name); if ($type[1] == 'plugin') { $group = (string) $xmldef->attributes()->group; $path = $src . '/' . $type[0] . '/' . $group; if (JFolder::exists($src . '/' . $type[0] . '/' . $group . '/' . $name)) { $path = $src . '/' . $type[0] . '/' . $group . '/' . $name; } $extWhere .= ' AND ' . $db->quoteName('folder') . ' = ' . $db->quote($group); } if ($type[1] == 'module') { $client = (string) $xmldef->attributes()->client; if (is_null($client)) { $client = 'site'; } if ($client == 'site') { $client_id = 0; } else { $client_id = 1; } $client == 'administrator' ? $path = $src . '/administrator/' . $type[0] . '/' . $name : ($path = $src . '/' . $type[0] . '/' . $name); $extWhere .= ' AND ' . $db->quoteName('client_id') . ' = ' . $db->quote($client_id); } if ($type[1] == 'library') { $path = $src . '/' . $type[0] . '/' . $name; } $query = $db->getQuery(true); $query->select($db->quoteName('extension_id'))->from($db->quoteName('#__extensions'))->where($extWhere); $db->setQuery($query); $extension = array(); try { $extension = $db->loadColumn(); } catch (RuntimeException $e) { $message = JText::sprintf('COM_VISFORMS_UNABLE_TO_GET_EXTENSION_ID', $name) . " " . JText::sprintf('COM_VISFORMS_DB_FUNCTION_FAILED', $e->getMessage()); $this->status->messages[] = array('message' => $message); JLog::add('Unable to get extension_id: ' . $name . ', ' . $e->getMessage(), JLog::ERROR, 'com_visforms'); continue; } $installer = new JInstaller(); if (count($extension)) { //make sure we have got only on id, if not use the first if (is_array($extension)) { $extension = $extension[0]; } //check if we need to update try { $version = $this->getExtensionParam('version', (int) $extension); } catch (RuntimeException $e) { $message = JText::sprintf('COM_VISFORMS_UNABLE_TO_GET_EXTENSION_PARAMS', $name) . " " . JText::sprintf('COM_VISFORMS_DB_FUNCTION_FAILED', $e->getMessage()); $this->status->messages[] = array('message' => $message); JLog::add('Unable to get ' . $type[1] . ' params: ' . $name . ', ' . $e->getMessage(), JLog::ERROR, 'com_visforms'); continue; } if (version_compare($newVersion, $version, 'gt')) { $installationType = "update"; } } else { $installationType = "install"; } if (isset($installationType)) { try { $result = $installer->{$installationType}($path); $resultArray = array('name' => $name, 'result' => $result, 'type' => $installationType); if ($type[1] == "plugin") { $resultArray['group'] = $group; $this->status->plugins[] = $resultArray; //we have to enable the content plugin visforms if ($name == 'visforms') { JLog::add("Try to enable " . $type[1] . " " . $name, JLog::INFO, 'com_visforms'); $this->enableExtension($extWhere); } //enable plugin visform spambotcheck if ($name == 'spambotcheck') { JLog::add("Try to enable " . $type[1] . " " . $name, JLog::INFO, 'com_visforms'); $this->enableExtension($extWhere); } //enable plugin editor-xtd visformfields if ($name == 'visformfields') { JLog::add("Try to enable " . $type[1] . " " . $name, JLog::INFO, 'com_visforms'); $this->enableExtension($extWhere); } } if ($type[1] == "module") { $resultArray['client'] = $client; $this->status->modules[] = $resultArray; } if ($result) { JLog::add($installationType . " of " . $type[1] . ' sucessfully: ' . $name, JLog::INFO, 'com_visforms'); } else { JLog::add($installationType . " of " . $type[1] . ' failed: ' . $name, JLog::ERROR, 'com_visforms'); } } catch (RuntimeException $e) { JLog::add($installationType . " of " . $type[1] . ' failed: ' . $name . ', ' . $e->getMessage(), JLog::ERROR, 'com_visforms'); } unset($installationType); } } } $this->installationResults($route); }
public function uninstall(JAdapterInstance $adapter) { $language = JFactory::getLanguage(); $language->load('com_jvrelatives'); $this->db->setQuery("drop table if exists #__jvrelatives"); $this->db->execute(); $manifest = $adapter->getParent()->manifest; $plugins = $manifest->xpath('plugins/plugin'); if (count($plugins)) { foreach ($plugins as $plugin) { $name = (string) $plugin->attributes()->plugin; $group = (string) $plugin->attributes()->group; $this->i_status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $this->uninstallPlugin($name, $group)); } } $modules = $manifest->xpath('modules/module'); if (count($modules)) { foreach ($modules as $module) { $name = (string) $module->attributes()->module; $client = (string) $module->attributes()->client; $this->i_status->modules[] = array('name' => $name, 'client' => $client, 'result' => $this->uninstallModule($name)); } } if (JFolder::exists(JPATH_ROOT . DS . 'components' . DS . 'com_cobalt')) { try { if (JFolder::exists(JPATH_ROOT . DS . 'components' . DS . 'com_cobalt' . DS . 'fields' . DS . 'jvrelatives')) { JFolder::delete(JPATH_ROOT . DS . 'components' . DS . 'com_cobalt' . DS . 'fields' . DS . 'jvrelatives'); $this->i_status->files[0] = array('name' => 'cobalt field', 'result' => 1); } } catch (Exception $ex) { $this->i_status->files[0] = array('name' => 'cobalt field', 'result' => 0); } } $rows = 0; ?> <h2><?php echo JText::_('COM_JVRELATIVES_REMOVAL_STATUS'); ?> </h2> <table class="adminlist table table-striped"> <thead> <tr> <th class="title" colspan="2"><?php echo JText::_('COM_JVRELATIVES_EXTENSION'); ?> </th> <th width="30%"><?php echo JText::_('COM_JVRELATIVES_STATUS'); ?> </th> </tr> </thead> <tfoot> <tr> <td colspan="3"></td> </tr> </tfoot> <tbody> <tr class="row0"> <td class="key" colspan="2"><?php echo 'JV-Relatives ' . JText::_('COM_JVRELATIVES_COMPONENT'); ?> </td> <td><strong><?php echo JText::_('COM_JVRELATIVES_UNINSTALLED'); ?> </strong></td> </tr> <?php if (count($this->i_status->modules)) { ?> <tr> <th><?php echo JText::_('COM_JVRELATIVES_MODULE'); ?> </th> <th><?php echo JText::_('COM_JVRELATIVES_CLIENT'); ?> </th> <th></th> </tr> <?php foreach ($this->i_status->modules as $module) { ?> <tr class="row<?php echo ++$rows % 2; ?> "> <td class="key"><?php echo $module['name']; ?> </td> <td class="key"><?php echo ucfirst($module['client']); ?> </td> <td><strong><?php echo $module['result'] ? JText::_('COM_JVRELATIVES_UNINSTALLED') : JText::_('COM_JVRELATIVES_NOT_UNINSTALLED'); ?> </strong></td> </tr> <?php } ?> <?php } ?> <?php if (count($this->i_status->plugins)) { ?> <tr> <th><?php echo JText::_('COM_JVRELATIVES_PLUGIN'); ?> </th> <th><?php echo JText::_('COM_JVRELATIVES_GROUP'); ?> </th> <th></th> </tr> <?php foreach ($this->i_status->plugins as $plugin) { ?> <tr class="row<?php echo ++$rows % 2; ?> "> <td class="key"><?php echo ucfirst($plugin['name']); ?> </td> <td class="key"><?php echo ucfirst($plugin['group']); ?> </td> <td><strong><?php echo $plugin['result'] ? JText::_('COM_JVRELATIVES_UNINSTALLED') : JText::_('COM_JVRELATIVES_NOT_UNINSTALLED'); ?> </strong></td> </tr> <?php } ?> <?php } ?> <?php if (count($this->i_status->files)) { ?> <tr> <th><?php echo JText::_('COM_JVRELATIVES_FILE'); ?> </th> <th></th> <th></th> </tr> <?php foreach ($this->i_status->files as $file) { ?> <tr class="row<?php echo ++$rows % 2; ?> "> <td class="key"><?php echo ucfirst($file['name']); ?> </td> <td class="key"></td> <td><strong><?php echo $file['result'] ? JText::_('COM_JVRELATIVES_UNINSTALLED') : JText::_('COM_JVRELATIVES_NOT_UNINSTALLED'); ?> </strong></td> </tr> <?php } ?> <?php } ?> </tbody> </table> <br /><br /> <div class="well"> <?php echo JText::_('COM_JVRELATIVES_UNINSTALL_TEXT_THANKYOU'); ?> </div> <?php }
/** * Called on update * * @access public * @param JAdapterInstance $adapter Installer Component Adapter. * @return void * * @since 1.6 */ public function update(JAdapterInstance $adapter) { $adapter->getParent()->setRedirectURL('index.php?option=com_rtiprint'); }
/** * @todo Decide how to Implement. */ public function testGetParent() { $this->object = new JAdapter(JUnitHelper::normalize(dirname(__FILE__)), 'Test', 'TestAdapters'); $this->assertThat($this->object->getAdapter('Testadapter3')->getParent(), $this->identicalTo($this->object)); }
/** * Method to run after an install/update/uninstall method. * * @param string $type is the type of change (install, update or discover_install) * @param JAdapterInstance $parent The class calling this method * * @return bool */ public function postflight($type, $parent) { if ('update' != $type) { return true; } $extensionPath = $parent->getParent()->getPath('extension_administrator'); $this->removeObsoleteFiles($extensionPath . '/to-be-removed.txt'); return true; }
/** * Installs all dependencies. * * @param JAdapterInstance $parent */ private function installDependencies($parent) { $installed = array(); $installer = new JInstaller(); $installer->setOverwrite(true); $src = $parent->getParent()->getPath('source'); foreach ($this->dependencies as $type => $extension) { foreach ($extension as $name => $params) { $packageZip = $src . '/' . $type . '/' . $name . '.zip'; if (JFile::exists($packageZip)) { if ($package = JInstallerHelper::unpack($packageZip)) { $doInstall = true; $path = $this->getInstalledManifest($type, $name, $params); $oldManifest = null; if (JFile::exists($path)) { $oldManifest = $installer->parseXMLInstallFile($path); } $dir = JArrayHelper::getValue($package, 'dir') . '/'; $path = $this->getExtractedManifest($dir, $type, $name); $newManifest = $installer->parseXMLInstallFile($path); if ($oldManifest) { $oldVersion = JArrayHelper::getValue($oldManifest, 'version'); $newVersion = JArrayHelper::getValue($newManifest, 'version'); if (version_compare($oldVersion, $newVersion, 'ge')) { $doInstall = false; } } $success = true; if ($doInstall) { if ($success = $installer->install($dir)) { $installed[$name] = array('status' => 1); } else { $installed[$name] = array('status' => 0); } } else { $installed[$name] = array('status' => 2); } if ($success) { // post installation configuration. if ($type == 'modules') { $this->configureModule($name, $params); } } JInstallerHelper::cleanupInstall($packageZip, $dir); } } } } return $installed; }
public function install(JAdapterInstance $adapter) { $lib = $adapter->getParent()->getPath('source') . '/library/'; $installer = new JInstaller(); $installer->install($lib); }