add some code descriptions

This commit is contained in:
Jean-Christian Paul Denis 2023-04-24 14:38:03 +02:00
parent 7ce0f84aad
commit 95b3b1702e
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
9 changed files with 68 additions and 9 deletions

View File

@ -21,6 +21,12 @@ use Dotclear\Plugin\Uninstaller\{
ValueDescriptor ValueDescriptor
}; };
/**
* Cleaner for Dotclear cache directory used by modules.
*
* It allows modules to delete an entire sub folder
* of DC_TPL_CACHE directory path.
*/
class Caches extends AbstractCleaner class Caches extends AbstractCleaner
{ {
use TraitCleanerDir; use TraitCleanerDir;
@ -37,6 +43,7 @@ class Caches extends AbstractCleaner
protected function actions(): array protected function actions(): array
{ {
return [ return [
// delete a $ns folder and thier files.
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete', 'id' => 'delete',
'select' => __('delete selected cache directories'), 'select' => __('delete selected cache directories'),
@ -44,6 +51,7 @@ class Caches extends AbstractCleaner
'success' => __('"%s" cache directory deleted'), 'success' => __('"%s" cache directory deleted'),
'error' => __('Failed to delete "%s" cache directory'), 'error' => __('Failed to delete "%s" cache directory'),
]), ]),
// delete $ns folder files but keep folder
new ActionDescriptor([ new ActionDescriptor([
'id' => 'empty', 'id' => 'empty',
'select' => __('empty selected cache directories'), 'select' => __('empty selected cache directories'),
@ -56,7 +64,12 @@ class Caches extends AbstractCleaner
public function distributed(): array public function distributed(): array
{ {
return ['cbfeed', 'cbtpl', 'dcrepo', 'versions']; return [
'cbfeed',
'cbtpl',
'dcrepo',
'versions'
];
} }
public function values(): array public function values(): array

View File

@ -26,6 +26,12 @@ use Dotclear\Plugin\Uninstaller\{
ValueDescriptor ValueDescriptor
}; };
/**
* Cleaner for Dotclear logs used by modules.
*
* It allows modules to delete a "log_table"
* of Dotclear dcLog::LOG_TABLE_NAME database table.
*/
class Logs extends AbstractCleaner class Logs extends AbstractCleaner
{ {
protected function properties(): array protected function properties(): array
@ -40,6 +46,7 @@ class Logs extends AbstractCleaner
protected function actions(): array protected function actions(): array
{ {
return [ return [
// delete all $ns log_table entries
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete_all', 'id' => 'delete_all',
'select' => __('delete selected logs tables'), 'select' => __('delete selected logs tables'),

View File

@ -21,6 +21,11 @@ use Dotclear\Plugin\Uninstaller\{
ValueDescriptor ValueDescriptor
}; };
/**
* Cleaner for Dotclear plugins.
*
* It allows modules to delete their own folder.
*/
class Plugins extends AbstractCleaner class Plugins extends AbstractCleaner
{ {
use TraitCleanerDir; use TraitCleanerDir;
@ -37,6 +42,7 @@ class Plugins extends AbstractCleaner
protected function actions(): array protected function actions(): array
{ {
return [ return [
// delete $ns plugin folder
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete', 'id' => 'delete',
'select' => __('delete selected plugins files and directories'), 'select' => __('delete selected plugins files and directories'),

View File

@ -27,10 +27,10 @@ use Dotclear\Plugin\Uninstaller\{
}; };
/** /**
* Users preferences cleaner. * Cleaner for Dotclear user preferences.
* *
* Cleaner manages entire users preferences workspace * It allows modules to delete for users or global a preference workspace.
* except 'delete_related' which can pickup preference ws/id pairs * It also allows to pick-up specific preference id by using delete_related action.
*/ */
class Preferences extends AbstractCleaner class Preferences extends AbstractCleaner
{ {
@ -46,6 +46,7 @@ class Preferences extends AbstractCleaner
protected function actions(): array protected function actions(): array
{ {
return [ return [
// delete global $ns preferences workspace
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete_global', 'id' => 'delete_global',
'select' => __('delete selected global preferences workspaces'), 'select' => __('delete selected global preferences workspaces'),
@ -53,6 +54,7 @@ class Preferences extends AbstractCleaner
'success' => __('"%s" global preferences workspace deleted'), 'success' => __('"%s" global preferences workspace deleted'),
'error' => __('Failed to delete "%s" global preferences workspace'), 'error' => __('Failed to delete "%s" global preferences workspace'),
]), ]),
// delete users $ns preferences workspace
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete_local', 'id' => 'delete_local',
'select' => __('delete selected users preferences workspaces'), 'select' => __('delete selected users preferences workspaces'),
@ -60,6 +62,7 @@ class Preferences extends AbstractCleaner
'success' => __('"%s" users preferences workspace deleted'), 'success' => __('"%s" users preferences workspace deleted'),
'error' => __('Failed to delete "%s" users preferences workspace'), 'error' => __('Failed to delete "%s" users preferences workspace'),
]), ]),
// delete user and global $ns preferences workspace
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete_all', 'id' => 'delete_all',
'select' => __('delete selected preferences workspaces'), 'select' => __('delete selected preferences workspaces'),
@ -67,7 +70,7 @@ class Preferences extends AbstractCleaner
'success' => __('"%s" preferences workspace deleted'), 'success' => __('"%s" preferences workspace deleted'),
'error' => __('Failed to delete "%s" preferences workspace'), 'error' => __('Failed to delete "%s" preferences workspace'),
]), ]),
// $ns = 'pref_ws:pref_id;pref_ws:pref_id;...' for global and users preferences // delete users and globals specific $ws:$id settings using 'pref_ws:pref_id;pref_ws:pref_id;' as $ns
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete_related', 'id' => 'delete_related',
'query' => __('delete related preferences'), 'query' => __('delete related preferences'),

View File

@ -27,10 +27,10 @@ use Dotclear\Plugin\Uninstaller\{
}; };
/** /**
* Settings cleaner. * Cleaner for Dotclear blog settings.
* *
* Cleaner manages entire setting namespace * It allows modules to delete for blogs or global a settings namespace.
* except 'delete_related' which can pickup settings ns/id pairs * It also allows to pick-up specific setting id by using delete_related action.
*/ */
class Settings extends AbstractCleaner class Settings extends AbstractCleaner
{ {
@ -46,6 +46,7 @@ class Settings extends AbstractCleaner
protected function actions(): array protected function actions(): array
{ {
return [ return [
// delete global $ns settings namespace
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete_global', 'id' => 'delete_global',
'select' => __('delete selected global settings namespaces'), 'select' => __('delete selected global settings namespaces'),
@ -53,6 +54,7 @@ class Settings extends AbstractCleaner
'success' => __('"%s" global settings namespace deleted'), 'success' => __('"%s" global settings namespace deleted'),
'error' => __('Failed to delete "%s" global settings namespace'), 'error' => __('Failed to delete "%s" global settings namespace'),
]), ]),
// delete blogs $ns settings namespace
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete_local', 'id' => 'delete_local',
'select' => __('delete selected blog settings namespaces'), 'select' => __('delete selected blog settings namespaces'),
@ -60,6 +62,7 @@ class Settings extends AbstractCleaner
'success' => __('"%s" blog settings namespace deleted'), 'success' => __('"%s" blog settings namespace deleted'),
'error' => __('Failed to delete "%s" blog settings namespace'), 'error' => __('Failed to delete "%s" blog settings namespace'),
]), ]),
// delete blogs and global settings namespace
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete_all', 'id' => 'delete_all',
'select' => __('delete selected settings namespaces'), 'select' => __('delete selected settings namespaces'),
@ -67,7 +70,7 @@ class Settings extends AbstractCleaner
'success' => __('"%s" settings namespace deleted'), 'success' => __('"%s" settings namespace deleted'),
'error' => __('Failed to delete "%s" settings namespace'), 'error' => __('Failed to delete "%s" settings namespace'),
]), ]),
// $ns = 'setting_ns:setting_id;setting_ns:setting_id;...' for global and blogs settings // delete blogs and globals specific $ns:$id settings using 'setting_ns:setting_id;setting_ns:setting_id;' as $ns
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete_related', 'id' => 'delete_related',
'query' => __('delete related settings'), 'query' => __('delete related settings'),

View File

@ -30,6 +30,11 @@ use Dotclear\Plugin\Uninstaller\{
ValueDescriptor ValueDescriptor
}; };
/**
* Cleaner for Dotclear cache directory used by modules.
*
* It allows modules to delete or truncate a database table.
*/
class Tables extends AbstractCleaner class Tables extends AbstractCleaner
{ {
protected function properties(): array protected function properties(): array
@ -44,6 +49,7 @@ class Tables extends AbstractCleaner
protected function actions(): array protected function actions(): array
{ {
return [ return [
// delete $ns database table
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete', 'id' => 'delete',
'select' => __('delete selected tables'), 'select' => __('delete selected tables'),
@ -51,6 +57,7 @@ class Tables extends AbstractCleaner
'success' => __('"%s" table deleted'), 'success' => __('"%s" table deleted'),
'error' => __('Failed to delete "%s" table'), 'error' => __('Failed to delete "%s" table'),
]), ]),
// truncate (empty) $ns database table
new ActionDescriptor([ new ActionDescriptor([
'id' => 'empty', 'id' => 'empty',
'select' => __('empty selected tables'), 'select' => __('empty selected tables'),

View File

@ -22,6 +22,11 @@ use Dotclear\Plugin\Uninstaller\{
ValueDescriptor ValueDescriptor
}; };
/**
* Cleaner for Dotclear themes.
*
* It allows modules to delete their own folder.
*/
class Themes extends AbstractCleaner class Themes extends AbstractCleaner
{ {
use TraitCleanerDir; use TraitCleanerDir;
@ -38,6 +43,7 @@ class Themes extends AbstractCleaner
protected function actions(): array protected function actions(): array
{ {
return [ return [
// delete $ns theme folder
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete', 'id' => 'delete',
'select' => __('delete selected themes files and directories'), 'select' => __('delete selected themes files and directories'),

View File

@ -21,6 +21,12 @@ use Dotclear\Plugin\Uninstaller\{
ValueDescriptor ValueDescriptor
}; };
/**
* Cleaner for Dotclear VAR directory used by modules.
*
* It allows modules to delete an entire sub folder
* of DC_VAR directory path.
*/
class Vars extends AbstractCleaner class Vars extends AbstractCleaner
{ {
use TraitCleanerDir; use TraitCleanerDir;
@ -37,6 +43,7 @@ class Vars extends AbstractCleaner
protected function actions(): array protected function actions(): array
{ {
return [ return [
// delete a $ns folder and their files
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete', 'id' => 'delete',
'select' => __('delete selected var directories'), 'select' => __('delete selected var directories'),

View File

@ -22,6 +22,12 @@ use Dotclear\Plugin\Uninstaller\{
ValueDescriptor ValueDescriptor
}; };
/**
* Cleaner for Dotclear modules versions.
*
* It allows modules to delete their versions
* from Dotclear dcCore::VERSION_TABLE_NAME database table.
*/
class Versions extends AbstractCleaner class Versions extends AbstractCleaner
{ {
protected function properties(): array protected function properties(): array
@ -36,6 +42,7 @@ class Versions extends AbstractCleaner
protected function actions(): array protected function actions(): array
{ {
return [ return [
// delete $ns version
new ActionDescriptor([ new ActionDescriptor([
'id' => 'delete', 'id' => 'delete',
'select' => __('delete selected versions numbers'), 'select' => __('delete selected versions numbers'),