This commit is contained in:
Jean-Christian Denis 2022-12-10 18:08:16 +01:00
parent 05a74d8f8a
commit 5354e21c02
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
2 changed files with 13 additions and 13 deletions

View file

@ -29,30 +29,29 @@ dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
dcCore::app()->addBehavior('adminDashboardFavoritesV2', function ($favs) { dcCore::app()->addBehavior('adminDashboardFavoritesV2', function ($favs) {
$favs->register(basename(__DIR__), [ $favs->register(basename(__DIR__), [
'title' => __('Advanced cleaner'), 'title' => __('Advanced cleaner'),
'url' => dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)), 'url' => dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
'small-icon' => dcPage::getPF(basename(__DIR__) . '/icon.png'), 'small-icon' => dcPage::getPF(basename(__DIR__) . '/icon.png'),
'large-icon' => dcPage::getPF(basename(__DIR__) . '/icon-big.png'), 'large-icon' => dcPage::getPF(basename(__DIR__) . '/icon-big.png'),
//'permissions' => dcCore::app()->auth->isSuperAdmin(), //'permissions' => dcCore::app()->auth->isSuperAdmin(),
]); ]);
}); });
dcCore::app()->addBehavior('pluginsToolsTabsV2', function () { dcCore::app()->addBehavior('pluginsToolsTabsV2', function () {
$path = DC_PLUGINS_ROOT;
$redir = dcCore::app()->adminurl->get('admin.plugins', [], '#uninstaller');
$title = '';
if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->dcAdvancedCleaner_behavior_active) { if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->dcAdvancedCleaner_behavior_active) {
return null; return null;
} }
$title = empty($title) ? __('Advanced uninstall') : $title;
$path = DC_PLUGINS_ROOT;
$redir = dcCore::app()->adminurl->get('admin.plugins', [], '#uninstaller');
$title = '';
$uninstaller = new dcUninstaller(); $uninstaller = new dcUninstaller();
$uninstaller->loadModules($path); $uninstaller->loadModules($path);
$modules = $uninstaller->getModules(); $modules = $uninstaller->getModules();
$props = $uninstaller->getAllowedActions(); $props = $uninstaller->getAllowedActions();
echo '<div class="multi-part" id="uninstaller" title="' . __($title) . '"><h3>' . __($title) . '</h3>'; echo '<div class="multi-part" id="uninstaller" title="' . __('Advanced uninstall') . '"><h3>' . __('Advanced uninstall') . '</h3>';
if (!count($modules)) { if (!count($modules)) {
echo '<p>' . __('There is no module with uninstall features') . '</p></div>'; echo '<p>' . __('There is no module with uninstall features') . '</p></div>';
@ -207,11 +206,12 @@ dcCore::app()->addBehavior('themeBeforeDelete', function ($theme) {
function dcAdvancedCleanerModuleBeforeDelete($module) function dcAdvancedCleanerModuleBeforeDelete($module)
{ {
$done = false;
if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->dcAdvancedCleaner_behavior_active) { if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->dcAdvancedCleaner_behavior_active) {
return null; return null;
} }
$done = false;
$uninstaller = new dcUninstaller(); $uninstaller = new dcUninstaller();
$uninstaller->loadModule($module['root']); $uninstaller->loadModule($module['root']);