move to dotclear 2.28-dev
This commit is contained in:
parent
fad35a26bc
commit
425518ac89
@ -1,4 +1,10 @@
|
|||||||
pacKman 2023.07.29
|
pacKman 2023.10.06
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.27
|
||||||
|
* Require PHP 8.1+
|
||||||
|
* Update to Dotclear 2.28-dev
|
||||||
|
|
||||||
|
pacKman 2023.08.06
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.27
|
* Require Dotclear 2.27
|
||||||
* Require PHP 8.1+
|
* Require PHP 8.1+
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-2023.08.06-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/pacKman/releases)
|
[![Release](https://img.shields.io/badge/release-2023.10.06-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/pacKman/releases)
|
||||||
[![Date](https://img.shields.io/badge/date-2023.08.06-c44d58.svg)](https://git.dotclear.watch/JcDenis/pacKman/releases)
|
[![Date](https://img.shields.io/badge/date-2023.10.07-c44d58.svg)](https://git.dotclear.watch/JcDenis/pacKman/releases)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/pacKman)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/pacKman)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/pacKman)](https://git.dotclear.watch/JcDenis/pacKman/blob/master/LICENSE)
|
[![License](https://img.shields.io/github/license/JcDenis/pacKman)](https://git.dotclear.watch/JcDenis/pacKman/blob/master/LICENSE)
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ themes and plugins from Dotclear administration pages.
|
|||||||
_pacKman_ requires:
|
_pacKman_ requires:
|
||||||
|
|
||||||
* Super administrator permissions
|
* Super administrator permissions
|
||||||
* Dotclear 2.27
|
* Dotclear 2.28
|
||||||
* PHP 8.1+
|
* PHP 8.1+
|
||||||
* A writable cache directory
|
* A writable cache directory
|
||||||
* A writable directory to put packages. (can be VAR dir)
|
* A writable directory to put packages. (can be VAR dir)
|
||||||
|
@ -20,11 +20,11 @@ $this->registerModule(
|
|||||||
'Packages repository',
|
'Packages repository',
|
||||||
'Manage your Dotclear packages',
|
'Manage your Dotclear packages',
|
||||||
'Jean-Christian Denis',
|
'Jean-Christian Denis',
|
||||||
'2023.08.06',
|
'2023.10.06',
|
||||||
[
|
[
|
||||||
'requires' => [
|
'requires' => [
|
||||||
['php', '8.1'],
|
['php', '8.1'],
|
||||||
['core', '2.27'],
|
['core', '2.28'],
|
||||||
],
|
],
|
||||||
'permissions' => null,
|
'permissions' => null,
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="pacKman">
|
<module id="pacKman">
|
||||||
<name>Packages repository</name>
|
<name>Packages repository</name>
|
||||||
<version>2023.08.06</version>
|
<version>2023.10.06</version>
|
||||||
<author>Jean-Christian Denis</author>
|
<author>Jean-Christian Denis</author>
|
||||||
<desc>Manage your Dotclear packages</desc>
|
<desc>Manage your Dotclear packages</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/pacKman/releases/download/v2023.08.06/plugin-pacKman.zip</file>
|
<file>https://github.com/JcDenis/pacKman/releases/download/v2023.10.06/plugin-pacKman.zip</file>
|
||||||
<da:dcmin>2.27</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/pacKman/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/pacKman/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/pacKman/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/pacKman/issues</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Core\Backend\Favorites;
|
use Dotclear\Core\Backend\Favorites;
|
||||||
|
|
||||||
@ -33,13 +33,12 @@ class Backend extends Process
|
|||||||
|
|
||||||
My::addBackendMenuItem();
|
My::addBackendMenuItem();
|
||||||
|
|
||||||
dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (Favorites $favs): void {
|
App::behavior()->addBehavior('adminDashboardFavoritesV2', function (Favorites $favs): void {
|
||||||
$favs->register(My::id(), [
|
$favs->register(My::id(), [
|
||||||
'title' => My::name(),
|
'title' => My::name(),
|
||||||
'url' => My::manageUrl(),
|
'url' => My::manageUrl(),
|
||||||
'small-icon' => My::icons(),
|
'small-icon' => My::icons(),
|
||||||
'large-icon' => My::icons(),
|
'large-icon' => My::icons()
|
||||||
//'permissions' => dcCore::app()->auth->isSuperAdmin(),
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Core\Backend\Notices;
|
use Dotclear\Core\Backend\Notices;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
@ -62,13 +62,13 @@ class Config extends Process
|
|||||||
Notices::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Configuration has been successfully updated.')
|
__('Configuration has been successfully updated.')
|
||||||
);
|
);
|
||||||
dcCore::app()->admin->url->redirect('admin.plugins', [
|
App::backend()->url->redirect('admin.plugins', [
|
||||||
'module' => My::id(),
|
'module' => My::id(),
|
||||||
'conf' => '1',
|
'conf' => '1',
|
||||||
'redir' => dcCore::app()->admin->__get('list')->getRedir(),
|
'redir' => App::backend()->__get('list')->getRedir(),
|
||||||
]);
|
]);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -119,8 +119,8 @@ class Config extends Process
|
|||||||
(new Note())->class('form-note')->text(
|
(new Note())->class('form-note')->text(
|
||||||
sprintf(
|
sprintf(
|
||||||
__('Preconization: %s'),
|
__('Preconization: %s'),
|
||||||
dcCore::app()->blog?->public_path ?
|
App::blog()->publicPath() ?
|
||||||
dcCore::app()->blog->public_path : __("Blog's public directory")
|
App::blog()->publicPath() : __("Blog's public directory")
|
||||||
) . ' ' . __('Leave it empty to use Dotclear VAR directory')
|
) . ' ' . __('Leave it empty to use Dotclear VAR directory')
|
||||||
),
|
),
|
||||||
// pack_overwrite
|
// pack_overwrite
|
||||||
|
21
src/Core.php
21
src/Core.php
@ -14,12 +14,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcModuleDefine;
|
|
||||||
use dcModules;
|
|
||||||
use Dotclear\Helper\File\Files;
|
use Dotclear\Helper\File\Files;
|
||||||
use Dotclear\Helper\File\Path;
|
use Dotclear\Helper\File\Path;
|
||||||
use Dotclear\Helper\File\Zip\Unzip;
|
use Dotclear\Helper\File\Zip\Unzip;
|
||||||
|
use Dotclear\Module\ModuleDefine;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Core
|
class Core
|
||||||
@ -59,8 +58,8 @@ class Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sandboxes = [
|
$sandboxes = [
|
||||||
'theme' => clone dcCore::app()->themes,
|
'theme' => clone App::themes(),
|
||||||
'plugin' => clone dcCore::app()->plugins,
|
'plugin' => clone App::plugins(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -73,13 +72,13 @@ class Core
|
|||||||
if ($zip_root_dir != false) {
|
if ($zip_root_dir != false) {
|
||||||
$target = dirname($zip_file);
|
$target = dirname($zip_file);
|
||||||
$path = $target . DIRECTORY_SEPARATOR . $zip_root_dir;
|
$path = $target . DIRECTORY_SEPARATOR . $zip_root_dir;
|
||||||
$define = $zip_root_dir . '/' . dcModules::MODULE_FILE_DEFINE;
|
$define = $zip_root_dir . '/' . App::plugins()::MODULE_FILE_DEFINE;
|
||||||
$init = $zip_root_dir . '/' . dcModules::MODULE_FILE_INIT;
|
$init = $zip_root_dir . '/' . App::plugins()::MODULE_FILE_INIT;
|
||||||
} else {
|
} else {
|
||||||
$target = dirname($zip_file) . DIRECTORY_SEPARATOR . preg_replace('/\.([^.]+)$/', '', basename($zip_file));
|
$target = dirname($zip_file) . DIRECTORY_SEPARATOR . preg_replace('/\.([^.]+)$/', '', basename($zip_file));
|
||||||
$path = $target;
|
$path = $target;
|
||||||
$define = dcModules::MODULE_FILE_DEFINE;
|
$define = App::plugins()::MODULE_FILE_DEFINE;
|
||||||
$init = dcModules::MODULE_FILE_INIT;
|
$init = App::plugins()::MODULE_FILE_INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($zip->isEmpty()) {
|
if ($zip->isEmpty()) {
|
||||||
@ -135,7 +134,7 @@ class Core
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function pack(dcModuleDefine $define, string $root, array $files, bool $overwrite = false, array $exclude = [], bool $nocomment = false, bool $fixnewline = false): bool
|
public static function pack(ModuleDefine $define, string $root, array $files, bool $overwrite = false, array $exclude = [], bool $nocomment = false, bool $fixnewline = false): bool
|
||||||
{
|
{
|
||||||
// check define
|
// check define
|
||||||
if (!$define->isDefined()
|
if (!$define->isDefined()
|
||||||
@ -195,7 +194,7 @@ class Core
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function getFile(string $file, dcModuleDefine $define): string
|
private static function getFile(string $file, ModuleDefine $define): string
|
||||||
{
|
{
|
||||||
$file = str_replace(
|
$file = str_replace(
|
||||||
[
|
[
|
||||||
|
@ -14,8 +14,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcNamespace;
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ class Install extends Process
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -46,23 +45,23 @@ class Install extends Process
|
|||||||
|
|
||||||
public static function growUp(): void
|
public static function growUp(): void
|
||||||
{
|
{
|
||||||
$current = dcCore::app()->getVersion(My::id());
|
$current = App::version()->getVersion(My::id());
|
||||||
|
|
||||||
// Update settings id, ns
|
// Update settings id, ns
|
||||||
if ($current && version_compare($current, '2022.12.19.1', '<=')) {
|
if ($current && version_compare($current, '2022.12.19.1', '<=')) {
|
||||||
$record = dcCore::app()->con->select(
|
$record = App::con()->select(
|
||||||
'SELECT * FROM ' . dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME . ' ' .
|
'SELECT * FROM ' . App::con()->prefix() . App::blogWorkspace()::NS_TABLE_NAME . ' ' .
|
||||||
"WHERE setting_ns = 'pacKman' "
|
"WHERE setting_ns = 'pacKman' "
|
||||||
);
|
);
|
||||||
|
|
||||||
while ($record->fetch()) {
|
while ($record->fetch()) {
|
||||||
if (preg_match('/^packman_(.*?)$/', $record->f('setting_id'), $match)) {
|
if (preg_match('/^packman_(.*?)$/', $record->f('setting_id'), $match)) {
|
||||||
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME);
|
$cur = App::blogWorspace()->openBlogWorkspaceCursor();
|
||||||
$cur->setField('setting_id', $match[1]);
|
$cur->setField('setting_id', $match[1]);
|
||||||
$cur->setField('setting_ns', My::id());
|
$cur->setField('setting_ns', My::id());
|
||||||
$cur->update(
|
$cur->update(
|
||||||
"WHERE setting_id = '" . $record->f('setting_id') . "' and setting_ns = 'pacKman' " .
|
"WHERE setting_id = '" . $record->f('setting_id') . "' and setting_ns = 'pacKman' " .
|
||||||
'AND blog_id ' . (null === $record->f('blog_id') ? 'IS NULL ' : ("= '" . dcCore::app()->con->escapeStr($record->f('blog_id')) . "' "))
|
'AND blog_id ' . (null === $record->f('blog_id') ? 'IS NULL ' : ("= '" . App::con()->escapeStr($record->f('blog_id')) . "' "))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
/* dotclear ns */
|
use Dotclear\App;
|
||||||
use dcCore;
|
|
||||||
use dcThemes;
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Core\Backend\{
|
use Dotclear\Core\Backend\{
|
||||||
Notices,
|
Notices,
|
||||||
@ -53,12 +51,9 @@ class Manage extends Process
|
|||||||
$dir = Utils::getRepositoryDir($s->pack_repository, $repo);
|
$dir = Utils::getRepositoryDir($s->pack_repository, $repo);
|
||||||
|
|
||||||
# Modules
|
# Modules
|
||||||
if (!(dcCore::app()->themes instanceof dcThemes)) {
|
if (App::themes()->isEmpty()) {
|
||||||
dcCore::app()->themes = new dcThemes();
|
App::themes()->loadModules(App::blog()->themesPath(), null);
|
||||||
dcCore::app()->themes->loadModules((string) dcCore::app()->blog?->themes_path, null);
|
|
||||||
}
|
}
|
||||||
$themes = dcCore::app()->themes;
|
|
||||||
$plugins = dcCore::app()->plugins;
|
|
||||||
|
|
||||||
# Rights
|
# Rights
|
||||||
$is_writable = Utils::isWritable($dir, $s->pack_filename);
|
$is_writable = Utils::isWritable($dir, $s->pack_filename);
|
||||||
@ -85,7 +80,7 @@ class Manage extends Process
|
|||||||
&& is_file($module->get('root')) && is_readable($module->get('root'))
|
&& is_file($module->get('root')) && is_readable($module->get('root'))
|
||||||
) {
|
) {
|
||||||
# --BEHAVIOR-- packmanBeforeDownloadPackage
|
# --BEHAVIOR-- packmanBeforeDownloadPackage
|
||||||
dcCore::app()->callBehavior('packmanBeforeDownloadPackage', $module->dump(), $type);
|
App::behavior()->callBehavior('packmanBeforeDownloadPackage', $module->dump(), $type);
|
||||||
|
|
||||||
header('Content-Type: application/zip');
|
header('Content-Type: application/zip');
|
||||||
header('Content-Length: ' . filesize($module->get('root')));
|
header('Content-Length: ' . filesize($module->get('root')));
|
||||||
@ -93,7 +88,7 @@ class Manage extends Process
|
|||||||
readfile($module->get('root'));
|
readfile($module->get('root'));
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanAfterDownloadPackage
|
# --BEHAVIOR-- packmanAfterDownloadPackage
|
||||||
dcCore::app()->callBehavior('packmanAfterDownloadPackage', $module->dump(), $type);
|
App::behavior()->callBehavior('packmanAfterDownloadPackage', $module->dump(), $type);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -117,14 +112,22 @@ class Manage extends Process
|
|||||||
# Pack
|
# Pack
|
||||||
} elseif ($action == 'packup') {
|
} elseif ($action == 'packup') {
|
||||||
foreach ($_POST['modules'] as $root => $id) {
|
foreach ($_POST['modules'] as $root => $id) {
|
||||||
if (!dcCore::app()->{$type}->getDefine($id)->isDefined()) {
|
if ($type == 'themes') {
|
||||||
|
if (!App::themes()->getDefine($id)->isDefined()) {
|
||||||
throw new Exception('No such module');
|
throw new Exception('No such module');
|
||||||
}
|
}
|
||||||
|
|
||||||
$module = dcCore::app()->{$type}->getDefine($id);
|
$module = App::themes()->getDefine($id);
|
||||||
|
} else {
|
||||||
|
if (!App::plugins()->getDefine($id)->isDefined()) {
|
||||||
|
throw new Exception('No such module');
|
||||||
|
}
|
||||||
|
|
||||||
|
$module = App::plugins()->getDefine($id);
|
||||||
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanBeforeCreatePackage
|
# --BEHAVIOR-- packmanBeforeCreatePackage
|
||||||
dcCore::app()->callBehavior('packmanBeforeCreatePackage', $module->dump());
|
App::behavior()->callBehavior('packmanBeforeCreatePackage', $module->dump());
|
||||||
|
|
||||||
Core::pack(
|
Core::pack(
|
||||||
$module,
|
$module,
|
||||||
@ -137,7 +140,7 @@ class Manage extends Process
|
|||||||
);
|
);
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanAfterCreatePackage
|
# --BEHAVIOR-- packmanAfterCreatePackage
|
||||||
dcCore::app()->callBehavior('packmanAfterCreatePackage', $module->dump());
|
App::behavior()->callBehavior('packmanAfterCreatePackage', $module->dump());
|
||||||
}
|
}
|
||||||
|
|
||||||
Notices::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
@ -179,17 +182,16 @@ class Manage extends Process
|
|||||||
} 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);
|
App::behavior()->callBehavior('packmanBeforeInstallPackage', $type, $id, $root);
|
||||||
|
|
||||||
if ($type == 'plugins') {
|
|
||||||
$plugins->installPackage($root, $plugins);
|
|
||||||
}
|
|
||||||
if ($type == 'themes') {
|
if ($type == 'themes') {
|
||||||
$themes->installPackage($root, $themes);
|
App::themes()->installPackage($root, App::themes());
|
||||||
|
} else {
|
||||||
|
App::plugins()->installPackage($root, App::plugins());
|
||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanAfterInstallPackage
|
# --BEHAVIOR-- packmanAfterInstallPackage
|
||||||
dcCore::app()->callBehavior('packmanAfterInstallPackage', $type, $id, $root);
|
App::behavior()->callBehavior('packmanAfterInstallPackage', $type, $id, $root);
|
||||||
}
|
}
|
||||||
|
|
||||||
Notices::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
@ -256,7 +258,7 @@ class Manage extends Process
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -301,7 +303,7 @@ class Manage extends Process
|
|||||||
My::jsLoad('backend') .
|
My::jsLoad('backend') .
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanAdminHeader
|
# --BEHAVIOR-- packmanAdminHeader
|
||||||
dcCore::app()->callBehavior('packmanAdminHeader')
|
App::behavior()->callBehavior('packmanAdminHeader')
|
||||||
);
|
);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@ -311,7 +313,7 @@ class Manage extends Process
|
|||||||
]) .
|
]) .
|
||||||
Notices::GetNotices();
|
Notices::GetNotices();
|
||||||
|
|
||||||
if (dcCore::app()->error->flag() || !$is_configured || !$is_plugins_configured || !$is_themes_configured) {
|
if (App::error()->flag() || !$is_configured || !$is_plugins_configured || !$is_themes_configured) {
|
||||||
echo
|
echo
|
||||||
(new Div())
|
(new Div())
|
||||||
->separator(' ')
|
->separator(' ')
|
||||||
@ -322,13 +324,13 @@ class Manage extends Process
|
|||||||
->render();
|
->render();
|
||||||
} else {
|
} else {
|
||||||
Utils::modules(
|
Utils::modules(
|
||||||
dcCore::app()->plugins->getDefines((new Settings())->hide_distrib ? ['distributed' => false] : []),
|
App::plugins()->getDefines((new Settings())->hide_distrib ? ['distributed' => false] : []),
|
||||||
'plugins',
|
'plugins',
|
||||||
__('Installed plugins')
|
__('Installed plugins')
|
||||||
);
|
);
|
||||||
|
|
||||||
Utils::modules(
|
Utils::modules(
|
||||||
dcCore::app()->themes->getDefines((new Settings())->hide_distrib ? ['distributed' => false] : []),
|
App::themes()->getDefines((new Settings())->hide_distrib ? ['distributed' => false] : []),
|
||||||
'themes',
|
'themes',
|
||||||
__('Installed themes')
|
__('Installed themes')
|
||||||
);
|
);
|
||||||
@ -375,7 +377,7 @@ class Manage extends Process
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanAdminTabs
|
# --BEHAVIOR-- packmanAdminTabs
|
||||||
dcCore::app()->callBehavior('packmanAdminTabs');
|
App::behavior()->callBehavior('packmanAdminTabs');
|
||||||
|
|
||||||
Page::helpBlock('pacKman');
|
Page::helpBlock('pacKman');
|
||||||
Page::closeModule();
|
Page::closeModule();
|
||||||
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Module\MyPlugin;
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,6 +38,6 @@ class My extends MyPlugin
|
|||||||
|
|
||||||
public static function checkCustomContext(int $context): ?bool
|
public static function checkCustomContext(int $context): ?bool
|
||||||
{
|
{
|
||||||
return in_array($context, [My::BACKEND, My::MANAGE, My::MENU]) ? dcCore::app()->auth->isSuperAdmin() : null;
|
return in_array($context, [My::BACKEND, My::MANAGE, My::MENU]) ? App::auth()->isSuperAdmin() : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ class Uninstall extends Process
|
|||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
if (!self::status() || !App::plugins()->moduleExists('Uninstaller')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Helper\Date;
|
use Dotclear\Helper\Date;
|
||||||
use Dotclear\Helper\File\Files;
|
use Dotclear\Helper\File\Files;
|
||||||
use Dotclear\Helper\File\Path;
|
use Dotclear\Helper\File\Path;
|
||||||
@ -45,37 +45,37 @@ class Utils
|
|||||||
|
|
||||||
public static function getThemesPath(): string
|
public static function getThemesPath(): string
|
||||||
{
|
{
|
||||||
return (string) dcCore::app()->blog?->themes_path;
|
return App::blog()->themesPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isConfigured(string $repo, string $file_a, string $file_b): bool
|
public static function isConfigured(string $repo, string $file_a, string $file_b): bool
|
||||||
{
|
{
|
||||||
sleep(1);
|
sleep(1);
|
||||||
if (!is_writable($repo)) {
|
if (!is_writable($repo)) {
|
||||||
dcCore::app()->error->add(
|
App::error()->add(
|
||||||
__('Path to repository is not writable.')
|
__('Path to repository is not writable.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($file_a)) {
|
if (empty($file_a)) {
|
||||||
dcCore::app()->error->add(
|
App::error()->add(
|
||||||
__('You must specify the name of package to export.')
|
__('You must specify the name of package to export.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_writable(dirname($repo . DIRECTORY_SEPARATOR . $file_a))) {
|
if (!is_writable(dirname($repo . DIRECTORY_SEPARATOR . $file_a))) {
|
||||||
dcCore::app()->error->add(
|
App::error()->add(
|
||||||
__('Path to first export package is not writable.')
|
__('Path to first export package is not writable.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($file_b) && !is_writable(dirname($repo . DIRECTORY_SEPARATOR . $file_b))) {
|
if (!empty($file_b) && !is_writable(dirname($repo . DIRECTORY_SEPARATOR . $file_b))) {
|
||||||
dcCore::app()->error->add(
|
App::error()->add(
|
||||||
__('Path to second export package is not writable.')
|
__('Path to second export package is not writable.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !dcCore::app()->error->flag();
|
return !App::error()->flag();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isWritable(string $path, string $file): bool
|
public static function isWritable(string $path, string $file): bool
|
||||||
@ -209,7 +209,7 @@ class Utils
|
|||||||
if (str_contains($type, 'repository')) {
|
if (str_contains($type, 'repository')) {
|
||||||
$helpers_addon[] = (new Link())
|
$helpers_addon[] = (new Link())
|
||||||
->class('button')
|
->class('button')
|
||||||
->href(dcCore::app()->adminurl?->get('admin.plugin.' . My::id(), ['purge' => 1]) . '#packman-repository-' . $type)
|
->href(App::backend()->url->get('admin.plugin.' . My::id(), ['purge' => 1]) . '#packman-repository-' . $type)
|
||||||
->text(__('Select non lastest versions'))
|
->text(__('Select non lastest versions'))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ class Utils
|
|||||||
(new Text('a', Html::escapeHTML(basename($module->get('root')))))
|
(new Text('a', Html::escapeHTML(basename($module->get('root')))))
|
||||||
->class('packman-download')
|
->class('packman-download')
|
||||||
->extra(
|
->extra(
|
||||||
'href="' . dcCore::app()->adminurl?->get('admin.plugin.' . My::id(), [
|
'href="' . App::backend()->url->get('admin.plugin.' . My::id(), [
|
||||||
'package' => basename($module->get('root')),
|
'package' => basename($module->get('root')),
|
||||||
'repo' => $type,
|
'repo' => $type,
|
||||||
]) . '"'
|
]) . '"'
|
||||||
|
@ -27,12 +27,12 @@ class Zip extends \Dotclear\Helper\File\Zip\Zip
|
|||||||
*
|
*
|
||||||
* @param string $name The name
|
* @param string $name The name
|
||||||
* @param string $file The file
|
* @param string $file The file
|
||||||
* @param string $size The size
|
* @param float|int $size The size
|
||||||
* @param int|null $mtime The mtime
|
* @param float|int $mtime The mtime
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function writeFile($name, $file, $size, $mtime)
|
protected function writeFile(string $name, string $file, int|float $size, int|float $mtime): void
|
||||||
{
|
{
|
||||||
if (!isset($this->entries[$name])) {
|
if (!isset($this->entries[$name])) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user