Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions administrator/components/com_cache/src/View/Cache/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,16 @@ public function display($tpl = null): void
$this->activeFilters = $model->getActiveFilters();

// Check for errors.
if (count($errors = $this->get('Errors')))
if (\count($errors = $this->get('Errors')))
{
throw new GenericDataException(implode("\n", $errors), 500);
}

if (!\count($this->data))
{
$this->setLayout('emptystate');
}

$this->addToolbar();

parent::display($tpl);
Expand All @@ -125,10 +130,13 @@ protected function addToolbar(): void
// Get the toolbar object instance
$toolbar = Toolbar::getInstance('toolbar');

ToolbarHelper::custom('delete', 'delete', '', 'JTOOLBAR_DELETE', true);
ToolbarHelper::custom('deleteAll', 'remove', '', 'JTOOLBAR_DELETE_ALL', false);
$toolbar->appendButton('Confirm', 'COM_CACHE_RESOURCE_INTENSIVE_WARNING', 'delete', 'COM_CACHE_PURGE_EXPIRED', 'purge', false);
ToolbarHelper::divider();
if (\count($this->data))
{
ToolbarHelper::custom('delete', 'delete', '', 'JTOOLBAR_DELETE', true);
ToolbarHelper::custom('deleteAll', 'remove', '', 'JTOOLBAR_DELETE_ALL', false);
$toolbar->appendButton('Confirm', 'COM_CACHE_RESOURCE_INTENSIVE_WARNING', 'delete', 'COM_CACHE_PURGE_EXPIRED', 'purge', false);
ToolbarHelper::divider();
}

if (Factory::getUser()->authorise('core.admin', 'com_cache'))
{
Expand Down
20 changes: 20 additions & 0 deletions administrator/components/com_cache/tmpl/cache/emptystate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_cache
*
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\Layout\LayoutHelper;

$displayData = [
'textPrefix' => 'COM_CACHE',
'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Cache',
'icon' => 'icon-bolt clear',
];

echo LayoutHelper::render('joomla.content.emptystate', $displayData);
2 changes: 2 additions & 0 deletions administrator/language/en-GB/com_cache.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
COM_CACHE="Cache"
COM_CACHE_CLEAR_CACHE="Maintenance: Clear Cache"
COM_CACHE_CONFIGURATION="Cache: Options"
COM_CACHE_EMPTYSTATE_CONTENT="If you enable caching in Joomla Global Configuration, then any cached items will display here as they are generated."
COM_CACHE_EMPTYSTATE_TITLE="You have no cached content."
COM_CACHE_ERROR_CACHE_CONNECTION_FAILED="Could not connect to the cache store to fetch the cache data."
COM_CACHE_ERROR_CACHE_DRIVER_UNSUPPORTED="Could not read the cache data, the configured cache handler is not supported by this environment."
COM_CACHE_EXPIRED_ITEMS_DELETE_ERROR="Error clearing cache group(s): %s."
Expand Down