Ejemplo n.º 1
0
 /**
  * Method to upgrade all registered packages at once
  *
  * @package MageBridge
  * @access public
  * @param int $allow_update
  * @return bool
  */
 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;
         }
         // Skip packages that are not available
         if ($package['available'] == 0) {
             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('COM_MAGEBRIDGE_MODEL_UPDATE_INSTALL_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 to remove obsolete files
     YireoHelperInstall::remove();
     // Simple notices as feedback
     JError::raiseNotice('SOME_ERROR_CODE', JText::sprintf('COM_MAGEBRIDGE_MODEL_UPDATE_INSTALL_SUCCESS', $count));
     JError::raiseNotice('SOME_ERROR_CODE', JText::sprintf('COM_MAGEBRIDGE_MODEL_UPDATE_INSTALL_CHANGELOG', MageBridgeHelper::getHelpLink('changelog')));
     return true;
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }