thelia/health-status-module

安装: 7

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 6

分支: 0

公开问题: 0

类型:thelia-module

1.0.1 2024-06-20 09:31 UTC

This package is auto-updated.

Last update: 2024-09-20 10:03:56 UTC


README

获取有关您的Thelia安装状态的信息。

en_US

描述

此模块允许您检查您的Thelia安装状态。它提供了一个页面,您可以在此页面上查看模块的状态以及有关您的网站健康状态的更多信息。

安装

手动

  • 将模块复制到 <thelia_root>/local/modules/ 目录,并确保模块名称为 HealthStatus。
  • 在您的Thelia管理面板中激活它

Composer

composer require thelia/health-status-module:~1.0

用法

一旦激活,您可以通过访问以下URL来访问健康状态页面:/admin/module/HealthStatus/show 该模块允许您查看模块的最新版本,并查看您的模块是否是最新的。您还可以查看您的Thelia安装是否是最新的,以及您的服务器是否配置正确。同时,您可以关注模块的配置,并查看是否一切设置正确。

扩展模块

该模块允许您通过监听“module.config”事件来添加自己的检查。它通过一个由事件监听器监听的通用事件来实现。此事件监听器必须创建在您希望添加验证的模块中。以下是一个监听“module.config”事件的事件监听器示例。

示例

namespace MyModule\EventListener;

use Symfony\Component\EventDispatcher\GenericEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class MyModuleHealthCheckListener implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            'module.config' => [
                'onModuleConfig', 128
                ],
        ];
    }
    
    public function onModuleConfig(GenericEvent $event): void
    {
        $subject = $event->getSubject();

        if ($subject !== "HealthStatus") {
            throw new \RuntimeException('Event subject does not match expected value');
        }
           // Add your code here, for example check if a configuration is set
    }
}

注意

如果您正在运行Thelia 2.4或更低版本,您需要将以下代码添加到config.xml中,以便事件监听器正常工作,并且也适用于较旧的模块。(在Thelia 2.5及更高版本中,事件监听器会自动通过自动装配检测。)

示例

<service id="mymodule.config.listener" class="MyModule\EventListener\ConfigListener">
    <tag name="kernel.event_listener" event="module.config" method="onModuleConfig"/>
</service>

fr_FR

描述

此模块允许您检查Thelia安装的状态。它提供了一个页面,您可以在此页面上查看模块的状态和更多有关您网站健康状态的信息。

安装

手动

  • 将模块复制到 <thelia_root>/local/modules/ 目录,并确保模块名称为HealthStatus。
  • 在您的Thelia管理面板中激活它

Composer

composer require thelia/health-status-module:~1.0

使用

一旦激活,您可以通过访问以下URL来访问健康状态页面:/admin/module/HealthStatus/show 该模块允许您查看模块的最新版本,并查看您的模块是否是最新的。此外,您还可以查看您的Thelia安装是否是最新的,以及您的服务器是否配置正确。同时,您可以关注模块的配置,并查看是否一切设置正确。

扩展模块

该模块允许您通过监听“module.config”事件来添加自己的检查。它通过一个由事件监听器监听的通用事件来实现。此事件监听器必须创建在您希望添加验证的模块中。以下是一个监听“module.config”事件的事件监听器示例。

示例

namespace MyModule\EventListener;

use Symfony\Component\EventDispatcher\GenericEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class MyModuleHealthCheckListener implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            'module.config' => [
                'onModuleConfig', 128
                ],
        ];
    }
    
    public function onModuleConfig(GenericEvent $event): void
    {
        $subject = $event->getSubject();

        if ($subject !== "HealthStatus") {
            throw new \RuntimeException('Event subject does not match expected value');
        }
           // Add your code here, for example check if a configuration is set
    }
}

注意

如果您正在运行Thelia 2.4或更低版本,您需要将以下代码添加到config.xml中,以便事件监听器正常工作,并且也适用于较旧的模块。(在Thelia 2.5及更高版本中,事件监听器会自动通过自动装配检测。)

示例

<service id="mymodule.config.listener" class="MyModule\EventListener\ConfigListener">
    <tag name="kernel.event_listener" event="module.config" method="onModuleConfig"/>
</service>