public function updateAll($allow_update = array()) { // Fetch all the available packages $packages = MageBridgeUpdateHelper::getPackageList(); $count = 0; foreach ($packages as $package) { // Skip optional packages which are not yet installed and not selected in the list if (!in_array($package['name'], $allow_update)) { continue; } // Update the package and add an error if something goes wrong if ($this->update($package['name']) == false) { JError::raiseWarning('SOME_ERROR_CODE', JText::sprintf('Installation of %s failed', $package['name'])); // Only crash when installing the component, continue for all other extensions if ($package['name'] == 'com_magebridge') { return false; } continue; } else { $count++; } } // Run the helper for post-install tasks $helper = new MageBridgeInstallHelper(); $helper->cleanFiles(); // Simple notices as feedback JError::raiseNotice('SOME_ERROR_CODE', JText::sprintf('Updated %d extensions successfully', $count)); JError::raiseNotice('SOME_ERROR_CODE', JText::sprintf('Check %s for upgrade notices', MageBridgeHelper::getHelpText('builds'))); return true; }
public function doInstall() { // Try to include the file $file = 'administrator/components/com_magebridge/helpers/install.php'; if (is_file(JPATH_ROOT . '/' . $file)) { require_once JPATH_ROOT . '/' . $file; } else { if (is_file(dirname(__FILE__) . '/' . $file)) { require_once dirname(__FILE__) . '/' . $file; } else { return true; } } // Initialize the helper $helper = new MageBridgeInstallHelper(); // Initialize important variables $application = JFactory::getApplication(); $db = JFactory::getDBO(); // Remove obsolete files //$helper->cleanFiles(); // Upgrade the database tables $helper->updateQueries(); // Install new connectors $helper->installConnectors(); // Done return true; }
/** * Method run when installing MageBridge */ function com_install() { require_once dirname(__FILE__) . '/helpers/install.php'; $helper = new MageBridgeInstallHelper(); // Initialize important variables $application = JFactory::getApplication(); $db = JFactory::getDBO(); // Upgrade the database tables $helper->updateQueries(); // Done return true; }
/** * Method to perform update queries * * @param null * * @return null */ public function updateQueries() { // Validate whether this task is allowed if ($this->_validate() == false) { return false; } // Initialize the helper $helper = new MageBridgeInstallHelper(); // Upgrade the database tables $helper->updateQueries(); // Run the helper to remove obsolete files YireoHelperInstall::remove(); // Clean the Joomla! plugins cache $options = array('defaultgroup' => 'com_plugins', 'cachebase' => JPATH_ADMINISTRATOR . '/cache'); $cache = JCache::getInstance('callback', $options); $cache->clean(); // Redirect $link = 'index.php?option=com_magebridge&view=update'; $msg = JText::_('LIB_YIREO_CONTROLLER_DB_UPGRADED'); $this->setRedirect($link, $msg); }