/** * 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'] = 'Time Tracking'; $item['alias'] = 'timetracking'; $item['link'] = 'index.php?option=' . $element . '&view=timesheet'; $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); } 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') { $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); } if (strtolower($route) == 'update') { $element = $adapter->get('element'); // Make the admin component menu item a child of com_projectfork PFInstallerHelper::setComponentMenuItem($element); } 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') { $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; }
$app = JFactory::getApplication(); $folder = dirname(__FILE__) . '/script_postprocess'; $query = $db->getQuery(true); // Check if the scripts folder exists if (!JFolder::exists($folder)) { $app->enqueueMessage('Post-process script update folder not found!'); return false; } // Get all script files $files = (array) str_replace('.php', '', JFolder::files($folder, '\\.php$')); usort($files, 'version_compare'); // Iterate through all scripts foreach ($files as $file) { if (version_compare($file, $prev_version, '>')) { // Run the script if (file_exists($folder . '/' . $file . '.php')) { require_once $folder . '/' . $file . '.php'; } } } // Restore com_pfdesigns admin menu item $query->clear(); $query->select('extension_id')->from('#__extensions')->where('name = ' . $db->quote('com_pfdesigns'))->where('type = ' . $db->quote('component')); $db->setQuery($query); $designs_id = $db->loadResult(); if ($designs_id) { if (!defined('PF_LIBRARY')) { jimport('projectfork.library'); } PFInstallerHelper::setComponentMenuItem('com_pfdesigns'); }