From 815b581977ca44f747f3019f628a6da765d30e76 Mon Sep 17 00:00:00 2001 From: Morgan Pichat Date: Fri, 6 Sep 2024 15:33:28 +0200 Subject: [PATCH] Drop server performance configuration --- classes/Analytics.php | 1 - classes/Parameters/UpgradeConfiguration.php | 28 ++++++------------- classes/Twig/Form/UpgradeOptionsForm.php | 19 ------------- .../admin/AdminSelfUpgradeController.php | 10 ------- tests/unit/AnalyticsTest.php | 2 -- .../Progress/CompletionCalculatorTest.php | 1 - 6 files changed, 9 insertions(+), 52 deletions(-) diff --git a/classes/Analytics.php b/classes/Analytics.php index 414f3491c..02220c4f1 100644 --- a/classes/Analytics.php +++ b/classes/Analytics.php @@ -118,7 +118,6 @@ public function getProperties($type) 'upgrade_channel' => $this->upgradeConfiguration->getChannel(), 'backup_files_and_databases' => $this->upgradeConfiguration->shouldBackupFilesAndDatabase(), 'backup_images' => $this->upgradeConfiguration->shouldBackupImages(), - 'server_performance' => $this->upgradeConfiguration->getPerformanceLevel(), 'disable_non_native_modules' => $this->upgradeConfiguration->shouldDeactivateCustomModules(), 'upgrade_default_theme' => $this->upgradeConfiguration->shouldUpdateDefaultTheme(), 'switch_to_default_theme' => $this->upgradeConfiguration->shouldSwitchToDefaultTheme(), diff --git a/classes/Parameters/UpgradeConfiguration.php b/classes/Parameters/UpgradeConfiguration.php index a0d26232e..251844d9c 100644 --- a/classes/Parameters/UpgradeConfiguration.php +++ b/classes/Parameters/UpgradeConfiguration.php @@ -39,7 +39,6 @@ class UpgradeConfiguration extends ArrayCollection { const UPGRADE_CONST_KEYS = [ - 'PS_AUTOUP_PERFORMANCE', 'PS_AUTOUP_CUSTOM_MOD_DESACT', 'PS_AUTOUP_UPDATE_DEFAULT_THEME', 'PS_AUTOUP_CHANGE_DEFAULT_THEME', @@ -51,7 +50,6 @@ class UpgradeConfiguration extends ArrayCollection ]; const PS_CONST_DEFAULT_VALUE = [ - 'PS_AUTOUP_PERFORMANCE' => 1, 'PS_AUTOUP_CUSTOM_MOD_DESACT' => 1, 'PS_AUTOUP_UPDATE_DEFAULT_THEME' => 1, 'PS_AUTOUP_CHANGE_DEFAULT_THEME' => 0, @@ -64,13 +62,13 @@ class UpgradeConfiguration extends ArrayCollection /** * Performance settings, if your server has a low memory size, lower these values. * - * @var array + * @var array */ private const PERFORMANCE_VALUES = [ - 'loopFiles' => [400, 800, 1600], // files - 'loopTime' => [6, 12, 25], // seconds - 'maxBackupFileSize' => [15728640, 31457280, 62914560], // bytes - 'maxWrittenAllowed' => [4194304, 8388608, 16777216], // bytes + 'loopFiles' => 400, // files + 'loopTime' => 6, // seconds + 'maxBackupFileSize' => 15728640, // bytes + 'maxWrittenAllowed' => 4194304, // bytes ]; /** @@ -102,7 +100,7 @@ public function getChannel(): string */ public function getNumberOfFilesPerCall(): int { - return $this::PERFORMANCE_VALUES['loopFiles'][$this->getPerformanceLevel()]; + return $this::PERFORMANCE_VALUES['loopFiles']; } /** @@ -110,7 +108,7 @@ public function getNumberOfFilesPerCall(): int */ public function getTimePerCall(): int { - return $this::PERFORMANCE_VALUES['loopTime'][$this->getPerformanceLevel()]; + return $this::PERFORMANCE_VALUES['loopTime']; } /** @@ -118,7 +116,7 @@ public function getTimePerCall(): int */ public function getMaxSizeToWritePerCall(): int { - return $this::PERFORMANCE_VALUES['maxWrittenAllowed'][$this->getPerformanceLevel()]; + return $this::PERFORMANCE_VALUES['maxWrittenAllowed']; } /** @@ -126,15 +124,7 @@ public function getMaxSizeToWritePerCall(): int */ public function getMaxFileToBackup(): int { - return $this::PERFORMANCE_VALUES['maxBackupFileSize'][$this->getPerformanceLevel()]; - } - - /** - * @return int level of performance selected (0 for low, 2 for high) - */ - public function getPerformanceLevel(): int - { - return $this->get('PS_AUTOUP_PERFORMANCE') - 1; + return $this::PERFORMANCE_VALUES['maxBackupFileSize']; } public function shouldBackupFilesAndDatabase(): bool diff --git a/classes/Twig/Form/UpgradeOptionsForm.php b/classes/Twig/Form/UpgradeOptionsForm.php index 6fcee5102..1327c66d2 100644 --- a/classes/Twig/Form/UpgradeOptionsForm.php +++ b/classes/Twig/Form/UpgradeOptionsForm.php @@ -52,25 +52,6 @@ public function __construct(Translator $translator, FormRenderer $formRenderer) $this->formRenderer = $formRenderer; $this->fields = [ - 'PS_AUTOUP_PERFORMANCE' => [ - 'title' => $translator->trans( - 'Server performance' - ), - 'cast' => 'intval', - 'validation' => 'isInt', - 'defaultValue' => '1', - 'type' => 'select', 'desc' => $translator->trans( - 'Unless you are using a dedicated server, select "Low".' - ) . '
' . - $translator->trans( - 'A high value can cause the upgrade to fail if your server is not powerful enough to process the upgrade tasks in a short amount of time.' - ), - 'choices' => [ - 1 => $translator->trans('Low (recommended)'), - 2 => $translator->trans('Medium'), - 3 => $translator->trans('High'), - ], - ], 'PS_AUTOUP_CUSTOM_MOD_DESACT' => [ 'title' => $translator->trans('Disable non-native modules'), 'cast' => 'intval', diff --git a/controllers/admin/AdminSelfUpgradeController.php b/controllers/admin/AdminSelfUpgradeController.php index a6479631f..36a01dd8f 100644 --- a/controllers/admin/AdminSelfUpgradeController.php +++ b/controllers/admin/AdminSelfUpgradeController.php @@ -214,16 +214,6 @@ private function _setFields() ], ]; $this->_fieldsUpgradeOptions = [ - 'PS_AUTOUP_PERFORMANCE' => [ - 'title' => $this->trans('Server performance'), - 'cast' => 'intval', - 'validation' => 'isInt', - 'defaultValue' => '1', - 'type' => 'select', - 'desc' => $this->trans('Unless you are using a dedicated server, select "Low".') . '
' . - $this->trans('A high value can cause the upgrade to fail if your server is not powerful enough to process the upgrade tasks in a short amount of time.'), - 'choices' => [1 => $this->trans('Low (recommended)'), 2 => $this->trans('Medium'), 3 => $this->trans('High')], - ], 'PS_AUTOUP_CUSTOM_MOD_DESACT' => [ 'title' => $this->trans('Disable non-native modules'), 'cast' => 'intval', diff --git a/tests/unit/AnalyticsTest.php b/tests/unit/AnalyticsTest.php index 1fde16925..9046374d1 100644 --- a/tests/unit/AnalyticsTest.php +++ b/tests/unit/AnalyticsTest.php @@ -37,7 +37,6 @@ public function testProperties() ->setInstallVersion('8.8.808') ->setRestoreName('V1.2.3_blablabla-🐶'); $upgradeConfiguration = (new UpgradeConfiguration([ - 'PS_AUTOUP_PERFORMANCE' => 5, 'PS_AUTOUP_CUSTOM_MOD_DESACT' => 0, 'PS_AUTOUP_UPDATE_DEFAULT_THEME' => 1, 'PS_AUTOUP_CHANGE_DEFAULT_THEME' => 1, @@ -93,7 +92,6 @@ public function testProperties() 'upgrade_channel' => 'major', 'backup_files_and_databases' => true, 'backup_images' => false, - 'server_performance' => 4, 'disable_non_native_modules' => false, 'upgrade_default_theme' => true, 'switch_to_default_theme' => true, diff --git a/tests/unit/Progress/CompletionCalculatorTest.php b/tests/unit/Progress/CompletionCalculatorTest.php index ba8626e11..57b838687 100644 --- a/tests/unit/Progress/CompletionCalculatorTest.php +++ b/tests/unit/Progress/CompletionCalculatorTest.php @@ -111,7 +111,6 @@ private function getCompletionCalculator(bool $withBackup): CompletionCalculator { return new CompletionCalculator( new UpgradeConfiguration([ - 'PS_AUTOUP_PERFORMANCE' => 5, 'PS_AUTOUP_CUSTOM_MOD_DESACT' => 0, 'PS_AUTOUP_UPDATE_DEFAULT_THEME' => 1, 'PS_AUTOUP_CHANGE_DEFAULT_THEME' => 1,