From f3c965fe53101903f73da5e4018e2c200288b2f9 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Mon, 18 Sep 2023 09:29:11 +0200 Subject: [PATCH] more cleaning of planned backup-feature (postponed, see backup-feature branch) Signed-off-by: Michael Kaufmann --- actions/admin/settings/230.backup.php | 96 ------------------- admin_customers.php | 35 ------- bin/froxlor-cli | 2 - composer.json | 1 - composer.lock | 3 +- install/froxlor.sql.php | 8 -- .../updates/preconfig/preconfig_2.1.inc.php | 14 +-- 7 files changed, 2 insertions(+), 157 deletions(-) delete mode 100644 actions/admin/settings/230.backup.php diff --git a/actions/admin/settings/230.backup.php b/actions/admin/settings/230.backup.php deleted file mode 100644 index 6d2a1769..00000000 --- a/actions/admin/settings/230.backup.php +++ /dev/null @@ -1,96 +0,0 @@ - - * @license https://files.froxlor.org/misc/COPYING.txt GPLv2 - */ - -return [ - 'groups' => [ - 'backup' => [ - 'title' => lng('backup'), - 'icon' => 'fa-solid fa-sliders', - 'advanced_mode' => true, - 'fields' => [ - 'backup_enabled' => [ - 'label' => lng('serversettings.backup_enabled'), - 'settinggroup' => 'backup', - 'varname' => 'enabled', - 'type' => 'checkbox', - 'default' => false, - 'save_method' => 'storeSettingField', - 'overview_option' => true, - 'cronmodule' => 'froxlor/backup' - ], - 'backup_default_storage' => [ - 'label' => lng('serversettings.backup_default_storage'), - 'settinggroup' => 'backup', - 'varname' => 'default_storage', - 'type' => 'select', - 'default' => '1', - 'option_options_method' => [ - '\\Froxlor\\Backup\\Backup', - 'getBackupStorages' - ], - 'save_method' => 'storeSettingField' - ], - 'backup_default_retention' => [ - 'label' => lng('serversettings.backup_default_retention'), - 'settinggroup' => 'backup', - 'varname' => 'default_retention', - 'type' => 'number', - 'default' => 3, - 'min' => 0, - 'save_method' => 'storeSettingField', - ], - 'backup_default_customer_access' => [ - 'label' => lng('serversettings.backup_default_customer_access'), - 'settinggroup' => 'backup', - 'varname' => 'default_customer_access', - 'type' => 'checkbox', - 'default' => true, - 'save_method' => 'storeSettingField', - ], - 'backup_default_pgp_public_key' => [ - 'label' => lng('serversettings.backup_default_pgp_public_key'), - 'settinggroup' => 'backup', - 'varname' => 'default_pgp_public_key', - 'type' => 'textarea', - 'default' => '', - 'save_method' => 'storeSettingField', - 'plausibility_check_method' => [ - '\\Froxlor\\Validate\\Check', - 'checkPgpPublicKeySetting' - ], - ], - 'backup_backup_tmp_dir' => [ - 'label' => lng('serversettings.backup_tmp_dir'), - 'settinggroup' => 'backup', - 'varname' => 'backup_tmp_dir', - 'type' => 'text', - 'string_type' => 'dir', - 'default' => '/var/customers/backup/', - 'save_method' => 'storeSettingField' - ] - ] - ] - ] -]; diff --git a/admin_customers.php b/admin_customers.php index 1adf7dd6..72062cca 100644 --- a/admin_customers.php +++ b/admin_customers.php @@ -27,7 +27,6 @@ const AREA = 'admin'; require __DIR__ . '/lib/init.php'; use Froxlor\Api\Commands\Admins; -use Froxlor\Api\Commands\BackupStorages; use Froxlor\Api\Commands\Customers; use Froxlor\Api\Commands\MysqlServer; use Froxlor\CurrentUser; @@ -226,23 +225,6 @@ if (($page == 'customers' || $page == 'overview') && $userinfo['customers'] != ' $hosting_plans[$row['id']] = $row['name']; } - // backup storages - $backup_storages = []; - if (Settings::Get('backup.enabled') == '1' && $userinfo['change_serversettings'] == '1') { - $backup_storages = [ - 0 => lng('backup.storage_none') - ]; - try { - $result_json = BackupStorages::getLocal($userinfo)->listing(); - $result_decoded = json_decode($result_json, true)['data']['list']; - foreach ($result_decoded as $storagedata) { - $backup_storages[$storagedata['id']] = "[" . $storagedata['type'] . "] " . html_entity_decode($storagedata['description']); - } - } catch (Exception $e) { - /* just none */ - } - } - $customer_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_add.php'; UI::view('user/form.html.twig', [ @@ -325,23 +307,6 @@ if (($page == 'customers' || $page == 'overview') && $userinfo['customers'] != ' $hosting_plans[$row['id']] = $row['name']; } - // backup storages - $backup_storages = []; - if (Settings::Get('backup.enabled') == '1' && $userinfo['change_serversettings'] == '1') { - $backup_storages = [ - 0 => lng('backup.storage_none') - ]; - try { - $result_json = BackupStorages::getLocal($userinfo)->listing(); - $result_decoded = json_decode($result_json, true)['data']['list']; - foreach ($result_decoded as $storagedata) { - $backup_storages[$storagedata['id']] = "[" . $storagedata['type'] . "] " . html_entity_decode($storagedata['description']); - } - } catch (Exception $e) { - /* just none */ - } - } - $available_admins_stmt = Database::prepare(" SELECT * FROM `" . TABLE_PANEL_ADMINS . "` WHERE (`customers` = '-1' OR `customers` > `customers_used`) diff --git a/bin/froxlor-cli b/bin/froxlor-cli index 4f4b7ef8..6301a426 100755 --- a/bin/froxlor-cli +++ b/bin/froxlor-cli @@ -26,7 +26,6 @@ declare(strict_types=1); -use Froxlor\Cli\BackupCommand; use Froxlor\Cli\ConfigDiff; use Symfony\Component\Console\Application; use Froxlor\Cli\RunApiCommand; @@ -63,6 +62,5 @@ $application->add(new InstallCommand()); $application->add(new MasterCron()); $application->add(new UserCommand()); $application->add(new ValidateAcmeWebroot()); -$application->add(new BackupCommand()); $application->add(new ConfigDiff()); $application->run(); diff --git a/composer.json b/composer.json index 713cb08c..5ec331e0 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,6 @@ "ext-fileinfo": "*", "ext-gmp": "*", "ext-gd": "*", - "ext-ftp": "*", "ext-gnupg": "*", "phpmailer/phpmailer": "~6.0", "monolog/monolog": "^1.24", diff --git a/composer.lock b/composer.lock index 3418278e..a24fe7bd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "68bd39384604fb2afbfe7596496adc72", + "content-hash": "1f9acc318c920b38ee8141e74298655a", "packages": [ { "name": "amnuts/opcache-gui", @@ -4532,7 +4532,6 @@ "ext-fileinfo": "*", "ext-gmp": "*", "ext-gd": "*", - "ext-ftp": "*", "ext-gnupg": "*" }, "platform-dev": { diff --git a/install/froxlor.sql.php b/install/froxlor.sql.php index e6383208..fabae64b 100644 --- a/install/froxlor.sql.php +++ b/install/froxlor.sql.php @@ -223,8 +223,6 @@ CREATE TABLE `panel_customers` ( `api_allowed` tinyint(1) NOT NULL default '1', `logviewenabled` tinyint(1) NOT NULL default '0', `allowed_mysqlserver` text NOT NULL, - `backup` int(11) NOT NULL default '1', - `access_backups` tinyint(1) NOT NULL default '1', PRIMARY KEY (`customerid`), UNIQUE KEY `loginname` (`loginname`) ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci ROW_FORMAT=DYNAMIC; @@ -702,12 +700,6 @@ opcache.validate_timestamps'), ('system', 'traffictool', 'goaccess'), ('system', 'req_limit_per_interval', 60), ('system', 'req_limit_interval', 60), - ('backup', 'enabled', 0), - ('backup', 'default_storage', '1'), - ('backup', 'default_customer_access', '1'), - ('backup', 'default_pgp_public_key', ''), - ('backup', 'default_retention', '3'), - ('backup', 'backup_tmp_dir', '/var/customers/backup/'), ('api', 'enabled', '0'), ('api', 'customer_default', '1'), ('2fa', 'enabled', '1'), diff --git a/install/updates/preconfig/preconfig_2.1.inc.php b/install/updates/preconfig/preconfig_2.1.inc.php index 95401f62..88529296 100644 --- a/install/updates/preconfig/preconfig_2.1.inc.php +++ b/install/updates/preconfig/preconfig_2.1.inc.php @@ -36,19 +36,7 @@ $preconfig = [ $return = []; if (Update::versionInUpdate($current_version, '2.1.0-dev1')) { - // Backup - $description = 'Froxlor now comes with a backup capability (More info see [DOCS LINK].'; - $question = 'Would you like to enable the backup-feature (default: yes)'; - $return['panel_settings_mode'] = [ - 'type' => 'select', - 'select_var' => [ - 0 => 'No', - 1 => 'Yes' - ], - 'selected' => 1, - 'label' => $question, - 'prior_infotext' => $description - ]; + } $preconfig['fields'] = $return;