Compare commits
2 Commits
93ff904729
...
ef32e07197
Author | SHA1 | Date |
---|---|---|
Jean-Christian Paul Denis | ef32e07197 | |
Jean-Christian Paul Denis | 956da8a211 |
69
CHANGELOG.md
69
CHANGELOG.md
|
@ -1,34 +1,49 @@
|
|||
1.2 - 2023.07.30
|
||||
- require Dotclear 2.26
|
||||
- require PHP 7.4+
|
||||
- update to Dotclear 2.27-dev
|
||||
tinyPacker 1.3 - 2023.08.13
|
||||
===========================================================
|
||||
* Require Dotclear 2.27
|
||||
* Require PHP 7.4
|
||||
* Move third party repository
|
||||
* Use Dotclear style for CHANGELOG
|
||||
|
||||
1.1.1 - 2023..04.23
|
||||
- require Dotclear 2.26
|
||||
- use latest dotclear namespace
|
||||
- fix nullsafe warnings
|
||||
tinyPacker 1.2 - 2023.07.30
|
||||
===========================================================
|
||||
* require Dotclear 2.26
|
||||
* require PHP 7.4+
|
||||
* update to Dotclear 2.27-dev
|
||||
|
||||
1.1 - 2023.03.21
|
||||
- require Dotclear 2.26
|
||||
- use dcNsProcess
|
||||
- use new Zip Helper
|
||||
- use new Behaviors methods
|
||||
- add translation
|
||||
tinyPacker 1.1.1 - 2023..04.23
|
||||
===========================================================
|
||||
* require Dotclear 2.26
|
||||
* use latest dotclear namespace
|
||||
* fix nullsafe warnings
|
||||
|
||||
1.0 - 2022.12.23
|
||||
- use anonymous functions
|
||||
- use namesapce
|
||||
- use abstract plugin id
|
||||
tinyPacker 1.1 - 2023.03.21
|
||||
===========================================================
|
||||
* require Dotclear 2.26
|
||||
* use dcNsProcess
|
||||
* use new Zip Helper
|
||||
* use new Behaviors methods
|
||||
* add translation
|
||||
|
||||
0.5 - 2022.11.20
|
||||
- fix compatibility with Dotclear 2.24 (required)
|
||||
tinyPacker 1.0 - 2022.12.23
|
||||
===========================================================
|
||||
* use anonymous functions
|
||||
* use namesapce
|
||||
* use abstract plugin id
|
||||
|
||||
0.4 - 2021.09.02
|
||||
- clean up code
|
||||
- add dcstore.xml
|
||||
tinyPacker 0.5 - 2022.11.20
|
||||
===========================================================
|
||||
* fix compatibility with Dotclear 2.24 (required)
|
||||
|
||||
0.3 - 2021.08.18
|
||||
- cleaned code and adopt PSR2
|
||||
tinyPacker 0.4 - 2021.09.02
|
||||
===========================================================
|
||||
* clean up code
|
||||
* add dcstore.xml
|
||||
|
||||
0.1 - 2010.10.22
|
||||
- first version
|
||||
tinyPacker 0.3 - 2021.08.18
|
||||
===========================================================
|
||||
* cleaned code and adopt PSR2
|
||||
|
||||
tinyPacker 0.1 - 2010.10.22
|
||||
===========================================================
|
||||
* first version
|
17
README.md
17
README.md
|
@ -1,11 +1,10 @@
|
|||
# README
|
||||
|
||||
[![Release](https://img.shields.io/github/v/release/JcDenis/tinyPacker)](https://github.com/JcDenis/tinyPacker/releases)
|
||||
[![Date](https://img.shields.io/github/release-date/JcDenis/tinyPacker)](https://github.com/JcDenis/tinyPacker/releases)
|
||||
[![Issues](https://img.shields.io/github/issues/JcDenis/tinyPacker)](https://github.com/JcDenis/tinyPacker/issues)
|
||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-blue.svg)](https://fr.dotclear.org/download)
|
||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/tinyPacker)
|
||||
[![License](https://img.shields.io/github/license/JcDenis/tinyPacker)](https://github.com/JcDenis/tinyPacker/blob/master/LICENSE)
|
||||
[![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.08.13-c44d58.svg)](https://git.dotclear.watch/JcDenis/tinyPacker/releases)
|
||||
[![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)
|
||||
[![License](https://img.shields.io/github/license/JcDenis/tinyPacker)](https://git.dotclear.watch/JcDenis/tinyPacker/blob/master/LICENSE)
|
||||
|
||||
## WHAT IS tinyPacker ?
|
||||
|
||||
|
@ -35,9 +34,9 @@ and it's pack into current blog public directory.
|
|||
|
||||
## MORE
|
||||
|
||||
* License : GNU GPL v2
|
||||
* Source & contribution : [GitHub Page](https://github.com/JcDenis/tinyPacker)
|
||||
* Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/tinyPacker)
|
||||
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
||||
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/tinyPacker) or [GitHub Page](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)
|
||||
|
||||
## CONTRIBUTORS
|
||||
|
||||
|
|
|
@ -18,13 +18,13 @@ $this->registerModule(
|
|||
'Tiny packer',
|
||||
'Quick pack theme or plugin into public dir',
|
||||
'Jean-Christian Denis',
|
||||
'1.2',
|
||||
'1.3',
|
||||
[
|
||||
'requires' => [['core', '2.27']],
|
||||
'permissions' => null,
|
||||
'type' => 'plugin',
|
||||
'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
|
||||
'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
|
||||
'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
|
||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
||||
'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',
|
||||
]
|
||||
);
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
<modules xmlns:da="http://dotaddict.org/da/">
|
||||
<module id="tinyPacker">
|
||||
<name>Tiny packer</name>
|
||||
<version>1.2</version>
|
||||
<version>1.3</version>
|
||||
<author>Jean-Christian Denis</author>
|
||||
<desc>Quick pack theme or plugin into public dir</desc>
|
||||
<file>https://github.com/JcDenis/tinyPacker/releases/download/v1.2/plugin-tinyPacker.zip</file>
|
||||
<file>https://git.dotclear.watch/JcDenis/tinyPacker/releases/download/v1.3/plugin-tinyPacker.zip</file>
|
||||
<da:dcmin>2.27</da:dcmin>
|
||||
<da:details>https://plugins.dotaddict.org/dc2/details/tinyPacker</da:details>
|
||||
<da:support>https://github.com/JcDenis/tinyPacker</da:support>
|
||||
<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>
|
||||
</module>
|
||||
</modules>
|
||||
|
|
|
@ -33,27 +33,9 @@ use Exception;
|
|||
*/
|
||||
class Backend extends Process
|
||||
{
|
||||
/** @var string Public packages folder */
|
||||
public const TINYPACKER_DIR = 'packages';
|
||||
|
||||
/** @var array Excluded files and dirs */
|
||||
public const TINYPACKER_EXCLUDE = [
|
||||
'\.',
|
||||
'\.\.',
|
||||
'__MACOSX',
|
||||
'\.svn',
|
||||
'\.hg.*?',
|
||||
'\.git.*?',
|
||||
'CVS',
|
||||
'\.directory',
|
||||
'\.DS_Store',
|
||||
'Thumbs\.db',
|
||||
'_disabled',
|
||||
];
|
||||
|
||||
public static function init(): bool
|
||||
{
|
||||
return self::status(defined('DC_CONTEXT_ADMIN') && dcCore::app()->auth->isSuperAdmin());
|
||||
return self::status(My::checkContext(My::BACKEND));
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
|
@ -67,18 +49,18 @@ class Backend extends Process
|
|||
return in_array($list->getList(), [
|
||||
'plugin-activate',
|
||||
'theme-activate',
|
||||
]) ? (new Submit([self::id() . '[' . Html::escapeHTML($id) . ']']))->value(__('Pack'))->render() : '';
|
||||
]) ? (new Submit([My::id() . '[' . Html::escapeHTML($id) . ']']))->value(__('Pack'))->render() : '';
|
||||
},
|
||||
'adminModulesListDoActions' => function (ModulesList $list, array $modules, string $type): void {
|
||||
# Pack action
|
||||
if (empty($_POST[self::id()])
|
||||
|| !is_array($_POST[self::id()])) {
|
||||
if (empty($_POST[My::id()])
|
||||
|| !is_array($_POST[My::id()])) {
|
||||
return;
|
||||
}
|
||||
|
||||
# Repository directory
|
||||
$dir = (string) Path::real(
|
||||
dcCore::app()->blog->public_path . DIRECTORY_SEPARATOR . self::TINYPACKER_DIR,
|
||||
dcCore::app()->blog->public_path . DIRECTORY_SEPARATOR . My::TINYPACKER_DIR,
|
||||
false
|
||||
);
|
||||
if (!empty($dir) && !is_dir($dir)) {
|
||||
|
@ -89,7 +71,7 @@ class Backend extends Process
|
|||
}
|
||||
|
||||
# Module to pack
|
||||
$modules = array_keys($_POST[self::id()]);
|
||||
$modules = array_keys($_POST[My::id()]);
|
||||
$id = $modules[0];
|
||||
|
||||
$module = $list->modules->getDefine($id);
|
||||
|
@ -109,7 +91,7 @@ class Backend extends Process
|
|||
$fp = fopen($dir . DIRECTORY_SEPARATOR . $file, 'wb');
|
||||
$zip = new Zip($fp);
|
||||
|
||||
foreach (self::TINYPACKER_EXCLUDE as $e) {
|
||||
foreach (My::TINYPACKER_EXCLUDE as $e) {
|
||||
$zip->addExclusion(sprintf(
|
||||
'#(^|/)(%s)(/|$)#',
|
||||
$e
|
||||
|
@ -131,9 +113,4 @@ class Backend extends Process
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static function id(): string
|
||||
{
|
||||
return basename(dirname(__DIR__));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
<?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);
|
||||
|
||||
namespace Dotclear\Plugin\tinyPacker;
|
||||
|
||||
use dcCore;
|
||||
use Dotclear\Module\MyPlugin;
|
||||
|
||||
class My extends MyPlugin
|
||||
{
|
||||
/** @var string Public packages folder */
|
||||
public const TINYPACKER_DIR = 'packages';
|
||||
|
||||
/** @var array Excluded files and dirs */
|
||||
public const TINYPACKER_EXCLUDE = [
|
||||
'\.',
|
||||
'\.\.',
|
||||
'__MACOSX',
|
||||
'\.svn',
|
||||
'\.hg.*?',
|
||||
'\.git.*?',
|
||||
'CVS',
|
||||
'\.directory',
|
||||
'\.DS_Store',
|
||||
'Thumbs\.db',
|
||||
'_disabled',
|
||||
];
|
||||
|
||||
public static function checkCustomContext(int $context): ?bool
|
||||
{
|
||||
return defined('DC_CONTEXT_ADMIN') && dcCore::app()->auth->isSuperAdmin();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue