release 1.7.1
This commit is contained in:
parent
f96aec632d
commit
e081dcc165
9 changed files with 109 additions and 83 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
dcLog 1.7.1 - 2023.10.11
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1
|
||||||
|
* Code review
|
||||||
|
|
||||||
dcLog 1.7 - 2023.10.07
|
dcLog 1.7 - 2023.10.07
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.28
|
* Require Dotclear 2.28
|
||||||
|
|
|
@ -36,6 +36,6 @@ Once it's done you can manage your logs from menu
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
* Tomtom (author)
|
* Tomtom (author)
|
||||||
* Jean-Christian Denis
|
* Jean-Christian Denis (latest)
|
||||||
|
|
||||||
You are welcome to contribute to this code.
|
You are welcome to contribute to this code.
|
||||||
|
|
23
_define.php
23
_define.php
|
@ -1,29 +1,26 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief dcLog, a plugin for Dotclear 2
|
* @file
|
||||||
|
* @brief The plugin dcLog definition
|
||||||
|
* @ingroup dcLog
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @defgroup dcLog Plugin dcLog.
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
*
|
||||||
* @author Tomtom and Contributors
|
* Displays Dotclear logs.
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @author Tomtom (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
if (!defined('DC_RC_PATH')) {
|
declare(strict_types=1);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
"Dotclear's logs",
|
"Dotclear's logs",
|
||||||
'Displays Dotclear logs',
|
'Displays Dotclear logs',
|
||||||
'Tomtom and Contributors',
|
'Tomtom and Contributors',
|
||||||
'1.7',
|
'1.7.1',
|
||||||
[
|
[
|
||||||
'requires' => [
|
'requires' => [['core', '2.28']],
|
||||||
['php', '8.1'],
|
|
||||||
['core', '2.28'],
|
|
||||||
],
|
|
||||||
'permissions' => null,
|
'permissions' => null,
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="dcLog">
|
<module id="dcLog">
|
||||||
<name>Dotclear's logs</name>
|
<name>Dotclear's logs</name>
|
||||||
<version>1.7</version>
|
<version>1.7.1</version>
|
||||||
<author>Tomtom and Contributors</author>
|
<author>Tomtom and Contributors</author>
|
||||||
<desc>Displays Dotclear logs</desc>
|
<desc>Displays Dotclear logs</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/dcLog/releases/download/v1.7/plugin-dcLog.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/dcLog/releases/download/v1.7.1/plugin-dcLog.zip</file>
|
||||||
<da:dcmin>2.28</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/dcLog/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/dcLog/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/dcLog/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/dcLog/issues</da:support>
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief dcLog, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Tomtom and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian 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\dcLog;
|
namespace Dotclear\Plugin\dcLog;
|
||||||
|
@ -18,8 +8,15 @@ use ArrayObject;
|
||||||
use Dotclear\App;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Core\Backend\Favorites;
|
use Dotclear\Core\Backend\Favorites;
|
||||||
use Dotclear\Core\Backend\Menus;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief dcLog backend class.
|
||||||
|
* @ingroup dcLog
|
||||||
|
*
|
||||||
|
* @author Tomtom (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @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
|
||||||
|
@ -33,7 +30,7 @@ class Backend extends Process
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
My::addBackendMenuItem(Menus::MENU_SYSTEM);
|
My::addBackendMenuItem(App::backend()->menus::MENU_SYSTEM);
|
||||||
|
|
||||||
App::behavior()->addBehaviors([
|
App::behavior()->addBehaviors([
|
||||||
// backend user preference for logs list columns
|
// backend user preference for logs list columns
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief dcLog, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Tomtom and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian 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\dcLog;
|
namespace Dotclear\Plugin\dcLog;
|
||||||
|
@ -30,7 +20,12 @@ use Dotclear\Helper\Html\Form\{
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backend logs list helper.
|
* @brief dcLog logs list class.
|
||||||
|
* @ingroup dcLog
|
||||||
|
*
|
||||||
|
* @author Tomtom (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
class BackendList extends Listing
|
class BackendList extends Listing
|
||||||
{
|
{
|
||||||
|
@ -53,7 +48,7 @@ class BackendList extends Listing
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pager = new Pager($page, $this->rs_count, $nb_per_page, 10);
|
$pager = new Pager($page, (int) $this->rs_count, $nb_per_page, 10);
|
||||||
|
|
||||||
$cols = new ArrayObject([
|
$cols = new ArrayObject([
|
||||||
'date' => (new Text('th', __('Date')))
|
'date' => (new Text('th', __('Date')))
|
||||||
|
@ -74,7 +69,7 @@ class BackendList extends Listing
|
||||||
|
|
||||||
$lines = [];
|
$lines = [];
|
||||||
while ($this->rs->fetch()) {
|
while ($this->rs->fetch()) {
|
||||||
$lines[] = $this->line(isset($_POST['entries']) && in_array($this->rs->log_id, $_POST['entries']));
|
$lines[] = $this->line(isset($_POST['entries']) && in_array($this->rs->f('log_id'), $_POST['entries']));
|
||||||
}
|
}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
@ -115,25 +110,25 @@ class BackendList extends Listing
|
||||||
->class('nowrap minimal')
|
->class('nowrap minimal')
|
||||||
->items([
|
->items([
|
||||||
(new Checkbox(['entries[]'], $checked))
|
(new Checkbox(['entries[]'], $checked))
|
||||||
->value($this->rs->log_id),
|
->value($this->rs->f('log_id')),
|
||||||
]),
|
]),
|
||||||
'date' => (new Text('td', Html::escapeHTML(Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->log_dt))))
|
'date' => (new Text('td', Html::escapeHTML(Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->f('log_dt')))))
|
||||||
->class('nowrap minimal'),
|
->class('nowrap minimal'),
|
||||||
'msg' => (new Text('td', nl2br(Html::escapeHTML($this->rs->log_msg))))
|
'msg' => (new Text('td', nl2br(Html::escapeHTML($this->rs->f('log_msg')))))
|
||||||
->class('maximal'),
|
->class('maximal'),
|
||||||
'blog' => (new Text('td', Html::escapeHTML($this->rs->blog_id)))
|
'blog' => (new Text('td', Html::escapeHTML($this->rs->f('blog_id'))))
|
||||||
->class('nowrap minimal'),
|
->class('nowrap minimal'),
|
||||||
'table' => (new Text('td', Html::escapeHTML($this->rs->log_table)))
|
'table' => (new Text('td', Html::escapeHTML($this->rs->f('log_table'))))
|
||||||
->class('nowrap minimal'),
|
->class('nowrap minimal'),
|
||||||
'user' => (new Text('td', Html::escapeHTML($this->rs->getUserCN())))
|
'user' => (new Text('td', Html::escapeHTML($this->rs->getUserCN())))
|
||||||
->class('nowrap minimal'),
|
->class('nowrap minimal'),
|
||||||
'ip' => (new Text('td', Html::escapeHTML($this->rs->log_ip)))
|
'ip' => (new Text('td', Html::escapeHTML($this->rs->f('log_ip'))))
|
||||||
->class('nowrap minimal'),
|
->class('nowrap minimal'),
|
||||||
]);
|
]);
|
||||||
$this->userColumns(My::BACKEND_LIST_ID, $cols);
|
$this->userColumns(My::BACKEND_LIST_ID, $cols);
|
||||||
|
|
||||||
return
|
return
|
||||||
(new Para('p' . $this->rs->log_id, 'tr'))
|
(new Para('p' . $this->rs->f('log_id'), 'tr'))
|
||||||
->class('line')
|
->class('line')
|
||||||
->items(iterator_to_array($cols));
|
->items(iterator_to_array($cols));
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,12 @@ use Dotclear\Helper\Html\Form\{
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage logs list
|
* @brief dcLog manage class.
|
||||||
|
* @ingroup dcLog
|
||||||
|
*
|
||||||
|
* @author Tomtom (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
class Manage extends Process
|
class Manage extends Process
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief dcLog, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Tomtom and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian 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\dcLog;
|
namespace Dotclear\Plugin\dcLog;
|
||||||
|
@ -23,29 +13,62 @@ use Dotclear\Database\MetaRecord;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backend logs manage page vars container.
|
* @brief dcLog properties helper.
|
||||||
|
* @ingroup dcLog
|
||||||
|
*
|
||||||
|
* @author Tomtom (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
class ManageVars
|
class ManageVars
|
||||||
{
|
{
|
||||||
/** @var ManageVars $container self instance */
|
/**
|
||||||
|
* ManageVars instance.
|
||||||
|
*
|
||||||
|
* @var ManageVars $container
|
||||||
|
*/
|
||||||
private static $container;
|
private static $container;
|
||||||
|
|
||||||
/** @var Filters $filter The filter instance */
|
/**
|
||||||
|
* The filter instance.
|
||||||
|
*
|
||||||
|
* @var Filters $filter
|
||||||
|
*/
|
||||||
public readonly Filters $filter;
|
public readonly Filters $filter;
|
||||||
|
|
||||||
/** @var null|MetaRecord $logs The current records */
|
/**
|
||||||
|
* The current records.
|
||||||
|
*
|
||||||
|
* @var null|MetaRecord $logs
|
||||||
|
*/
|
||||||
public readonly ?MetaRecord $logs;
|
public readonly ?MetaRecord $logs;
|
||||||
|
|
||||||
/** @var null|BackendList $list The records list form instance */
|
/**
|
||||||
|
* The records list form instance.
|
||||||
|
*
|
||||||
|
* @var null|BackendList $list
|
||||||
|
*/
|
||||||
public readonly ?BackendList $list;
|
public readonly ?BackendList $list;
|
||||||
|
|
||||||
/** @var array<int,string> $entries The post form selected entries */
|
/**
|
||||||
|
* The post form selected entries.
|
||||||
|
*
|
||||||
|
* @var array<int,string> $entries
|
||||||
|
*/
|
||||||
public readonly array $entries;
|
public readonly array $entries;
|
||||||
|
|
||||||
/** @var bool $selected_logs The post form action */
|
/**
|
||||||
|
* The post form action.
|
||||||
|
*
|
||||||
|
* @var bool $selected_logs
|
||||||
|
*/
|
||||||
public readonly bool $selected_logs;
|
public readonly bool $selected_logs;
|
||||||
|
|
||||||
/** @var bool $all_logs The post form action */
|
/**
|
||||||
|
* The post form action.
|
||||||
|
*
|
||||||
|
* @var bool $all_logs
|
||||||
|
*/
|
||||||
public readonly bool $all_logs;
|
public readonly bool $all_logs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
27
src/My.php
27
src/My.php
|
@ -1,15 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief dcLog, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Tomtom and Contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian 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\dcLog;
|
namespace Dotclear\Plugin\dcLog;
|
||||||
|
@ -17,13 +7,26 @@ namespace Dotclear\Plugin\dcLog;
|
||||||
use Dotclear\App;
|
use Dotclear\App;
|
||||||
use Dotclear\Module\MyPlugin;
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief dcLog My helper.
|
||||||
|
* @ingroup dcLog
|
||||||
|
*
|
||||||
|
* @author Tomtom (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class My extends MyPlugin
|
class My extends MyPlugin
|
||||||
{
|
{
|
||||||
/** @var string Admin list ID */
|
/**
|
||||||
|
* Admin list ID.
|
||||||
|
*
|
||||||
|
* @var string BACKEND_LIST_ID
|
||||||
|
*/
|
||||||
public const BACKEND_LIST_ID = 'dcloglist';
|
public const BACKEND_LIST_ID = 'dcloglist';
|
||||||
|
|
||||||
public static function checkCustomContext(int $context): ?bool
|
public static function checkCustomContext(int $context): ?bool
|
||||||
{
|
{
|
||||||
|
// Limit module to super admin
|
||||||
return App::auth()->isSuperAdmin();
|
return App::auth()->isSuperAdmin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue