context, 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'); // Check if the SHA's were different and alert the user if ($model->getState()->get('pull.sha_different', false)) { $this->getApplication()->enqueueMessage( \JText::sprintf( 'COM_PATCHTESTER_DIFFERENT_SHA', substr($model->getState()->get('pull.state_sha'), 0, 10), substr($model->getState()->get('pull.applied_sha'), 0, 10) ), 'warning' ); } } 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)); } }