This commit is contained in:
Jean-Christian Paul Denis 2022-11-26 22:22:42 +01:00
parent d07ccf9329
commit 4cf21eba91
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
5 changed files with 22 additions and 25 deletions

View File

@ -25,6 +25,6 @@ $this->registerModule(
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://github.com/JcDenis/pacKman', 'support' => 'https://github.com/JcDenis/pacKman',
'details' => 'https://plugins.dotaddict.org/dc2/details/pacKman', 'details' => 'https://plugins.dotaddict.org/dc2/details/pacKman',
'repository' => 'https://raw.githubusercontent.com/JcDenis/pacKman/master/dcstore.xml' 'repository' => 'https://raw.githubusercontent.com/JcDenis/pacKman/master/dcstore.xml',
] ]
); );

View File

@ -23,50 +23,49 @@ $mod_conf = [
'packman_menu_plugins', 'packman_menu_plugins',
'Add link to pacKman in plugins page', 'Add link to pacKman in plugins page',
false, false,
'boolean' 'boolean',
], ],
[ [
'packman_pack_nocomment', 'packman_pack_nocomment',
'Remove comments from files', 'Remove comments from files',
false, false,
'boolean' 'boolean',
], ],
[ [
'packman_pack_overwrite', 'packman_pack_overwrite',
'Overwrite existing package', 'Overwrite existing package',
false, false,
'boolean' 'boolean',
], ],
[ [
'packman_pack_filename', 'packman_pack_filename',
'Name of package', 'Name of package',
'%type%-%id%', '%type%-%id%',
'string' 'string',
], ],
[ [
'packman_secondpack_filename', 'packman_secondpack_filename',
'Name of second package', 'Name of second package',
'%type%-%id%-%version%', '%type%-%id%-%version%',
'string' 'string',
], ],
[ [
'packman_pack_repository', 'packman_pack_repository',
'Path to package repository', 'Path to package repository',
'', '',
'string' 'string',
], ],
[ [
'packman_pack_excludefiles', 'packman_pack_excludefiles',
'Extra files to exclude from package', 'Extra files to exclude from package',
'*.zip,*.tar,*.tar.gz,.directory,.hg', '*.zip,*.tar,*.tar.gz,.directory,.hg',
'string' 'string',
] ],
]; ];
# -- Nothing to change below -- # -- Nothing to change below --
try { try {
# Check module version # Check module version
if (version_compare( if (version_compare(
dcCore::app()->getVersion($mod_id), dcCore::app()->getVersion($mod_id),

View File

@ -16,6 +16,6 @@ if (!defined('DC_RC_PATH')) {
$d = __DIR__ . '/inc/'; $d = __DIR__ . '/inc/';
Clearbricks::lib()->autoload(['dcPackman' => $d . 'class.dc.packman.php']); Clearbricks::lib()->autoload(['dcPackman' => $d . 'class.dc.packman.php']);
Clearbricks::lib()->autoload(['libPackman' => $d . 'lib.packman.php']); Clearbricks::lib()->autoload(['libPackman' => $d . 'lib.packman.php']);
Clearbricks::lib()->autoload(['packmanFileZip' => $d . 'lib.packman.filezip.php']); Clearbricks::lib()->autoload(['packmanFileZip' => $d . 'lib.packman.filezip.php']);

View File

@ -26,7 +26,7 @@ class dcPackman
'.git*', '.git*',
'CVS', 'CVS',
'.DS_Store', '.DS_Store',
'Thumbs.db' 'Thumbs.db',
]; ];
public static function quote_exclude(array $exclude): array public static function quote_exclude(array $exclude): array
@ -96,7 +96,7 @@ class dcPackman
if (is_array($res[$i])) { if (is_array($res[$i])) {
$res[$i] = array_merge($res[$i], [ $res[$i] = array_merge($res[$i], [
'id' => $zip_root_dir, 'id' => $zip_root_dir,
'root' => $root . '/' . $zip_file 'root' => $root . '/' . $zip_file,
]); ]);
unlink($cache . '_define.php'); unlink($cache . '_define.php');
@ -193,14 +193,14 @@ class dcPackman
'%id%', '%id%',
'%version%', '%version%',
'%author%', '%author%',
'%time%' '%time%',
], ],
[ [
$info['type'], $info['type'],
$info['id'], $info['id'],
$info['version'], $info['version'],
$info['author'], $info['author'],
time() time(),
], ],
$file $file
); );

View File

@ -74,7 +74,6 @@ try {
if (preg_match('/' . preg_quote($_REQUEST['package']) . '$/', $f['root']) if (preg_match('/' . preg_quote($_REQUEST['package']) . '$/', $f['root'])
&& is_file($f['root']) && is_readable($f['root']) && is_file($f['root']) && is_readable($f['root'])
) { ) {
# --BEHAVIOR-- packmanBeforeDownloadPackage # --BEHAVIOR-- packmanBeforeDownloadPackage
dcCore::app()->callBehavior('packmanBeforeDownloadPackage', $f, $type); dcCore::app()->callBehavior('packmanBeforeDownloadPackage', $f, $type);
@ -111,7 +110,7 @@ try {
$root = $s->packman_pack_repository; $root = $s->packman_pack_repository;
$files = [ $files = [
$s->packman_pack_filename, $s->packman_pack_filename,
$s->packman_secondpack_filename $s->packman_secondpack_filename,
]; ];
$nocomment = $s->packman_pack_nocomment; $nocomment = $s->packman_pack_nocomment;
$fixnewline = $s->packman_pack_fixnewline; $fixnewline = $s->packman_pack_fixnewline;
@ -137,7 +136,7 @@ try {
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-' . $type); dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-' . $type);
} }
# Delete # Delete
} elseif ($action == 'delete') { } elseif ($action == 'delete') {
foreach ($_POST['modules'] as $root => $id) { foreach ($_POST['modules'] as $root => $id) {
if (!file_exists($root) || !files::isDeletable($root)) { if (!file_exists($root) || !files::isDeletable($root)) {
@ -157,10 +156,9 @@ try {
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type); dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
} }
# Install # Install
} elseif ($action == 'install') { } elseif ($action == 'install') {
foreach ($_POST['modules'] as $root => $id) { foreach ($_POST['modules'] as $root => $id) {
# --BEHAVIOR-- packmanBeforeInstallPackage # --BEHAVIOR-- packmanBeforeInstallPackage
dcCore::app()->callBehavior('packmanBeforeInstallPackage', $type, $id, $root); dcCore::app()->callBehavior('packmanBeforeInstallPackage', $type, $id, $root);
@ -185,7 +183,7 @@ try {
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type); dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
} }
# Copy # Copy
} elseif (strpos($action, 'copy_to_') !== false) { } elseif (strpos($action, 'copy_to_') !== false) {
$dest = $repo_path; $dest = $repo_path;
if ($action == 'copy_to_plugins') { if ($action == 'copy_to_plugins') {
@ -211,7 +209,7 @@ try {
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type); dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
} }
# Move # Move
} elseif (strpos($action, 'move_to_') !== false) { } elseif (strpos($action, 'move_to_') !== false) {
$dest = $repo_path; $dest = $repo_path;
if ($action == 'move_to_plugins') { if ($action == 'move_to_plugins') {
@ -256,7 +254,7 @@ echo
dcPage::breadcrumb([ dcPage::breadcrumb([
__('Plugins') => '', __('Plugins') => '',
__('pacKman') => '' __('pacKman') => '',
]) . ]) .
dcPage::notices(); dcPage::notices();
@ -272,7 +270,7 @@ if (dcCore::app()->error->flag() || !$is_configured) {
dcPackman::getPackages(dirname($repo_path . '/' . $s->packman_secondpack_filename)) dcPackman::getPackages(dirname($repo_path . '/' . $s->packman_secondpack_filename))
); );
$plugins_path_modules = dcPackman::getPackages($plugins_path); $plugins_path_modules = dcPackman::getPackages($plugins_path);
$themes_path_modules = dcPackman::getPackages($themes_path); $themes_path_modules = dcPackman::getPackages($themes_path);
libPackman::modules( libPackman::modules(
$plugins->getModules(), $plugins->getModules(),