/** * Execute the controller. * * @return void Redirects the application * * @since 2.0 */ public function execute() { try { $model = new PullModel(); // Initialize the state for the model $model->setState($this->initializeState($model)); $model->revert($this->getInput()->getUint('pull_id')); $msg = \JText::_('COM_PATCHTESTER_REVERT_OK'); $type = 'message'; } catch (\Exception $e) { $msg = $e->getMessage(); $type = 'error'; } $this->getApplication()->enqueueMessage($msg, $type); $this->getApplication()->redirect(\JRoute::_('index.php?option=com_patchtester', false)); }
/** * Execute the controller. * * @return void Redirects the application * * @since 2.0 */ public function execute() { try { $model = new PullModel(null, \JFactory::getDbo()); // Initialize the state for the model $model->setState($this->initializeState($model)); if ($model->apply($this->getInput()->getUint('pull_id'))) { $msg = \JText::_('COM_PATCHTESTER_APPLY_OK'); } else { $msg = \JText::_('COM_PATCHTESTER_NO_FILES_TO_PATCH'); } $type = 'message'; } catch (\Exception $e) { $msg = $e->getMessage(); $type = 'error'; } $this->getApplication()->enqueueMessage($msg, $type); $this->getApplication()->redirect(\JRoute::_('index.php?option=com_patchtester', false)); }