update to Dotclear 2.28-dev

master
Jean-Christian Paul Denis 2023-10-07 15:33:13 +02:00
parent 1a13ca2405
commit 332930aab9
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
8 changed files with 49 additions and 46 deletions

View File

@ -1,3 +1,9 @@
DotclearWatch 0.9 - 2023.10.07
===========================================================
* Require dotclear 2.28
* Require php 8.1
* Update to Dotclear 2.28-dev
DotclearWatch 0.8 - 2023.08.27 DotclearWatch 0.8 - 2023.08.27
=========================================================== ===========================================================
* Require dotclear 2.27 * Require dotclear 2.27

View File

@ -1,8 +1,8 @@
# README # README
[![Release](https://img.shields.io/badge/release-0.8-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.08.27-c44d58.svg)] ![Date](https://img.shields.io/badge/date-2023.10.07-c44d58.svg)]
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-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)
@ -30,8 +30,8 @@ in aboutConfig global parameters called DotclearWatch->hidden_modules
## REQUIREMENTS ## REQUIREMENTS
* super admin permission to intall it * super admin permission to intall it
* Dotclear 2.27 * Dotclear 2.28
* PHP 7.4+ * PHP 8.1+
## USAGE ## USAGE

View File

@ -14,11 +14,11 @@ $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.8', '0.9',
[ [
'requires' => [ 'requires' => [
['php', '7.4'], ['php', '8.1'],
['core', '2.27'], ['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',

View File

@ -2,11 +2,11 @@
<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.8</version> <version>0.9</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.8/plugin-DotclearWatch.zip</file> <file>https://git.dotclear.watch/dw/DotclearWatch/releases/download/v0.9/plugin-DotclearWatch.zip</file>
<da:dcmin>2.27</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>
</module> </module>

View File

@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Dotclear\Plugin\DotclearWatch; namespace Dotclear\Plugin\DotclearWatch;
use dcCore; use Dotclear\App;
use Dotclear\Core\Process; use Dotclear\Core\Process;
class Backend extends Process class Backend extends Process
@ -30,9 +30,9 @@ class Backend extends Process
return false; return false;
} }
dcCore::app()->addBehaviors([ App::behavior()->addBehaviors([
'adminDashboardHeaders' => function (): string { 'adminDashboardHeaders' => function (): string {
return My::jsLoad('service', dcCore::app()->getVersion(My::id())); return My::jsLoad('service', App::version()->getVersion(My::id()));
}, },
'adminPageFooterV2' => function (): void { 'adminPageFooterV2' => function (): void {
if (My::settings()->getGlobal('distant_api_url')) { if (My::settings()->getGlobal('distant_api_url')) {
@ -47,7 +47,7 @@ class Backend extends Process
}, },
]); ]);
dcCore::app()->rest->addFunction( App::rest()->addFunction(
'adminDotclearWatchSendReport', 'adminDotclearWatchSendReport',
function (): array { function (): array {
Utils::sendReport(); Utils::sendReport();

View File

@ -12,7 +12,7 @@ declare(strict_types=1);
namespace Dotclear\Plugin\DotclearWatch; namespace Dotclear\Plugin\DotclearWatch;
use dcCore; use Dotclear\App;
use Dotclear\Core\Backend\Notices; use Dotclear\Core\Backend\Notices;
use Dotclear\Core\Backend\Page; use Dotclear\Core\Backend\Page;
use Dotclear\Core\Process; use Dotclear\Core\Process;
@ -47,7 +47,7 @@ class Config extends Process
} }
if (self::useColorSynthax()) { if (self::useColorSynthax()) {
dcCore::app()->addBehavior('pluginsToolsHeadersV2', fn (bool $plugin): string => Page::jsLoadCodeMirror(dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax_theme'))); App::behavior()->addBehavior('pluginsToolsHeadersV2', fn (bool $plugin): string => Page::jsLoadCodeMirror(App::auth()->prefs()->get('interface')->get('colorsyntax_theme')));
} }
self::$hidden_modules = (string) My::settings()->getGlobal('hidden_modules'); self::$hidden_modules = (string) My::settings()->getGlobal('hidden_modules');
@ -86,7 +86,7 @@ class Config extends Process
} }
} }
dcCore::app()->admin->url->redirect('admin.plugins', ['module' => My::id(), 'conf' => '1']); App::backend()->url->redirect('admin.plugins', ['module' => My::id(), 'conf' => '1']);
return true; return true;
} }
@ -139,13 +139,13 @@ class Config extends Process
])->render() . ])->render() .
( (
self::useColorSynthax() ? self::useColorSynthax() ?
Page::jsRunCodeMirror(My::id() . 'editor', 'report_contents', 'json', dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax_theme')) : '' Page::jsRunCodeMirror(My::id() . 'editor', 'report_contents', 'json', App::auth()->prefs()->get('interface')->get('colorsyntax_theme')) : ''
); );
} }
} }
private static function useColorSynthax(): bool private static function useColorSynthax(): bool
{ {
return dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax') && '' != dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax_theme'); return App::auth()->prefs()->get('interface')->get('colorsyntax') && '' != App::auth()->prefs()->get('interface')->get('colorsyntax_theme');
} }
} }

