2011-10-11 13:02:57 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package PatchTester
|
|
|
|
* @copyright Copyright (C) 2011 Ian MacLennan, Inc. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
// No direct access
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
|
|
|
|
jimport('joomla.application.component.controllerform');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pull controller class
|
|
|
|
*
|
|
|
|
* @package PatchTester
|
|
|
|
*/
|
|
|
|
class PatchtesterControllerPull extends JController
|
|
|
|
{
|
|
|
|
public function apply()
|
|
|
|
{
|
2011-10-15 01:13:59 +00:00
|
|
|
try {
|
|
|
|
$model = $this->getModel('pull')
|
|
|
|
->apply(JRequest::getVar('pull_id'));
|
|
|
|
|
2011-10-11 13:02:57 +00:00
|
|
|
$msg = 'Patch successfully applied';
|
2011-10-13 04:01:15 +00:00
|
|
|
$type = 'message';
|
2011-10-15 01:13:59 +00:00
|
|
|
} catch (Exception $e) {
|
|
|
|
$msg = $e->getMessage();
|
2011-10-13 04:01:15 +00:00
|
|
|
$type = 'error';
|
2011-10-11 13:02:57 +00:00
|
|
|
}
|
2011-10-15 01:13:59 +00:00
|
|
|
|
2011-10-13 04:01:15 +00:00
|
|
|
$this->setRedirect(JRoute::_('index.php?option=com_patchtester&view=pulls', false), $msg, $type);
|
2011-10-11 13:02:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function revert()
|
|
|
|
{
|
|
|
|
$model = $this->getModel('pull');
|
|
|
|
if ($model->revert(JRequest::getVar('pull_id'))) {
|
|
|
|
$msg = 'Patch successfully reverted';
|
2011-10-13 04:01:15 +00:00
|
|
|
$type = 'message';
|
2011-10-11 13:02:57 +00:00
|
|
|
} else {
|
|
|
|
$msg = 'Patch did not revert';
|
2011-10-13 04:01:15 +00:00
|
|
|
$type = 'error';
|
2011-10-11 13:02:57 +00:00
|
|
|
}
|
2011-10-13 04:01:15 +00:00
|
|
|
$this->setRedirect(JRoute::_('index.php?option=com_patchtester&view=pulls', false), $msg, $type);
|
2011-10-11 13:02:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|