Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
<authorUrl>www.joomla.org</authorUrl>
<version>4.0.0</version>
<description>MOD_POST_INSTALLATION_MESSAGES_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Module\PostInstallationMessages</namespace>
<files>
<filename module="mod_post_installation_messages">mod_post_installation_messages.php</filename>
<folder module="mod_post_installation_messages">services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<languages>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_post_installation_messages
*
* @copyright (C) 2024 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\Extension\Service\Provider\Module;
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;

/**
* The post installation messages 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\\PostInstallationMessages'));

$container->registerServiceProvider(new Module());
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage mod_post_installation_messages
*
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Module\PostInstallationMessages\Administrator\Dispatcher;

use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
use Joomla\CMS\Extension\ExtensionHelper;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* Dispatcher class for mod_post_installation_messages
*
* @since __DEPLOY_VERSION__
*/
class Dispatcher extends AbstractModuleDispatcher
{
/**
* Runs the dispatcher.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function dispatch()
{
// Load the com_postinstall language file
$this->getApplication()->getLanguage()->load('com_postinstall', JPATH_ADMINISTRATOR);

parent::dispatch();
}

/**
* Returns the layout data.
*
* @return array
*
* @since __DEPLOY_VERSION__
*/
public function getLayoutData()
{
$data = parent::getLayoutData();

$app = $this->getApplication();

// Try to get the items from the post-installation model
try {
/** @var \Joomla\Component\Postinstall\Administrator\Model\MessagesModel $messagesModel */
$messagesModel = $app->bootComponent('com_postinstall')->getMVCFactory()
->createModel('Messages', 'Administrator', ['ignore_request' => true]);
$data['messagesCount'] = $messagesModel->getItemsCount();
} catch (\RuntimeException $e) {
$data['messagesCount'] = 0;

// Still render the error message from the Exception object
$app->enqueueMessage($e->getMessage(), 'error');
}

$data['joomlaFilesExtensionId'] = ExtensionHelper::getExtensionRecord('joomla', 'file')->extension_id;

return $data;
}
}