Compare commits

..

No commits in common. "master" and "v1.3" have entirely different histories.
master ... v1.3

6 changed files with 67 additions and 90 deletions

View File

@ -1,27 +1,3 @@
tinyPacker 1.4.3 - 2023.11.04
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1+
* Code review
tinyPacker 1.4.2 - 2023.10.20
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1+
* Code review
tinyPacker 1.4.1 - 2023.10.09
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1+
* Code review
tinyPacker 1.4 - 2023.10.07
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1
* Update to Dotclear 2.28
tinyPacker 1.3 - 2023.08.13 tinyPacker 1.3 - 2023.08.13
=========================================================== ===========================================================
* Require Dotclear 2.27 * Require Dotclear 2.27

View File

@ -1,23 +1,27 @@
# README # README
[![Release](https://img.shields.io/badge/release-1.4.3-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/tinyPacker/releases) [![Release](https://img.shields.io/badge/release-1.3-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/tinyPacker/releases)
![Date](https://img.shields.io/badge/date-2023.11.04-c44d58.svg) [![Date](https://img.shields.io/badge/date-2023.08.13-c44d58.svg)](https://git.dotclear.watch/JcDenis/tinyPacker/releases)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download) [![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/tinyPacker) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/tinyPacker)
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/tinyPacker/src/branch/master/LICENSE) [![License](https://img.shields.io/github/license/JcDenis/tinyPacker)](https://git.dotclear.watch/JcDenis/tinyPacker/blob/master/LICENSE)
## ABOUT ## WHAT IS tinyPacker ?
_tinyPacker_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org). _tinyPacker_ is a plugin for the open-source
web publishing software called Dotclear.
> One button packager for plugins and themes direct from Dotclear blog manager. It is a one button packager for plugins and theme
direct from Dotclear blog manager.
## REQUIREMENTS ## REQUIREMENTS
* Dotclear 2.28 _tinyPacker_ requires:
* PHP 8.1+
* System writable public directory * Super administrator permissions
* Dotlear super admin permissions * A writable public directory.
* Dotclear 2.27
* PHP 7.4+
## USAGE ## USAGE
@ -30,13 +34,12 @@ and it's pack into current blog public directory.
## MORE ## MORE
* [License](https://git.dotclear.watch/JcDenis/tinyPacker/src/branch/master/LICENSE) * License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* [Packages & details](https://git.dotclear.watch/JcDenis/tinyPacker/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/tinyPacker)) * Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/tinyPacker) or [GitHub Page](https://github.com/JcDenis/tinyPacker)
* [Sources & contributions](https://git.dotclear.watch/JcDenis/tinyPacker) (or on [GitHub](https://github.com/JcDenis/tinyPacker)) * Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/tinyPacker/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/tinyPacker)
* [Issues & security](https://git.dotclear.watch/JcDenis/tinyPacker/issues) (or on [GitHub](https://github.com/JcDenis/tinyPacker/issues))
## CONTRIBUTORS ## CONTRIBUTORS
* Jean-Christian Denis (author) * Jean-Christian Denis
You are welcome to contribute to this code. You are welcome to contribute to this code.

View File

@ -1,26 +1,27 @@
<?php <?php
/** /**
* @file * @brief tinyPacker, a plugin for Dotclear 2
* @brief The plugin tinyPacker definition
* @ingroup tinyPacker
* *
* @defgroup tinyPacker Plugin tinyPacker. * @package Dotclear
* @subpackage Plugin
* *
* Quick pack theme or plugin into public dir. * @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); if (!defined('DC_RC_PATH')) {
return null;
}
$this->registerModule( $this->registerModule(
'Tiny packer', 'Tiny packer',
'Quick pack theme or plugin into public dir', 'Quick pack theme or plugin into public dir',
'Jean-Christian Denis', 'Jean-Christian Denis',
'1.4.3', '1.3',
[ [
'requires' => [['core', '2.28']], 'requires' => [['core', '2.27']],
'permissions' => 'My', 'permissions' => null,
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues', 'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md', 'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',

View File

@ -2,11 +2,11 @@
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="tinyPacker"> <module id="tinyPacker">
<name>Tiny packer</name> <name>Tiny packer</name>
<version>1.4.3</version> <version>1.3</version>
<author>Jean-Christian Denis</author> <author>Jean-Christian Denis</author>
<desc>Quick pack theme or plugin into public dir</desc> <desc>Quick pack theme or plugin into public dir</desc>
<file>https://git.dotclear.watch/JcDenis/tinyPacker/releases/download/v1.4.3/plugin-tinyPacker.zip</file> <file>https://git.dotclear.watch/JcDenis/tinyPacker/releases/download/v1.3/plugin-tinyPacker.zip</file>
<da:dcmin>2.28</da:dcmin> <da:dcmin>2.27</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/tinyPacker/src/branch/master/README.md</da:details> <da:details>https://git.dotclear.watch/JcDenis/tinyPacker/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/tinyPacker/issues</da:support> <da:support>https://git.dotclear.watch/JcDenis/tinyPacker/issues</da:support>
</module> </module>

View File

@ -1,10 +1,20 @@
<?php <?php
/**
* @brief tinyPacker, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis
*
* @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\tinyPacker; namespace Dotclear\Plugin\tinyPacker;
use Dotclear\App; use dcCore;
use Dotclear\Core\Process; use Dotclear\Core\Process;
use Dotclear\Core\Backend\ModulesList; use Dotclear\Core\Backend\ModulesList;
use Dotclear\Core\Backend\Notices; use Dotclear\Core\Backend\Notices;
@ -17,13 +27,9 @@ use Dotclear\Helper\Network\Http;
use Exception; use Exception;
/** /**
* @brief tinyPacker admin class. * tinyPacker admin class.
* @ingroup tinyPacker
* *
* Add action and button to modules lists. * Add action and button to modules lists.
*
* @author Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
class Backend extends Process class Backend extends Process
{ {
@ -38,12 +44,12 @@ class Backend extends Process
return false; return false;
} }
App::behavior()->addBehaviors([ dcCore::app()->addBehaviors([
'adminModulesListGetActions' => function (ModulesList $list, string $id, array $_): string { 'adminModulesListGetActions' => function (ModulesList $list, string $id, array $_): string {
return in_array($list->getList(), [ return in_array($list->getList(), [
'plugin-activate', 'plugin-activate',
'theme-activate', 'theme-activate',
]) ? (new Submit([My::id() . '[' . Html::escapeHTML($id) . ']']))->__call('value', [__('Pack')])->render() : ''; ]) ? (new Submit([My::id() . '[' . Html::escapeHTML($id) . ']']))->value(__('Pack'))->render() : '';
}, },
'adminModulesListDoActions' => function (ModulesList $list, array $modules, string $type): void { 'adminModulesListDoActions' => function (ModulesList $list, array $modules, string $type): void {
# Pack action # Pack action
@ -54,7 +60,7 @@ class Backend extends Process
# Repository directory # Repository directory
$dir = (string) Path::real( $dir = (string) Path::real(
App::blog()->publicPath() . DIRECTORY_SEPARATOR . My::TINYPACKER_DIR, dcCore::app()->blog->public_path . DIRECTORY_SEPARATOR . My::TINYPACKER_DIR,
false false
); );
if (!empty($dir) && !is_dir($dir)) { if (!empty($dir) && !is_dir($dir)) {
@ -68,7 +74,7 @@ class Backend extends Process
$modules = array_keys($_POST[My::id()]); $modules = array_keys($_POST[My::id()]);
$id = $modules[0]; $id = $modules[0];
$module = $list->modules->getDefine((string) $id); $module = $list->modules->getDefine($id);
if (!$module->isDefined()) { if (!$module->isDefined()) {
throw new Exception(__('No such module.')); throw new Exception(__('No such module.'));
} }
@ -92,7 +98,7 @@ class Backend extends Process
)); ));
} }
$zip->addDirectory((string) Path::real($module->get('root')), (string) $id, true); $zip->addDirectory((string) Path::real($module->get('root')), $id, true);
$zip->write(); $zip->write();
$zip->close(); $zip->close();
unset($zip, $fp); unset($zip, $fp);

View File

@ -1,33 +1,28 @@
<?php <?php
/**
* @brief tinyPacker, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis
*
* @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\tinyPacker; namespace Dotclear\Plugin\tinyPacker;
use Dotclear\App; use dcCore;
use Dotclear\Module\MyPlugin; use Dotclear\Module\MyPlugin;
/**
* @brief tinyPacker My helper.
* @ingroup tinyPacker
*
* @author Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class My extends MyPlugin class My extends MyPlugin
{ {
/** /** @var string Public packages folder */
* Public packages folder.
*
* @var string TINYPACKER_DIR
*/
public const TINYPACKER_DIR = 'packages'; public const TINYPACKER_DIR = 'packages';
/** /** @var array Excluded files and dirs */
* Excluded files and dirs.
*
* @var array<int,string> TINYPACKER_EXCLUDE
*/
public const TINYPACKER_EXCLUDE = [ public const TINYPACKER_EXCLUDE = [
'\.', '\.',
'\.\.', '\.\.',
@ -44,10 +39,6 @@ class My extends MyPlugin
public static function checkCustomContext(int $context): ?bool public static function checkCustomContext(int $context): ?bool
{ {
return match ($context) { return defined('DC_CONTEXT_ADMIN') && dcCore::app()->auth->isSuperAdmin();
// Limit to super admin
self::MODULE => App::auth()->isSuperAdmin(),
default => null,
};
} }
} }