diff --git a/administrator/modules/mod_latestactions/mod_latestactions.php b/administrator/modules/mod_latestactions/mod_latestactions.php
deleted file mode 100644
index 6672e1a38b002..0000000000000
--- a/administrator/modules/mod_latestactions/mod_latestactions.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-
-\defined('_JEXEC') or die;
-
-use Joomla\CMS\Helper\ModuleHelper;
-use Joomla\Module\LatestActions\Administrator\Helper\LatestActionsHelper;
-
-// Only super user can view this data
-if (!$app->getIdentity()->authorise('core.admin')) {
- return;
-}
-
-$list = LatestActionsHelper::getList($params);
-
-if ($params->get('automatic_title', 0)) {
- $module->title = LatestActionsHelper::getTitle($params);
-}
-
-require ModuleHelper::getLayoutPath('mod_latestactions', $params->get('layout', 'default'));
diff --git a/administrator/modules/mod_latestactions/mod_latestactions.xml b/administrator/modules/mod_latestactions/mod_latestactions.xml
index 834d2265293cb..98c7e13dbafec 100644
--- a/administrator/modules/mod_latestactions/mod_latestactions.xml
+++ b/administrator/modules/mod_latestactions/mod_latestactions.xml
@@ -11,7 +11,7 @@
MOD_LATESTACTIONS_XML_DESCRIPTION
Joomla\Module\LatestActions
- mod_latestactions.php
+ services
src
tmpl
diff --git a/administrator/modules/mod_latestactions/services/provider.php b/administrator/modules/mod_latestactions/services/provider.php
new file mode 100644
index 0000000000000..16f0f1c5f8c82
--- /dev/null
+++ b/administrator/modules/mod_latestactions/services/provider.php
@@ -0,0 +1,41 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+\defined('_JEXEC') or die;
+
+use Joomla\CMS\Extension\Service\Provider\HelperFactory;
+use Joomla\CMS\Extension\Service\Provider\Module;
+use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
+use Joomla\DI\Container;
+use Joomla\DI\ServiceProviderInterface;
+
+/**
+ * The latest actions module service provider.
+ *
+ * @since __DEPLOY_VERSION__
+ */
+return new class () implements ServiceProviderInterface {
+ /**
+ * Registers the service provider with a DI container.
+ *
+ * @param Container $container The DI container.
+ *
+ * @return void
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function register(Container $container)
+ {
+ $container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\LatestActions'));
+ $container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\LatestActions\\Administrator\\Helper'));
+
+ $container->registerServiceProvider(new Module());
+ }
+};
diff --git a/administrator/modules/mod_latestactions/src/Dispatcher/Dispatcher.php b/administrator/modules/mod_latestactions/src/Dispatcher/Dispatcher.php
new file mode 100644
index 0000000000000..112a361903c84
--- /dev/null
+++ b/administrator/modules/mod_latestactions/src/Dispatcher/Dispatcher.php
@@ -0,0 +1,65 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\Module\LatestActions\Administrator\Dispatcher;
+
+use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
+use Joomla\CMS\Helper\HelperFactoryAwareInterface;
+use Joomla\CMS\Helper\HelperFactoryAwareTrait;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Dispatcher class for mod_latestactions
+ *
+ * @since __DEPLOY_VERSION__
+ */
+class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
+{
+ use HelperFactoryAwareTrait;
+
+ /**
+ * Runs the dispatcher.
+ *
+ * @return void
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function dispatch()
+ {
+ if (!$this->getApplication()->getIdentity()->authorise('core.admin')) {
+ return;
+ }
+
+ parent::dispatch();
+ }
+
+ /**
+ * Returns the layout data.
+ *
+ * @return array
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ protected function getLayoutData()
+ {
+ $data = parent::getLayoutData();
+
+ $data['list'] = $this->getHelperFactory()->getHelper('LatestActionsHelper')->getActions($data['params']);
+
+ if ($data['params']->get('automatic_title', 0)) {
+ $this->module->title = $this->getHelperFactory()->getHelper('LatestActionsHelper')->getModuleTitle($data['params']);
+ }
+
+ return $data;
+ }
+}
diff --git a/administrator/modules/mod_latestactions/src/Helper/LatestActionsHelper.php b/administrator/modules/mod_latestactions/src/Helper/LatestActionsHelper.php
index 1f2c2916efb47..f57eb56e98e41 100644
--- a/administrator/modules/mod_latestactions/src/Helper/LatestActionsHelper.php
+++ b/administrator/modules/mod_latestactions/src/Helper/LatestActionsHelper.php
@@ -24,7 +24,7 @@
*
* @since 3.9.0
*/
-abstract class LatestActionsHelper
+class LatestActionsHelper
{
/**
* Get a list of logged actions.
@@ -33,11 +33,11 @@ abstract class LatestActionsHelper
*
* @return mixed An array of action logs, or false on error.
*
- * @since 3.9.1
+ * @since __DEPLOY_VERSION__
*
* @throws \Exception
*/
- public static function getList(&$params)
+ public function getActions(&$params)
{
/** @var \Joomla\Component\Actionlogs\Administrator\Model\ActionlogsModel $model */
$model = Factory::getApplication()->bootComponent('com_actionlogs')->getMVCFactory()
@@ -61,6 +61,20 @@ public static function getList(&$params)
return $rows;
}
+ /**
+ * Get the alternate title for the module
+ *
+ * @param Registry $params The module parameters.
+ *
+ * @return string The alternate title for the module.
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function getModuleTitle($params)
+ {
+ return Text::plural('MOD_LATESTACTIONS_TITLE', $params->get('count', 5));
+ }
+
/**
* Get the alternate title for the module
*
@@ -69,9 +83,37 @@ public static function getList(&$params)
* @return string The alternate title for the module.
*
* @since 3.9.1
+ *
+ * @deprecated __DEPLOY_VERSION__ will be removed in 7.0
+ * Use the non-static method getModuleTitle
+ * Example: Factory::getApplication()->bootModule('mod_latestactions', 'administrator')
+ * ->getHelper('LatestActionsHelper')
+ * ->getModuleTitle($params)
*/
public static function getTitle($params)
{
- return Text::plural('MOD_LATESTACTIONS_TITLE', $params->get('count', 5));
+ return (new self())->getModuleTitle($params);
+ }
+
+ /**
+ * Get a list of logged actions.
+ *
+ * @param Registry &$params The module parameters.
+ *
+ * @return mixed An array of action logs, or false on error.
+ *
+ * @since 3.9.1
+ *
+ * @throws \Exception
+ *
+ * @deprecated __DEPLOY_VERSION__ will be removed in 7.0
+ * Use the non-static method getActions
+ * Example: Factory::getApplication()->bootModule('mod_latestactions', 'administrator')
+ * ->getHelper('LatestActionsHelper')
+ * ->getActions($params)
+ */
+ public static function getList(&$params)
+ {
+ return (new self())->getActions($params);
}
}