release 0.9.1
This commit is contained in:
parent
81bd9889d0
commit
118bd06ead
9 changed files with 105 additions and 99 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
DotclearWatch 0.9.1 - 2023.10.09
|
||||||
|
===========================================================
|
||||||
|
* Require dotclear 2.28
|
||||||
|
* Require php 8.1
|
||||||
|
* Fix permissions
|
||||||
|
* Code review
|
||||||
|
|
||||||
DotclearWatch 0.9 - 2023.10.07
|
DotclearWatch 0.9 - 2023.10.07
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require dotclear 2.28
|
* Require dotclear 2.28
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-0.9-a2cbe9.svg)](https://git.dotclear.watch/dw/DotclearWatch/releases)
|
[![Release](https://img.shields.io/badge/release-0.9-a2cbe9.svg)](https://git.dotclear.watch/dw/DotclearWatch/releases)
|
||||||
![Date](https://img.shields.io/badge/date-2023.10.07-c44d58.svg)]
|
![Date](https://img.shields.io/badge/date-2023.10.07-c44d58.svg)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/DotclearWatch)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/DotclearWatch)
|
||||||
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/dw/DotclearWatch/src/branch/master/LICENSE)
|
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/dw/DotclearWatch/src/branch/master/LICENSE)
|
||||||
|
|
22
_define.php
22
_define.php
|
@ -1,25 +1,27 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief DotclearWatch, a plugin for Dotclear 2
|
* @file
|
||||||
|
* @brief The plugin DotclearWatch definition
|
||||||
|
* @ingroup DotclearWatch
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @defgroup DotclearWatch Plugin DotclearWatch.
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and contributors
|
* QSend report about your Dotclear.
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christain Denis
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
'Dotclear Watch',
|
'Dotclear Watch',
|
||||||
'Send report about your Dotclear',
|
'Send report about your Dotclear',
|
||||||
'Jean-Christian Denis and contributors',
|
'Jean-Christian Denis and contributors',
|
||||||
'0.9',
|
'0.9.1',
|
||||||
[
|
[
|
||||||
'requires' => [
|
'requires' => [['core', '2.28']],
|
||||||
['php', '8.1'],
|
'permissions' => 'My',
|
||||||
['core', '2.28'],
|
|
||||||
],
|
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://git.dotclear.watch/dw/' . basename(__DIR__) . '/issues',
|
'support' => 'https://git.dotclear.watch/dw/' . basename(__DIR__) . '/issues',
|
||||||
'details' => 'https://git.dotclear.watch/dw/' . basename(__DIR__) . '/src/branch/master/README.md',
|
'details' => 'https://git.dotclear.watch/dw/' . basename(__DIR__) . '/src/branch/master/README.md',
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="DotclearWatch">
|
<module id="DotclearWatch">
|
||||||
<name>Dotclear Watch</name>
|
<name>Dotclear Watch</name>
|
||||||
<version>0.9</version>
|
<version>0.9.1</version>
|
||||||
<author>Jean-Christian Denis and contributors</author>
|
<author>Jean-Christian Denis and contributors</author>
|
||||||
<desc>Send report about your Dotclear</desc>
|
<desc>Send report about your Dotclear</desc>
|
||||||
<file>https://git.dotclear.watch/dw/DotclearWatch/releases/download/v0.9/plugin-DotclearWatch.zip</file>
|
<file>https://git.dotclear.watch/dw/DotclearWatch/releases/download/v0.9.1/plugin-DotclearWatch.zip</file>
|
||||||
<da:dcmin>2.28</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/dw/DotclearWatch/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/dw/DotclearWatch/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/dw/DotclearWatch/issues</da:support>
|
<da:support>https://git.dotclear.watch/dw/DotclearWatch/issues</da:support>
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief DotclearWatch, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christain Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\DotclearWatch;
|
namespace Dotclear\Plugin\DotclearWatch;
|
||||||
|
@ -17,6 +7,14 @@ namespace Dotclear\Plugin\DotclearWatch;
|
||||||
use Dotclear\App;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DotclearWatch backend class.
|
||||||
|
* @ingroup DotclearWatch
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Backend extends Process
|
class Backend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief DotclearWatch, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugins
|
|
||||||
*
|
|
||||||
* @copyright Olivier Meunier & Association Dotclear
|
|
||||||
* @copyright GPL-2.0-only
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\DotclearWatch;
|
namespace Dotclear\Plugin\DotclearWatch;
|
||||||
|
@ -30,6 +22,14 @@ use Dotclear\Helper\Html\Form\{
|
||||||
};
|
};
|
||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DotclearWatch configuration class.
|
||||||
|
* @ingroup DotclearWatch
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Config extends Process
|
class Config extends Process
|
||||||
{
|
{
|
||||||
private static string $hidden_modules = '';
|
private static string $hidden_modules = '';
|
||||||
|
@ -37,7 +37,7 @@ class Config extends Process
|
||||||
|
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
return self::status(My::checkContext(My::MANAGE));
|
return self::status(My::checkContext(My::CONFIG));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief DotclearWatch, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christain Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\DotclearWatch;
|
namespace Dotclear\Plugin\DotclearWatch;
|
||||||
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DotclearWatch install class.
|
||||||
|
* @ingroup DotclearWatch
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Install extends Process
|
class Install extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
@ -25,8 +23,7 @@ class Install extends Process
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
$s = My::settings();
|
if (self::status() && ($s = My::settings()) !== null) {
|
||||||
if (self::status() && $s !== null) {
|
|
||||||
$s->put(
|
$s->put(
|
||||||
'hidden_modules',
|
'hidden_modules',
|
||||||
'DotclearWatch',
|
'DotclearWatch',
|
||||||
|
|
27
src/My.php
27
src/My.php
|
@ -1,27 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief DotclearWatch, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christain Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\DotclearWatch;
|
namespace Dotclear\Plugin\DotclearWatch;
|
||||||
|
|
||||||
use Dotclear\App;
|
|
||||||
use Dotclear\Module\MyPlugin;
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DotclearWatch My helper.
|
||||||
|
* @ingroup DotclearWatch
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class My extends MyPlugin
|
class My extends MyPlugin
|
||||||
{
|
{
|
||||||
protected static function checkCustomContext(int $context): ?bool
|
// Use default permissions
|
||||||
{
|
|
||||||
return $context === My::INSTALL ? null :
|
|
||||||
defined('DC_CONTEXT_ADMIN') && App::auth()->isSuperAdmin();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief DotclearWatch, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis and contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christain Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\DotclearWatch;
|
namespace Dotclear\Plugin\DotclearWatch;
|
||||||
|
@ -20,21 +10,49 @@ use Dotclear\Helper\Network\HttpClient;
|
||||||
use Dotclear\Module\ModuleDefine;
|
use Dotclear\Module\ModuleDefine;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DotclearWatch utils class.
|
||||||
|
* @ingroup DotclearWatch
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Utils
|
class Utils
|
||||||
{
|
{
|
||||||
/** @var int The expiration delay before resend report (one week) */
|
/**
|
||||||
|
* The expiration delay before resend report (one week).
|
||||||
|
*
|
||||||
|
* @var int EXPIRED_DELAY
|
||||||
|
*/
|
||||||
public const EXPIRED_DELAY = 604800;
|
public const EXPIRED_DELAY = 604800;
|
||||||
|
|
||||||
/** @var string The default distant API URL */
|
/**
|
||||||
|
* The default distant API URL.
|
||||||
|
*
|
||||||
|
* @var string DISTANT_API_URL
|
||||||
|
*/
|
||||||
public const DISTANT_API_URL = 'https://dotclear.watch/api';
|
public const DISTANT_API_URL = 'https://dotclear.watch/api';
|
||||||
|
|
||||||
/** @var string The distant API version */
|
/**
|
||||||
|
* The distant API version.
|
||||||
|
*
|
||||||
|
* @var string DISTANT_API_VERSION
|
||||||
|
*/
|
||||||
public const DISTANT_API_VERSION = '1.1';
|
public const DISTANT_API_VERSION = '1.1';
|
||||||
|
|
||||||
/** @var array<int,string> The hiddens modules IDs */
|
/**
|
||||||
|
* The hiddens modules IDs.
|
||||||
|
*
|
||||||
|
* @var array<int,string> $hiddens
|
||||||
|
*/
|
||||||
private static array $hiddens = [];
|
private static array $hiddens = [];
|
||||||
|
|
||||||
/** @var string Multiblog unique identifiant */
|
/**
|
||||||
|
* Multiblog unique identifiant.
|
||||||
|
*
|
||||||
|
* @var string $uid
|
||||||
|
*/
|
||||||
private static string $uid = '';
|
private static string $uid = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,7 +92,7 @@ class Utils
|
||||||
if ($strict && in_array($define->getId(), $hiddens)) {
|
if ($strict && in_array($define->getId(), $hiddens)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$modules[$define->getId()] = $define->get('version');
|
$modules[(string) $define->getId()] = (string) $define->get('version');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $modules;
|
return $modules;
|
||||||
|
@ -100,7 +118,7 @@ class Utils
|
||||||
if ($strict && in_array($define->getId(), $hiddens)) {
|
if ($strict && in_array($define->getId(), $hiddens)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$modules[$define->getId()] = $define->get('version');
|
$modules[(string) $define->getId()] = (string) $define->get('version');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $modules;
|
return $modules;
|
||||||
|
@ -240,12 +258,12 @@ class Utils
|
||||||
|
|
||||||
private static function check(): bool
|
private static function check(): bool
|
||||||
{
|
{
|
||||||
return defined('DC_CRYPT_ALGO');
|
return true; // not yet
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function key(): string
|
private static function key(): string
|
||||||
{
|
{
|
||||||
return Crypt::hmac(self::uid() . My::id(), DC_CRYPT_ALGO);
|
return Crypt::hmac(self::uid() . My::id(), App::config()->cryptAlgo());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function uid(): string
|
private static function uid(): string
|
||||||
|
@ -315,15 +333,6 @@ class Utils
|
||||||
App::log()->addLog($cur);
|
App::log()->addLog($cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function read(): string
|
|
||||||
{
|
|
||||||
$rs = App::log()->getLogs([
|
|
||||||
'log_table' => My::id() . '_report',
|
|
||||||
]);
|
|
||||||
|
|
||||||
return $rs->isEmpty() || !is_string($rs->f('log_msg')) ? '' : $rs->f('log_msg');
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function expired(): bool
|
private static function expired(): bool
|
||||||
{
|
{
|
||||||
$rs = App::log()->getLogs([
|
$rs = App::log()->getLogs([
|
||||||
|
@ -349,7 +358,7 @@ class Utils
|
||||||
'count' => (int) App::blogs()->getBlogs([], true)->f(0),
|
'count' => (int) App::blogs()->getBlogs([], true)->f(0),
|
||||||
],
|
],
|
||||||
'core' => [
|
'core' => [
|
||||||
'version' => DC_VERSION,
|
'version' => App::config()->dotclearVersion(),
|
||||||
],
|
],
|
||||||
'server' => self::getServer(),
|
'server' => self::getServer(),
|
||||||
'php' => [
|
'php' => [
|
||||||
|
|
Loading…
Reference in a new issue