Compare commits

..

4 Commits

15 changed files with 113 additions and 77 deletions

View File

@ -1,3 +1,16 @@
pacKman 2023.11.04
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1+
* Fix typo
* Code review
pacKman 2023.10.19
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1+
* cosmetic code review
pacKman 2023.10.13 pacKman 2023.10.13
=========================================================== ===========================================================
* Require Dotclear 2.28 * Require Dotclear 2.28

View File

@ -1,7 +1,7 @@
# README # README
[![Release](https://img.shields.io/badge/release-2023.10.13-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/pacKman/releases) [![Release](https://img.shields.io/badge/release-2023.11.04-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/pacKman/releases)
![Date](https://img.shields.io/badge/date-2023.10.13-c44d58.svg) ![Date](https://img.shields.io/badge/date-2023.11.04-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/pacKman) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/pacKman)
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/pacKman/src/branch/master/LICENSE) [![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/pacKman/src/branch/master/LICENSE)
@ -16,9 +16,9 @@ _pacKman_ is a plugin for the open-source web publishing software called [Dotcle
* Dotclear 2.28 * Dotclear 2.28
* PHP 8.1+ * PHP 8.1+
* Super administrator permissions * Dotclear super administrator permissions
* A writable cache directory * System writable cache directory
* A writable directory to put packages. (can be VAR dir) * System writable directory to put packages. (can be VAR dir)
## USAGE ## USAGE
@ -37,11 +37,11 @@ Once it's done you can manage your packages from menu
* [Packages & details](https://git.dotclear.watch/JcDenis/pacKman/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/pacKman)) * [Packages & details](https://git.dotclear.watch/JcDenis/pacKman/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/pacKman))
* [Sources & contributions](https://git.dotclear.watch/JcDenis/pacKman) (or on [GitHub](https://github.com/JcDenis/pacKman)) * [Sources & contributions](https://git.dotclear.watch/JcDenis/pacKman) (or on [GitHub](https://github.com/JcDenis/pacKman))
* [Issues & security](https://git.dotclear.watch/JcDenis/pacKman/issues) (or on [GitHub](https://github.com/JcDenis/pacKman/issues)) * [Issues & security](https://git.dotclear.watch/JcDenis/pacKman/issues) (or on [GitHub](https://github.com/JcDenis/pacKman/issues))
* [Discuss and help](https://forum.dotclear.org/viewtopic.php?id=40066) * [Discuss & help](https://forum.dotclear.org/viewtopic.php?id=40066)
## CONTRIBUTORS ## CONTRIBUTORS
* Jean-Christian Denis * Jean-Christian Denis (author)
* Philippe aka Dissitou * Philippe aka Dissitou
* franck-paul * franck-paul

View File

@ -9,7 +9,6 @@
* Manage your Dotclear packages. * Manage your Dotclear packages.
* *
* @author Jean-Christian 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); declare(strict_types=1);
@ -18,12 +17,13 @@ $this->registerModule(
'Packages repository', 'Packages repository',
'Manage your Dotclear packages', 'Manage your Dotclear packages',
'Jean-Christian Denis', 'Jean-Christian Denis',
'2023.10.13', '2023.11.04',
[ [
'requires' => [['core', '2.28']], 'requires' => [['core', '2.28']],
'type' => 'plugin', 'permissions' => 'My',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues', 'type' => 'plugin',
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md', 'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml', 'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
] ]
); );

View File

@ -2,10 +2,10 @@
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="pacKman"> <module id="pacKman">
<name>Packages repository</name> <name>Packages repository</name>
<version>2023.10.13</version> <version>2023.11.04</version>
<author>Jean-Christian Denis</author> <author>Jean-Christian Denis</author>
<desc>Manage your Dotclear packages</desc> <desc>Manage your Dotclear packages</desc>
<file>https://git.dotclear.watch/JcDenis/pacKman/releases/download/v2023.10.13/plugin-pacKman.zip</file> <file>https://git.dotclear.watch/JcDenis/pacKman/releases/download/v2023.11.04/plugin-pacKman.zip</file>
<da:dcmin>2.28</da:dcmin> <da:dcmin>2.28</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/pacKman/src/branch/master/README.md</da:details> <da:details>https://git.dotclear.watch/JcDenis/pacKman/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/pacKman/issues</da:support> <da:support>https://git.dotclear.watch/JcDenis/pacKman/issues</da:support>

View File

@ -1,19 +1,10 @@
<?php <?php
/** /**
* @brief pacKman, a plugin for Dotclear 2 * @file
* @brief The plugin pacKman locales resources
* @ingroup pacKman
* *
* @package Dotclear * @author Jean-Christian Denis
* @subpackage Plugin * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*
* @author Jean-Christian Denis
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
if (!defined('DC_RC_PATH')) { \Dotclear\App::backend()->resources()->set('help', 'pacKman', __DIR__ . '/help/help.html');
return null;
}
if (!isset(dcCore::app()->resources['help']['pacKman'])) {
dcCore::app()->resources['help']['pacKman'] = __DIR__ . '/help/help.html';
}

View File

@ -9,11 +9,10 @@ use Dotclear\Core\Process;
use Dotclear\Core\Backend\Favorites; use Dotclear\Core\Backend\Favorites;
/** /**
* @brief pacKman backend class. * @brief pacKman backend class.
* @ingroup pacKman * @ingroup pacKman
* *
* @author Jean-Christian 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
*/ */
class Backend extends Process class Backend extends Process

View File

@ -21,11 +21,10 @@ use Dotclear\Helper\Html\Form\{
use Exception; use Exception;
/** /**
* @brief pacKman configuration class. * @brief pacKman configuration class.
* @ingroup pacKman * @ingroup pacKman
* *
* @author Jean-Christian 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
*/ */
class Config extends Process class Config extends Process
@ -112,7 +111,7 @@ class Config extends Process
// pack_repository // pack_repository
(new Para())->items([ (new Para())->items([
(new Label($check_repo . __('Path to repository:')))->for('pack_repository'), (new Label($check_repo . __('Path to repository:')))->for('pack_repository'),
(new Input('pack_repository'))->class('maximal')->size(65)->maxlenght(255)->value($s->pack_repository), (new Input('pack_repository'))->class('maximal')->size(65)->maxlength(255)->value($s->pack_repository),
]), ]),
(new Note())->class('form-note')->text( (new Note())->class('form-note')->text(
sprintf( sprintf(
@ -132,13 +131,13 @@ class Config extends Process
// pack_filename // pack_filename
(new Para())->items([ (new Para())->items([
(new Label($check_first . __('Name of exported package:')))->for('pack_filename'), (new Label($check_first . __('Name of exported package:')))->for('pack_filename'),
(new Input('pack_filename'))->class('maximal')->size(65)->maxlenght(255)->value($s->pack_filename), (new Input('pack_filename'))->class('maximal')->size(65)->maxlength(255)->value($s->pack_filename),
]), ]),
(new Note())->text(sprintf(__('Preconization: %s'), '%type%-%id%'))->class('form-note'), (new Note())->text(sprintf(__('Preconization: %s'), '%type%-%id%'))->class('form-note'),
// secondpack_filename // secondpack_filename
(new Para())->items([ (new Para())->items([
(new Label($check_second . __('Name of second exported package:')))->for('secondpack_filename'), (new Label($check_second . __('Name of second exported package:')))->for('secondpack_filename'),
(new Input('secondpack_filename'))->class('maximal')->size(65)->maxlenght(255)->value($s->secondpack_filename), (new Input('secondpack_filename'))->class('maximal')->size(65)->maxlength(255)->value($s->secondpack_filename),
]), ]),
(new Note())->text(sprintf(__('Preconization: %s'), '%type%-%id%-%version%'))->class('form-note'), (new Note())->text(sprintf(__('Preconization: %s'), '%type%-%id%-%version%'))->class('form-note'),
// pack_overwrite // pack_overwrite
@ -151,7 +150,7 @@ class Config extends Process
// pack_excludefiles // pack_excludefiles
(new Para())->items([ (new Para())->items([
(new Label(__('Extra files to exclude from package:')))->for('pack_excludefiles'), (new Label(__('Extra files to exclude from package:')))->for('pack_excludefiles'),
(new Input('pack_excludefiles'))->class('maximal')->size(65)->maxlenght(255)->value($s->pack_excludefiles), (new Input('pack_excludefiles'))->class('maximal')->size(65)->maxlength(255)->value($s->pack_excludefiles),
]), ]),
(new Note())->text(sprintf(__('Preconization: %s'), '*.zip,*.tar,*.tar.gz'))->class('form-note'), (new Note())->text(sprintf(__('Preconization: %s'), '*.zip,*.tar,*.tar.gz'))->class('form-note'),
// pack_nocomment // pack_nocomment

View File

@ -12,11 +12,10 @@ use Dotclear\Module\ModuleDefine;
use Exception; use Exception;
/** /**
* @brief pacKman main class. * @brief pacKman main class.
* @ingroup pacKman * @ingroup pacKman
* *
* @author Jean-Christian 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
*/ */
class Core class Core

View File

@ -9,11 +9,10 @@ use Dotclear\Core\Process;
use Exception; use Exception;
/** /**
* @brief pacKman install class. * @brief pacKman install class.
* @ingroup pacKman * @ingroup pacKman
* *
* @author Jean-Christian 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
*/ */
class Install extends Process class Install extends Process

View File

@ -19,11 +19,10 @@ use Dotclear\Helper\Network\Http;
use Exception; use Exception;
/** /**
* @brief pacKman manage page class. * @brief pacKman manage page class.
* @ingroup pacKman * @ingroup pacKman
* *
* @author Jean-Christian 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
*/ */
class Manage extends Process class Manage extends Process

View File

@ -8,11 +8,10 @@ use Dotclear\App;
use Dotclear\Module\MyPlugin; use Dotclear\Module\MyPlugin;
/** /**
* @brief pacKman My plugin helper. * @brief pacKman My plugin helper.
* @ingroup pacKman * @ingroup pacKman
* *
* @author Jean-Christian 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
*/ */
class My extends MyPlugin class My extends MyPlugin
@ -37,7 +36,10 @@ class My extends MyPlugin
public static function checkCustomContext(int $context): ?bool public static function checkCustomContext(int $context): ?bool
{ {
// Only backend and super admin return match ($context) {
return $context === self::INSTALL ? null : App::task()->checkContext('BACKEND') && App::auth()->isSuperAdmin(); // Limit to super admin
self::MODULE => App::auth()->isSuperAdmin(),
default => null,
};
} }
} }

View File

@ -5,40 +5,75 @@ declare(strict_types=1);
namespace Dotclear\Plugin\pacKman; namespace Dotclear\Plugin\pacKman;
/** /**
* @brief pacKman settings class. * @brief pacKman settings class.
* @ingroup pacKman * @ingroup pacKman
* *
* @author Jean-Christian 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
*/ */
class Settings class Settings
{ {
// Remove comments from files /**
* Remove comments from files.
*
* @var bool $pack_nocomment
*/
public readonly bool $pack_nocomment; public readonly bool $pack_nocomment;
// Remove comments from files /**
* Remove comments from files.
*
* @var bool $pack_fixnewline
*/
public readonly bool $pack_fixnewline; public readonly bool $pack_fixnewline;
// Overwrite existing package /**
* Overwrite existing package.
*
* @var bool $pack_overwrite
*/
public readonly bool $pack_overwrite; public readonly bool $pack_overwrite;
// Name of package /**
* Name of package.
*
* @var string $pack_filename
*/
public readonly string $pack_filename; public readonly string $pack_filename;
// Name of second package /**
* Name of second package.
*
* @var string $secondpack_filename
*/
public readonly string $secondpack_filename; public readonly string $secondpack_filename;
// Path to package repository /**
* Path to package repository.
*
* @var string $pack_repository
*/
public readonly string $pack_repository; public readonly string $pack_repository;
// Seperate themes and plugins repository /**
* Seperate themes and plugins repository.
*
* @var bool $pack_typedrepo
*/
public readonly bool $pack_typedrepo; public readonly bool $pack_typedrepo;
// Extra files to exclude from package /**
* Extra files to exclude from package.
*
* @var string $pack_excludefiles
*/
public readonly string $pack_excludefiles; public readonly string $pack_excludefiles;
// Hide distributed modules from lists /**
* Hide distributed modules from lists.
*
* @var bool $hide_distrib
*/
public readonly bool $hide_distrib; public readonly bool $hide_distrib;
/** /**

View File

@ -8,11 +8,10 @@ use Dotclear\Core\Process;
use Dotclear\Plugin\Uninstaller\Uninstaller; use Dotclear\Plugin\Uninstaller\Uninstaller;
/** /**
* @brief pacKman Uninstaller class. * @brief pacKman Uninstaller class.
* @ingroup pacKman * @ingroup pacKman
* *
* @author Jean-Christian 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
*/ */
class Uninstall extends Process class Uninstall extends Process

View File

@ -25,11 +25,10 @@ use Dotclear\Module\ModuleDefine;
use Exception; use Exception;
/** /**
* @brief pacKman utils class. * @brief pacKman utils class.
* @ingroup pacKman * @ingroup pacKman
* *
* @author Jean-Christian 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
*/ */
class Utils class Utils
@ -99,7 +98,7 @@ class Utils
/** /**
* Get modules list form. * Get modules list form.
* *
* @param array<int,ModuleDefine> $modules The modules * @param array<int|string, mixed> $modules The modules
* @param string $type The modules type * @param string $type The modules type
* @param string $title The list title * @param string $title The list title
* *
@ -117,6 +116,9 @@ class Utils
$tbody = []; $tbody = [];
self::sort($modules); self::sort($modules);
foreach ($modules as $module) { foreach ($modules as $module) {
if (!is_a($module, ModuleDefine::class)) {
continue;
}
$tbody[] = (new Para(null, 'tr')) $tbody[] = (new Para(null, 'tr'))
->class('line') ->class('line')
->items([ ->items([

View File

@ -5,14 +5,13 @@ declare(strict_types=1);
namespace Dotclear\Plugin\pacKman; namespace Dotclear\Plugin\pacKman;
/** /**
* @brief pacKman zip class. * @brief pacKman zip class.
* @ingroup pacKman * @ingroup pacKman
* *
* This class extends dotclear zip class * This class extends dotclear zip class
* to tweak writeFile method. * to tweak writeFile method.
* *
* @author Jean-Christian 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
*/ */
class Zip extends \Dotclear\Helper\File\Zip\Zip class Zip extends \Dotclear\Helper\File\Zip\Zip