Skip to content

Commit

Permalink
Remove old upgrade code
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlavtox committed Aug 24, 2023
1 parent 014ac06 commit 19020f3
Show file tree
Hide file tree
Showing 292 changed files with 18 additions and 17,674 deletions.
6 changes: 0 additions & 6 deletions classes/TaskRunner/Upgrade/UpgradeDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

use PrestaShop\Module\AutoUpgrade\TaskRunner\AbstractTask;
use PrestaShop\Module\AutoUpgrade\UpgradeException;
use PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader16;
use PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader17;
use PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader80;
use PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader81;
Expand Down Expand Up @@ -61,10 +60,6 @@ public function run()

public function getCoreUpgrader()
{
if (version_compare($this->container->getState()->getInstallVersion(), '1.7', '<')) {
return new CoreUpgrader16($this->container, $this->logger);
}

if (version_compare($this->container->getState()->getInstallVersion(), '8', '<')) {
return new CoreUpgrader17($this->container, $this->logger);
}
Expand All @@ -85,7 +80,6 @@ public function init()

// Migrating settings file
$this->container->initPrestaShopAutoloader();
(new SettingsFileWriter($this->translator))->migrateSettingsFile($this->logger);
parent::init();
}
}
3 changes: 1 addition & 2 deletions classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ protected function initConstants()
define('SETTINGS_FILE_YML', $this->container->getProperty(UpgradeContainer::PS_ROOT_PATH) . '/app/config/parameters.yml');
define('DEFINES_FILE', $this->container->getProperty(UpgradeContainer::PS_ROOT_PATH) . '/config/defines.inc.php');
define('INSTALLER__PS_BASE_URI', substr($_SERVER['REQUEST_URI'], 0, -1 * (strlen($_SERVER['REQUEST_URI']) - strrpos($_SERVER['REQUEST_URI'], '/')) - strlen(substr(dirname($_SERVER['REQUEST_URI']), strrpos(dirname($_SERVER['REQUEST_URI']), '/') + 1))));
// define('INSTALLER__PS_BASE_URI_ABSOLUTE', 'http://'.ToolsInstall::getHttpHost(false, true).INSTALLER__PS_BASE_URI);

define('_PS_INSTALL_PATH_', $this->pathToInstallFolder . '/');
define('_PS_INSTALL_DATA_PATH_', _PS_INSTALL_PATH_ . 'data/');
Expand Down Expand Up @@ -675,7 +674,7 @@ protected function updateTheme()
}

$this->logger->info($this->container->getTranslator()->trans('Switching to default theme.', [], 'Modules.Autoupgrade.Admin'));
$themeAdapter = new ThemeAdapter($this->db, $this->destinationUpgradeVersion);
$themeAdapter = new ThemeAdapter($this->db);

Cache::clean('*');

Expand Down
186 changes: 0 additions & 186 deletions classes/UpgradeTools/CoreUpgrader/CoreUpgrader16.php

This file was deleted.

2 changes: 1 addition & 1 deletion classes/UpgradeTools/CoreUpgrader/CoreUpgrader17.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected function updateRTLFiles()
return;
}
$this->logger->info($this->container->getTranslator()->trans('Upgrade the RTL files.', [], 'Modules.Autoupgrade.Admin'));
$themeAdapter = new ThemeAdapter($this->db, $this->destinationUpgradeVersion);
$themeAdapter = new ThemeAdapter($this->db);

$themes = $themeAdapter->getListFromDisk();
$this->removeExistingRTLFiles($themes);
Expand Down
4 changes: 1 addition & 3 deletions classes/UpgradeTools/ModuleAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,7 @@ public function upgradeModule($id, $name)
unlink($zip_fullpath);
}

// Only 1.7 step
if (version_compare($this->upgradeVersion, '1.7.0.0', '>=')
&& !$this->doUpgradeModule($name)) {
if (!$this->doUpgradeModule($name)) {
throw (new UpgradeException('<strong>' . $this->translator->trans('[WARNING] Error when trying to upgrade module %s.', [$name], 'Modules.Autoupgrade.Admin') . '</strong>'))->setSeverity(UpgradeException::SEVERITY_WARNING)->setQuickInfos(\Module::getInstanceByName($name)->getErrors());
}
}
Expand Down
89 changes: 0 additions & 89 deletions classes/UpgradeTools/SettingsFileWriter.php

This file was deleted.

26 changes: 4 additions & 22 deletions classes/UpgradeTools/ThemeAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,10 @@
class ThemeAdapter
{
private $db;
private $upgradeVersion;

public function __construct($db, $upgradeVersion)
public function __construct($db)
{
$this->db = $db;
$this->upgradeVersion = $upgradeVersion;
}

/**
* Enable the given theme on the shop.
*
* @param string $themeName
*
* @return mixed
*/
public function enableTheme($themeName)
{
return version_compare($this->upgradeVersion, '1.7.0.0', '>=') ?
$this->enableTheme17($themeName) :
$this->enableTheme16($themeName);
}

/**
Expand All @@ -59,9 +43,7 @@ public function enableTheme($themeName)
*/
public function getDefaultTheme()
{
return version_compare($this->upgradeVersion, '1.7.0.0', '>=') ?
'classic' : // 1.7
'default-bootstrap'; // 1.6
return 'classic';
}

/**
Expand Down Expand Up @@ -100,13 +82,13 @@ private function enableTheme16($themeName)
}

/**
* Use 1.7 theme manager is order to enable the new theme.
* Use theme manager is order to enable the new theme.
*
* @param string $themeName
*
* @return bool|array
*/
private function enableTheme17($themeName)
private function enableTheme($themeName)
{
$themeManager = $this->getThemeManager();

Expand Down

0 comments on commit 19020f3

Please sign in to comment.