33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2024-11-10 07:11:03 +00:00
patchtester/administrator/components/com_patchtester/controllers/pull.php
2014-01-02 20:50:44 -06:00

69 lines
1.3 KiB
PHP

<?php
/**
* @package PatchTester
*
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later
*/
defined('_JEXEC') or die;
/**
* Pull controller class
*
* @package PatchTester
* @since 1.0
*/
class PatchtesterControllerPull extends JControllerLegacy
{
/**
* Method to apply a patch
*
* @return void
*
* @since 1.0
*/
public function apply()
{
try
{
$this->getModel('pull')->apply(JFactory::getApplication()->input->getInt('pull_id'));
$msg = JText::_('COM_PATCHTESTER_APPLY_OK');
$type = 'message';
}
catch (Exception $e)
{
$msg = $e->getMessage();
$type = 'error';
}
$this->setRedirect(JRoute::_('index.php?option=com_patchtester&view=pulls', false), $msg, $type);
}
/**
* Method to revert a patch
*
* @return void
*
* @since 1.0
*/
public function revert()
{
try
{
$this->getModel('pull')->revert(JFactory::getApplication()->input->getInt('pull_id'));
$msg = JText::_('COM_PATCHTESTER_REVERT_OK');
$type = 'message';
}
catch (Exception $e)
{
$msg = $e->getMessage();
$type = 'error';
}
$this->setRedirect(JRoute::_('index.php?option=com_patchtester&view=pulls', false), $msg, $type);
}
}