activityReport/src/My.php

69 lines
1.5 KiB
PHP
Raw Normal View History

<?php
/**
* @brief activityReport, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
namespace Dotclear\Plugin\activityReport;
use dcCore;
/**
2023-05-08 08:18:43 +00:00
* This module definitions.
*/
class My
{
/** @var string Activity database table name */
public const ACTIVITY_TABLE_NAME = 'activity';
/** @var string Cache sub directory name */
public const CACHE_DIR_NAME = 'activityreport';
/** @var int Incremental version by breaking changes */
public const COMPATIBILITY_VERSION = 3;
/**
* This module id.
*/
public static function id(): string
{
return basename(dirname(__DIR__));
}
/**
* This module name.
*/
public static function name(): string
{
2023-05-08 08:18:43 +00:00
$name = dcCore::app()->plugins->moduleInfo(self::id(), 'name');
return __(is_string($name) ? $name : self::id());
}
/**
2023-05-08 08:18:43 +00:00
* This module path.
*/
2023-05-08 08:18:43 +00:00
public static function path(): string
{
return dirname(__DIR__);
}
/**
2023-05-08 08:18:43 +00:00
* Check is module is trully installed.
*
* Required as table structrue has changed
*/
2023-05-08 08:18:43 +00:00
public static function isInstalled(): bool
{
2023-05-08 08:18:43 +00:00
return dcCore::app()->getVersion(self::id()) == dcCore::app()->plugins->moduleInfo(self::id(), 'version');
}
}