Compare commits
No commits in common. "ef32e07197e516b6d9c451ccb0ecebad8c92850f" and "93ff90472913d73a8e69a327da44c29efde45de6" have entirely different histories.
ef32e07197
...
93ff904729
69
CHANGELOG.md
69
CHANGELOG.md
|
@ -1,49 +1,34 @@
|
|||
tinyPacker 1.3 - 2023.08.13
|
||||
===========================================================
|
||||
* Require Dotclear 2.27
|
||||
* Require PHP 7.4
|
||||
* Move third party repository
|
||||
* Use Dotclear style for CHANGELOG
|
||||
1.2 - 2023.07.30
|
||||
- require Dotclear 2.26
|
||||
- require PHP 7.4+
|
||||
- update to Dotclear 2.27-dev
|
||||
|
||||
tinyPacker 1.2 - 2023.07.30
|
||||
===========================================================
|
||||
* require Dotclear 2.26
|
||||
* require PHP 7.4+
|
||||
* update to Dotclear 2.27-dev
|
||||
1.1.1 - 2023..04.23
|
||||
- require Dotclear 2.26
|
||||
- use latest dotclear namespace
|
||||
- fix nullsafe warnings
|
||||
|
||||
tinyPacker 1.1.1 - 2023..04.23
|
||||
===========================================================
|
||||
* require Dotclear 2.26
|
||||
* use latest dotclear namespace
|
||||
* fix nullsafe warnings
|
||||
1.1 - 2023.03.21
|
||||
- require Dotclear 2.26
|
||||
- use dcNsProcess
|
||||
- use new Zip Helper
|
||||
- use new Behaviors methods
|
||||
- add translation
|
||||
|
||||
tinyPacker 1.1 - 2023.03.21
|
||||
===========================================================
|
||||
* require Dotclear 2.26
|
||||
* use dcNsProcess
|
||||
* use new Zip Helper
|
||||
* use new Behaviors methods
|
||||
* add translation
|
||||
1.0 - 2022.12.23
|
||||
- use anonymous functions
|
||||
- use namesapce
|
||||
- use abstract plugin id
|
||||
|
||||
tinyPacker 1.0 - 2022.12.23
|
||||
===========================================================
|
||||
* use anonymous functions
|
||||
* use namesapce
|
||||
* use abstract plugin id
|
||||
0.5 - 2022.11.20
|
||||
- fix compatibility with Dotclear 2.24 (required)
|
||||
|
||||
tinyPacker 0.5 - 2022.11.20
|
||||
===========================================================
|
||||
* fix compatibility with Dotclear 2.24 (required)
|
||||
0.4 - 2021.09.02
|
||||
- clean up code
|
||||
- add dcstore.xml
|
||||
|
||||
tinyPacker 0.4 - 2021.09.02
|
||||
===========================================================
|
||||
* clean up code
|
||||
* add dcstore.xml
|
||||
0.3 - 2021.08.18
|
||||
- cleaned code and adopt PSR2
|
||||
|
||||
tinyPacker 0.3 - 2021.08.18
|
||||
===========================================================
|
||||
* cleaned code and adopt PSR2
|
||||
|
||||
tinyPacker 0.1 - 2010.10.22
|
||||
===========================================================
|
||||
* first version
|
||||
0.1 - 2010.10.22
|
||||
- first version
|
17
README.md
17
README.md
|
@ -1,10 +1,11 @@
|
|||
# README
|
||||
|
||||
[![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)
|
||||
[![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)
|
||||
|
||||
## WHAT IS tinyPacker ?
|
||||
|
||||
|
@ -34,9 +35,9 @@ and it's pack into current blog public directory.
|
|||
|
||||
## MORE
|
||||
|
||||
* 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)
|
||||
* License : GNU GPL v2
|
||||
* Source & contribution : [GitHub Page](https://github.com/JcDenis/tinyPacker)
|
||||
* Packages & details : [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.3',
|
||||
'1.2',
|
||||
[
|
||||
'requires' => [['core', '2.27']],
|
||||
'permissions' => null,
|
||||
'type' => 'plugin',
|
||||
'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',
|
||||
'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',
|
||||
]
|
||||
);
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
<modules xmlns:da="http://dotaddict.org/da/">
|
||||
<module id="tinyPacker">
|
||||
<name>Tiny packer</name>
|
||||
<version>1.3</version>
|
||||
<version>1.2</version>
|
||||
<author>Jean-Christian Denis</author>
|
||||
<desc>Quick pack theme or plugin into public dir</desc>
|
||||
<file>https://git.dotclear.watch/JcDenis/tinyPacker/releases/download/v1.3/plugin-tinyPacker.zip</file>
|
||||
<file>https://github.com/JcDenis/tinyPacker/releases/download/v1.2/plugin-tinyPacker.zip</file>
|
||||
<da:dcmin>2.27</da:dcmin>
|
||||
<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:details>https://plugins.dotaddict.org/dc2/details/tinyPacker</da:details>
|
||||
<da:support>https://github.com/JcDenis/tinyPacker</da:support>
|
||||
</module>
|
||||
</modules>
|
||||
|
|
|
@ -33,9 +33,27 @@ 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(My::checkContext(My::BACKEND));
|
||||
return self::status(defined('DC_CONTEXT_ADMIN') && dcCore::app()->auth->isSuperAdmin());
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
|
@ -49,18 +67,18 @@ class Backend extends Process
|
|||
return in_array($list->getList(), [
|
||||
'plugin-activate',
|
||||
'theme-activate',
|
||||
]) ? (new Submit([My::id() . '[' . Html::escapeHTML($id) . ']']))->value(__('Pack'))->render() : '';
|
||||
]) ? (new Submit([self::id() . '[' . Html::escapeHTML($id) . ']']))->value(__('Pack'))->render() : '';
|
||||
},
|
||||
'adminModulesListDoActions' => function (ModulesList $list, array $modules, string $type): void {
|
||||
# Pack action
|
||||
if (empty($_POST[My::id()])
|
||||
|| !is_array($_POST[My::id()])) {
|
||||
if (empty($_POST[self::id()])
|
||||
|| !is_array($_POST[self::id()])) {
|
||||
return;
|
||||
}
|
||||
|
||||
# Repository directory
|
||||
$dir = (string) Path::real(
|
||||
dcCore::app()->blog->public_path . DIRECTORY_SEPARATOR . My::TINYPACKER_DIR,
|
||||
dcCore::app()->blog->public_path . DIRECTORY_SEPARATOR . self::TINYPACKER_DIR,
|
||||
false
|
||||
);
|
||||
if (!empty($dir) && !is_dir($dir)) {
|
||||
|
@ -71,7 +89,7 @@ class Backend extends Process
|
|||
}
|
||||
|
||||
# Module to pack
|
||||
$modules = array_keys($_POST[My::id()]);
|
||||
$modules = array_keys($_POST[self::id()]);
|
||||
$id = $modules[0];
|
||||
|
||||
$module = $list->modules->getDefine($id);
|
||||
|
@ -91,7 +109,7 @@ class Backend extends Process
|
|||
$fp = fopen($dir . DIRECTORY_SEPARATOR . $file, 'wb');
|
||||
$zip = new Zip($fp);
|
||||
|
||||
foreach (My::TINYPACKER_EXCLUDE as $e) {
|
||||
foreach (self::TINYPACKER_EXCLUDE as $e) {
|
||||
$zip->addExclusion(sprintf(
|
||||
'#(^|/)(%s)(/|$)#',
|
||||
$e
|
||||
|
@ -113,4 +131,9 @@ class Backend extends Process
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static function id(): string
|
||||
{
|
||||
return basename(dirname(__DIR__));
|
||||
}
|
||||
}
|
||||
|
|
44
src/My.php
44
src/My.php
|
@ -1,44 +0,0 @@
|
|||
<?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