View File

@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Dotclear\Plugin\DotclearWatch; namespace Dotclear\Plugin\DotclearWatch;
use dcCore; use Dotclear\App;
use Dotclear\Module\MyPlugin; use Dotclear\Module\MyPlugin;
class My extends MyPlugin class My extends MyPlugin
@ -22,6 +22,6 @@ class My extends MyPlugin
protected static function checkCustomContext(int $context): ?bool protected static function checkCustomContext(int $context): ?bool
{ {
return $context === My::INSTALL ? null : return $context === My::INSTALL ? null :
defined('DC_CONTEXT_ADMIN') && dcCore::app()->auth->isSuperAdmin(); defined('DC_CONTEXT_ADMIN') && App::auth()->isSuperAdmin();
} }
} }

View File

@ -14,12 +14,10 @@ declare(strict_types=1);
namespace Dotclear\Plugin\DotclearWatch; namespace Dotclear\Plugin\DotclearWatch;
use dcCore; use Dotclear\App;
use dcLog;
use dcModuleDefine;
use dcThemes;
use Dotclear\Helper\Crypt; use Dotclear\Helper\Crypt;
use Dotclear\Helper\Network\HttpClient; use Dotclear\Helper\Network\HttpClient;
use Dotclear\Module\ModuleDefine;
use Exception; use Exception;
class Utils class Utils
@ -71,7 +69,7 @@ class Utils
{ {
$modules = []; $modules = [];
$hiddens = self::getHiddens(); $hiddens = self::getHiddens();
$defines = dcCore::app()->plugins->getDefines($strict ? ['state' => dcModuleDefine::STATE_ENABLED] : []); $defines = App::plugins()->getDefines($strict ? ['state' => ModuleDefine::STATE_ENABLED] : []);
foreach ($defines as $define) { foreach ($defines as $define) {
if ($strict && in_array($define->getId(), $hiddens)) { if ($strict && in_array($define->getId(), $hiddens)) {
continue; continue;
@ -91,14 +89,13 @@ class Utils
*/ */
public static function getThemes(bool $strict = true): array public static function getThemes(bool $strict = true): array
{ {
if (!(dcCore::app()->themes instanceof dcThemes)) { if (App::themes()->isEmpty()) {
dcCore::app()->themes = new dcThemes(); App::themes()->loadModules(App::blog()->themesPath());
dcCore::app()->themes->loadModules(dcCore::app()->blog->themes_path);
} }
$modules = []; $modules = [];
$hiddens = self::getHiddens(); $hiddens = self::getHiddens();
$defines = dcCore::app()->themes->getDefines($strict ? ['state' => dcModuleDefine::STATE_ENABLED] : []); $defines = App::themes()->getDefines($strict ? ['state' => ModuleDefine::STATE_ENABLED] : []);
foreach ($defines as $define) { foreach ($defines as $define) {
if ($strict && in_array($define->getId(), $hiddens)) { if ($strict && in_array($define->getId(), $hiddens)) {
continue; continue;
@ -157,7 +154,7 @@ class Utils
*/ */
public static function getError(): string public static function getError(): string
{ {
$rs = dcCore::app()->log->getLogs([ App::log()->getLogs([
'log_table' => My::id() . '_error', 'log_table' => My::id() . '_error',
]); ]);
@ -266,7 +263,7 @@ class Utils
private static function buid(): string private static function buid(): string
{ {
return md5(self::uid() . dcCore::app()->blog->uid); return md5(self::uid() . App::blog()->uid());
} }
private static function url(): string private static function url(): string
@ -278,7 +275,7 @@ class Utils
private static function clear(): void private static function clear(): void
{ {
$rs = dcCore::app()->log->getLogs([ App::log()->getLogs([
'log_table' => [ 'log_table' => [
My::id() . '_report', My::id() . '_report',
My::id() . '_error', My::id() . '_error',
@ -293,34 +290,34 @@ class Utils
while ($rs->fetch()) { while ($rs->fetch()) {
$logs[] = (int) $rs->f('log_id'); $logs[] = (int) $rs->f('log_id');
} }
dcCore::app()->log->delLogs($logs); App::log()->delLogs($logs);
} }
private static function error(string $message): void private static function error(string $message): void
{ {
self::clear(); self::clear();
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcLog::LOG_TABLE_NAME); $cur = App::log()->openLogCursor();
$cur->setField('log_table', My::id() . '_error'); $cur->setField('log_table', My::id() . '_error');
$cur->setField('log_msg', $message); $cur->setField('log_msg', $message);
dcCore::app()->log->addLog($cur); App::log()->addLog($cur);
} }
private static function write(string $contents): void private static function write(string $contents): void
{ {
self::clear(); self::clear();
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcLog::LOG_TABLE_NAME); $cur = App::log()->openLogCursor();
$cur->setField('log_table', My::id() . '_report'); $cur->setField('log_table', My::id() . '_report');
$cur->setField('log_msg', $contents); $cur->setField('log_msg', $contents);
dcCore::app()->log->addLog($cur); App::log()->addLog($cur);
} }
private static function read(): string private static function read(): string
{ {
$rs = dcCore::app()->log->getLogs([ App::log()->getLogs([
'log_table' => My::id() . '_report', 'log_table' => My::id() . '_report',
]); ]);
@ -329,7 +326,7 @@ class Utils
private static function expired(): bool private static function expired(): bool
{ {
$rs = dcCore::app()->log->getLogs([ App::log()->getLogs([
'log_table' => My::id() . '_report', 'log_table' => My::id() . '_report',
]); ]);
@ -345,11 +342,11 @@ class Utils
'plugins' => self::getPlugins(), // enabled plugins 'plugins' => self::getPlugins(), // enabled plugins
'themes' => self::getThemes(), // enabled themes 'themes' => self::getThemes(), // enabled themes
'blog' => [ 'blog' => [
'lang' => (string) dcCore::app()->blog->settings->get('system')->get('lang'), 'lang' => (string) App::blog()->settings()->get('system')->get('lang'),
'theme' => (string) dcCore::app()->blog->settings->get('system')->get('theme'), 'theme' => (string) App::blog()->settings()->get('system')->get('theme'),
], ],
'blogs' => [ 'blogs' => [
'count' => (int) dcCore::app()->getBlogs([], true)->f(0), 'count' => (int) App::blogs()->getBlogs([], true)->f(0),
], ],
'core' => [ 'core' => [
'version' => DC_VERSION, 'version' => DC_VERSION,
@ -364,8 +361,8 @@ class Utils
'version' => php_uname('r'), 'version' => php_uname('r'),
], ],
'database' => [ 'database' => [
'driver' => dcCore::app()->con->driver(), 'driver' => App::con()->driver(),
'version' => dcCore::app()->con->version(), 'version' => App::con()->version(),
], ],
], JSON_PRETTY_PRINT); ], JSON_PRETTY_PRINT);
} }