release 0.5

This commit is contained in:
Jean-Christian Paul Denis 2022-11-20 22:06:36 +01:00
parent 4646e02b82
commit a68017d3b0
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
5 changed files with 62 additions and 49 deletions

View File

@ -1,5 +1,5 @@
0.5 - 2022.11.12
- require Dotclear 2.24
0.5 - 2022.11.20
- fix compatibility with Dotclear 2.24 (required)
0.4 - 2021.09.02
- clean up code

View File

@ -1,5 +1,12 @@
# 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.24-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 ?
_tinyPacker_ is a plugin for the open-source
@ -13,7 +20,7 @@ direct from Dotclear blog manager.
_tinyPacker_ requires:
* Super administrator permissions
* Dotclear 2.18
* Dotclear 2.24
* A writable public directory.
## USAGE
@ -29,4 +36,10 @@ and it's pack into current blog public directory.
* License : GNU GPL v2
* Source & contribution : [GitHub Page](https://github.com/JcDenis/tinyPacker)
* Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/tinyPacker)
* Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/tinyPacker)
## CONTRIBUTORS
* Jean-Christian Denis
You are welcome to contribute to this code.

View File

@ -1,16 +1,15 @@
<?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
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
@ -50,12 +49,12 @@ class tinyPacker
*/
public static function adminModulesGetActions($list, $id, $_)
{
if ($list->getList() != 'plugin-activate'
if ($list->getList() != 'plugin-activate'
&& $list->getList() != 'theme-activate') {
return null;
}
return
return
'<input type="submit" name="tinypacker[' .
html::escapeHTML($id) . ']" value="Pack" />';
}
@ -71,19 +70,21 @@ class tinyPacker
public static function adminModulesDoActions($list, $modules, $type)
{
# Pack action
if (empty($_POST['tinypacker'])
if (empty($_POST['tinypacker'])
|| !is_array($_POST['tinypacker'])) {
return null;
}
$modules = array_keys($_POST['tinypacker']);
$id = $modules[0];
$id = $modules[0];
# Repository directory
if (($root = self::repositoryDir($list->core)) === false) {
if (($root = self::repositoryDir()) === false) {
throw new Exception(
__('Destination directory is not writable.'
));
__(
'Destination directory is not writable.'
)
);
}
# Module to pack
@ -93,7 +94,7 @@ class tinyPacker
$module = $list->modules->getModules($id);
# Excluded files and dirs
$exclude = array(
$exclude = [
'\.',
'\.\.',
'__MACOSX',
@ -103,26 +104,25 @@ class tinyPacker
'CVS',
'\.directory',
'\.DS_Store',
'Thumbs\.db'
);
'Thumbs\.db',
];
# Packages names
$files = array(
$files = [
$type . '-' . $id . '.zip',
$type . '-' . $id . '-' . $module['version'] . '.zip'
);
$type . '-' . $id . '-' . $module['version'] . '.zip',
];
# Create zip
foreach($files as $f) {
foreach ($files as $f) {
@set_time_limit(300);
$fp = fopen($root . '/' . $f, 'wb');
$zip = new fileZip($fp);
foreach($exclude AS $e) {
foreach ($exclude as $e) {
$zip->addExclusion(sprintf(
'#(^|/)(%s)(/|$)#',
'#(^|/)(%s)(/|$)#',
$e
));
}
@ -146,7 +146,7 @@ class tinyPacker
public static function repositoryDir()
{
$dir = path::real(
dcCore::app()->blog->public_path . '/' . tinyPacker::$sub_dir,
dcCore::app()->blog->public_path . '/' . tinyPacker::$sub_dir,
false
);
@ -155,12 +155,11 @@ class tinyPacker
files::makeDir($dir, true);
}
if (is_writable($dir)) {
return $dir;
}
} catch(Exception $e) {
}
catch(Exception $e) {}
return false;
}
}
}

View File

@ -1,16 +1,15 @@
<?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
*/
if (!defined('DC_RC_PATH')) {
return null;
}
@ -21,11 +20,11 @@ $this->registerModule(
'Jean-Christian Denis',
'0.5',
[
'requires' => [['core', '2.24']],
'requires' => [['core', '2.24']],
'permissions' => null,
'type' => 'plugin',
'support' => 'https://github.com/JcDenis/tinyPacker',
'details' => 'https://plugins.dotaddict.org/dc2/details/tinyPacker',
'repository' => 'https://raw.githubudsfsfdsfsercontent.com/JcDenis/tinyPacker/master/dcstore.xml'
'type' => 'plugin',
'support' => 'https://github.com/JcDenis/tinyPacker',
'details' => 'https://plugins.dotaddict.org/dc2/details/tinyPacker',
'repository' => 'https://raw.githubudsfsfdsfsercontent.com/JcDenis/tinyPacker/master/dcstore.xml',
]
);
);

View File

@ -1,11 +1,13 @@
<?xml version="1.0"?>
<modules xmlns:da="http://dotaddict.org/da/">
<module id="tinyPacker">
<name>Tiny packer</name>
<version>0.4</version>
<author>Jean-Christian Denis</author>
<desc>Quick pack theme or plugin into public dir</desc>
<file>https://github.com/JcDenis/tinyPacker/releases/download/v0.4/plugin-tinyPacker.zip</file>
<da:details>https://plugins.dotaddict.org/dc2/details/tinyPacker</da:details>
<da:support>https://github.com/JcDenis/tinyPacker</da:support>
</module>
</modules>
<module id="tinyPacker">
<name>Tiny packer</name>
<version>0.5</version>
<author>Jean-Christian Denis</author>
<desc>Quick pack theme or plugin into public dir</desc>
<file>https://github.com/JcDenis/tinyPacker/releases/download/v0.5/plugin-tinyPacker.zip</file>
<da:dcmin>2.24</da:dcmin>
<da:details>https://plugins.dotaddict.org/dc2/details/tinyPacker</da:details>
<da:support>https://github.com/JcDenis/tinyPacker</da:support>
</module>
</modules>