Skip to content

Commit

Permalink
Removing extra Expired Cache view and menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackwar committed Mar 3, 2019
1 parent 2dcc610 commit 1d2713e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 213 deletions.
Expand Up @@ -14,7 +14,6 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Session\Session;
use Joomla\Component\Cache\Administrator\Helper\CacheHelper;

/**
* Cache Controller
Expand All @@ -24,51 +23,12 @@
class DisplayController extends BaseController
{
/**
* Display a view.
* The default view for the display method.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}.
*
* @return static This object to support chaining.
*
* @since 1.5
* @var string
* @since __DEPLOY_VERSION__
*/
public function display($cachable = false, $urlparams = false)
{
// Get the document object.
$document = $this->app->getDocument();

// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'cache');
$vFormat = $document->getType();
$lName = $this->input->get('layout', 'default', 'string');

// Get and render the view.
if ($view = $this->getView($vName, $vFormat))
{
switch ($vName)
{
case 'purge':
$this->app->enqueueMessage(Text::_('COM_CACHE_RESOURCE_INTENSIVE_WARNING'), 'warning');
break;
case 'cache':
default:
$model = $this->getModel($vName);
$view->setModel($model, true);
break;
}

$view->setLayout($lName);

// Push document object into the view.
$view->document = $document;

// Load the submenu.
CacheHelper::addSubmenu($this->input->get('view', 'cache'));

$view->display();
}
}
protected $default_view = 'cache';

/**
* Method to delete a list of cache groups.
Expand Down Expand Up @@ -153,9 +113,6 @@ public function deleteAll()
*/
public function purge()
{
// Check for request forgeries
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

if (!$this->getModel('cache')->purge())
{
$this->app->enqueueMessage(Text::_('COM_CACHE_EXPIRED_ITEMS_PURGING_ERROR'), 'error');
Expand All @@ -165,6 +122,6 @@ public function purge()
$this->app->enqueueMessage(Text::_('COM_CACHE_EXPIRED_ITEMS_HAVE_BEEN_PURGED'), 'message');
}

$this->setRedirect('index.php?option=com_cache&view=purge');
$this->setRedirect('index.php?option=com_cache&view=cache');
}
}
51 changes: 0 additions & 51 deletions administrator/components/com_cache/Helper/CacheHelper.php

This file was deleted.

9 changes: 5 additions & 4 deletions administrator/components/com_cache/View/Cache/HtmlView.php
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;

/**
Expand Down Expand Up @@ -52,7 +53,6 @@ public function display($tpl = null)
}

$this->addToolbar();
$this->sidebar = \JHtmlSidebar::render();

parent::display($tpl);
}
Expand All @@ -68,18 +68,19 @@ protected function addToolbar()
{
ToolbarHelper::title(Text::_('COM_CACHE_CLEAR_CACHE'), 'lightning clear');

$toolbar = Toolbar::getInstance();
ToolbarHelper::custom('delete', 'delete.png', 'delete_f2.png', 'JTOOLBAR_DELETE', true);
$toolbar->appendButton('Confirm', 'COM_CACHE_RESOURCE_INTENSIVE_WARNING', 'delete', 'COM_CACHE_PURGE_EXPIRED', 'purge', false);
//ToolbarHelper::custom('purge', 'delete.png', 'delete_f2.png', 'COM_CACHE_PURGE_EXPIRED', false);
ToolbarHelper::custom('deleteAll', 'remove.png', 'delete_f2.png', 'JTOOLBAR_DELETE_ALL', false);
ToolbarHelper::divider();

if (Factory::getUser()->authorise('core.admin', 'com_cache'))
{
ToolbarHelper::preferences('com_cache');
ToolbarHelper::divider();
}

ToolbarHelper::divider();
ToolbarHelper::help('JHELP_SITE_MAINTENANCE_CLEAR_CACHE');

\JHtmlSidebar::setAction('index.php?option=com_cache');
}
}
62 changes: 0 additions & 62 deletions administrator/components/com_cache/View/Purge/HtmlView.php

This file was deleted.

5 changes: 1 addition & 4 deletions administrator/components/com_cache/tmpl/cache/default.php
Expand Up @@ -21,10 +21,7 @@
?>
<form action="<?php echo Route::_('index.php?option=com_cache'); ?>" method="post" name="adminForm" id="adminForm">
<div class="row">
<div id="j-sidebar-container" class="col-md-2">
<?php echo $this->sidebar; ?>
</div>
<div class="col-md-10">
<div class="col-md-12">
<div id="j-main-container" class="j-main-container">
<?php echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
<?php if (count($this->data) > 0) : ?>
Expand Down
33 changes: 0 additions & 33 deletions administrator/components/com_cache/tmpl/purge/default.php

This file was deleted.

8 changes: 0 additions & 8 deletions administrator/components/com_cache/tmpl/purge/default.xml

This file was deleted.

3 changes: 0 additions & 3 deletions administrator/components/com_cpanel/Model/SystemModel.php
Expand Up @@ -57,9 +57,6 @@ public function getItems()
$maintainSection->addItem(
new SystemItem('MOD_MENU_CLEAR_CACHE', 'index.php?option=com_cache')
);
$maintainSection->addItem(
new SystemItem('MOD_MENU_PURGE_EXPIRED_CACHE', 'index.php?option=com_cache&view=purge')
);
}

if ($user->authorise('core.manage', 'com_checkin'))
Expand Down

0 comments on commit 1d2713e

Please sign in to comment.