2011-10-11 13:02:57 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2013-07-13 02:26:21 +00:00
|
|
|
* @package PatchTester
|
|
|
|
*
|
|
|
|
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 Open Source Matters, Inc. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later
|
2011-10-11 13:02:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PatchTester Controller
|
|
|
|
*
|
2012-06-12 18:42:45 +00:00
|
|
|
* @package PatchTester
|
2013-07-13 02:26:21 +00:00
|
|
|
* @since 1.0
|
2011-10-11 13:02:57 +00:00
|
|
|
*/
|
2012-09-09 01:53:44 +00:00
|
|
|
class PatchTesterController extends JControllerLegacy
|
2011-10-11 13:02:57 +00:00
|
|
|
{
|
|
|
|
/**
|
2013-07-13 02:26:21 +00:00
|
|
|
* The default view for the display method.
|
2011-10-11 13:02:57 +00:00
|
|
|
*
|
2013-07-13 02:26:21 +00:00
|
|
|
* @var string
|
|
|
|
* @since 1.0
|
2011-10-11 13:02:57 +00:00
|
|
|
*/
|
2013-07-13 02:26:21 +00:00
|
|
|
protected $default_view = 'pulls';
|
2013-07-14 19:34:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to purge the cache
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*
|
|
|
|
* @since 2.0
|
|
|
|
*/
|
|
|
|
public function purge()
|
|
|
|
{
|
|
|
|
// Check for request forgeries
|
|
|
|
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
|
|
|
|
|
|
|
jimport('joomla.filesystem.file');
|
|
|
|
|
|
|
|
if (file_exists(JPATH_CACHE . '/patchtester.json') && !JFile::delete(JPATH_CACHE . '/patchtester.json'))
|
|
|
|
{
|
|
|
|
$msg = JText::_('COM_PATCHTESTER_PURGE_FAIL');
|
|
|
|
$msgType = 'error';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$msg = JText::_('COM_PATCHTESTER_PURGE_SUCCESS');
|
|
|
|
$msgType = 'message';
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->setRedirect('index.php?option=com_patchtester&view=pulls', $msg, $msgType);
|
|
|
|
}
|
2011-10-11 13:02:57 +00:00
|
|
|
}
|