diff --git a/administrator/components/com_cache/controller.php b/administrator/components/com_cache/controller.php
index 13fc6797d9b31..65986e60119e9 100644
--- a/administrator/components/com_cache/controller.php
+++ b/administrator/components/com_cache/controller.php
@@ -138,6 +138,7 @@ public function deleteAll()
$app->enqueueMessage(JText::_('COM_CACHE_MSG_SOME_CACHE_GROUPS_CLEARED'), 'warning');
}
+ $app->triggerEvent('onAfterPurge', array());
$this->setRedirect('index.php?option=com_cache&view=cache');
}
diff --git a/administrator/components/com_cache/models/cache.php b/administrator/components/com_cache/models/cache.php
index 16498a7ed9dbd..29a2bb2f9b5c2 100644
--- a/administrator/components/com_cache/models/cache.php
+++ b/administrator/components/com_cache/models/cache.php
@@ -9,6 +9,7 @@
defined('_JEXEC') or die;
+use Joomla\CMS\Factory;
use Joomla\Utilities\ArrayHelper;
/**
@@ -251,7 +252,7 @@ public function clean($group = '')
{
try
{
- return $this->getCache()->clean($group);
+ $this->getCache()->clean($group);
}
catch (JCacheExceptionConnecting $exception)
{
@@ -261,6 +262,10 @@ public function clean($group = '')
{
return false;
}
+
+ Factory::getApplication()->triggerEvent('onAfterPurge', array($group));
+
+ return true;
}
/**
@@ -294,7 +299,7 @@ public function purge()
{
try
{
- return JFactory::getCache('')->gc();
+ JFactory::getCache('')->gc();
}
catch (JCacheExceptionConnecting $exception)
{
@@ -304,5 +309,9 @@ public function purge()
{
return false;
}
+
+ Factory::getApplication()->triggerEvent('onAfterPurge', array());
+
+ return true;
}
}
diff --git a/administrator/language/en-GB/en-GB.plg_actionlog_joomla.ini b/administrator/language/en-GB/en-GB.plg_actionlog_joomla.ini
index f396f5a406d27..8f4d455a220d6 100644
--- a/administrator/language/en-GB/en-GB.plg_actionlog_joomla.ini
+++ b/administrator/language/en-GB/en-GB.plg_actionlog_joomla.ini
@@ -35,6 +35,7 @@ PLG_ACTIONLOG_JOOMLA_TYPE_TEMPLATE="template"
PLG_ACTIONLOG_JOOMLA_TYPE_USER="user"
PLG_ACTIONLOG_JOOMLA_TYPE_USER_GROUP="user group"
PLG_ACTIONLOG_JOOMLA_TYPE_USER_NOTE="user note"
+PLG_ACTIONLOG_JOOMLA_USER_CACHE="User {username} deleted cache group {group}"
PLG_ACTIONLOG_JOOMLA_USER_CHECKIN="User {username} performed a check in to table {table}"
PLG_ACTIONLOG_JOOMLA_USER_LOG="User {username} purged one or more rows from the action log"
PLG_ACTIONLOG_JOOMLA_USER_LOGEXPORT="User {username} exported one or more rows from the action log"
diff --git a/plugins/actionlog/joomla/joomla.php b/plugins/actionlog/joomla/joomla.php
index 69b8aa1887460..933f63936b837 100644
--- a/plugins/actionlog/joomla/joomla.php
+++ b/plugins/actionlog/joomla/joomla.php
@@ -1001,4 +1001,39 @@ public function onAfterLogExport($group = '')
);
$this->addLog(array($message), 'PLG_ACTIONLOG_JOOMLA_USER_LOGEXPORT', $context, $user->id);
}
+
+ /**
+ * On after Cache purge
+ *
+ * Method is called after user request to clean cached items.
+ *
+ * @param string $group Holds the group name.
+ *
+ * @return void
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function onAfterPurge($group = 'all')
+ {
+ $context = $this->app->input->get('option');
+ $user = JFactory::getUser();
+
+ if (!$this->checkLoggable($context))
+ {
+ return;
+ }
+
+ $message = array(
+ 'action' => 'cache',
+ 'type' => 'PLG_ACTIONLOG_JOOMLA_TYPE_USER',
+ 'id' => $user->id,
+ 'title' => $user->name,
+ 'itemlink' => 'index.php?option=com_users&task=user.edit&id=' . $user->id,
+ 'userid' => $user->id,
+ 'username' => $user->name,
+ 'accountlink' => 'index.php?option=com_users&task=user.edit&id=' . $user->id,
+ 'group' => $group,
+ );
+ $this->addLog(array($message), 'PLG_ACTIONLOG_JOOMLA_USER_CACHE', $context, $user->id);
+ }
}