mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 11:00:40 +08:00
Add Upgrade Finalize Stage
- Split upgrade into 2 stages: install, finalize -- This is required as the container needs to be re-loaded before running the final step - From now on 2 commands will need to be executed
This commit is contained in:
parent
38a030e029
commit
533ce665af
13 changed files with 279 additions and 4 deletions
|
@ -217,6 +217,12 @@ services:
|
|||
- !tagged { tag: 'app.upgrade.step' }
|
||||
- '@monolog.logger.upgrade'
|
||||
|
||||
App\Install\Service\Upgrade\UpgradeFinalizeHandler:
|
||||
# inject all services tagged with app.upgrade.step as first argument
|
||||
arguments:
|
||||
- !tagged { tag: 'app.upgrade.step' }
|
||||
- '@monolog.logger.upgrade'
|
||||
|
||||
App\Install\Service\LegacyMigration\LegacyMigrationHandler:
|
||||
# inject all services tagged with app.legacy.migration.step as first argument
|
||||
arguments:
|
||||
|
|
93
core/backend/Install/Command/UpgradeFinalizeCommand.php
Normal file
93
core/backend/Install/Command/UpgradeFinalizeCommand.php
Normal file
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
/**
|
||||
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
|
||||
* Copyright (C) 2022 SalesAgility Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
|
||||
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License
|
||||
* version 3, these Appropriate Legal Notices must retain the display of the
|
||||
* "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
|
||||
* feasible for technical reasons, the Appropriate Legal Notices must display
|
||||
* the words "Supercharged by SuiteCRM".
|
||||
*/
|
||||
|
||||
namespace App\Install\Command;
|
||||
|
||||
use App\Engine\Service\ProcessSteps\ProcessStepExecutorInterface;
|
||||
use App\Install\Service\Upgrade\UpgradeFinalizeHandlerInterface;
|
||||
|
||||
/**
|
||||
* Class UpgradeFinalizeCommand
|
||||
* @package App\Install\Command
|
||||
*/
|
||||
class UpgradeFinalizeCommand extends BaseStepExecutorCommand
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected static $defaultName = 'suitecrm:app:upgrade-finalize';
|
||||
|
||||
/**
|
||||
* @var UpgradeFinalizeHandlerInterface
|
||||
*/
|
||||
protected $handler;
|
||||
|
||||
/**
|
||||
* UpgradeFinalizeCommand constructor.
|
||||
* @param UpgradeFinalizeHandlerInterface $handler
|
||||
*/
|
||||
public function __construct(UpgradeFinalizeHandlerInterface $handler)
|
||||
{
|
||||
$this->handler = $handler;
|
||||
|
||||
$this->initSession = true;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
parent::configure();
|
||||
|
||||
$this->setDescription('Finalize the application upgrade')
|
||||
->setHelp('This command will finalize the upgrade of the SuiteCRM 8 and legacy application');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function getContext(array $arguments): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function getTitle(): string
|
||||
{
|
||||
return 'SuiteCRM Finalize Upgrade ';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function getHandler(): ProcessStepExecutorInterface
|
||||
{
|
||||
return $this->handler;
|
||||
}
|
||||
}
|
|
@ -42,6 +42,7 @@ class CheckPackage implements UpgradeStepInterface
|
|||
|
||||
public const HANDLER_KEY = 'check-package';
|
||||
public const POSITION = 300;
|
||||
public const STAGE = 'upgrade-install';
|
||||
|
||||
/**
|
||||
* @var UpgradePackageHandler
|
||||
|
@ -73,6 +74,14 @@ class CheckPackage implements UpgradeStepInterface
|
|||
return self::POSITION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getStage(): string
|
||||
{
|
||||
return self::STAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
|
|
@ -42,6 +42,7 @@ class CheckPermissions implements UpgradeStepInterface
|
|||
|
||||
public const HANDLER_KEY = 'check-permissions';
|
||||
public const POSITION = 500;
|
||||
public const STAGE = 'upgrade-install';
|
||||
|
||||
/**
|
||||
* @var UpgradePackageHandler
|
||||
|
@ -73,6 +74,14 @@ class CheckPermissions implements UpgradeStepInterface
|
|||
return self::POSITION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getStage(): string
|
||||
{
|
||||
return self::STAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,8 @@ class ClearSymfonyCache implements UpgradeStepInterface
|
|||
use ProcessStepTrait;
|
||||
|
||||
public const HANDLER_KEY = 'clear-symfony-cache';
|
||||
public const POSITION = 900;
|
||||
public const POSITION = 800;
|
||||
public const STAGE = 'upgrade-install';
|
||||
|
||||
/**
|
||||
* @var CacheBridge
|
||||
|
@ -74,6 +75,14 @@ class ClearSymfonyCache implements UpgradeStepInterface
|
|||
return self::POSITION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getStage(): string
|
||||
{
|
||||
return self::STAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws Exception
|
||||
|
|
|
@ -42,6 +42,7 @@ class ExtractPackage implements UpgradeStepInterface
|
|||
|
||||
public const HANDLER_KEY = 'extract-package';
|
||||
public const POSITION = 400;
|
||||
public const STAGE = 'upgrade-install';
|
||||
|
||||
/**
|
||||
* @var UpgradePackageHandler
|
||||
|
@ -73,6 +74,14 @@ class ExtractPackage implements UpgradeStepInterface
|
|||
return self::POSITION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getStage(): string
|
||||
{
|
||||
return self::STAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
|
|
@ -42,6 +42,7 @@ class InstallUpgradePackage implements UpgradeStepInterface
|
|||
|
||||
public const HANDLER_KEY = 'install-upgrade-package';
|
||||
public const POSITION = 600;
|
||||
public const STAGE = 'upgrade-install';
|
||||
|
||||
/**
|
||||
* @var UpgradePackageHandler
|
||||
|
@ -73,6 +74,14 @@ class InstallUpgradePackage implements UpgradeStepInterface
|
|||
return self::POSITION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getStage(): string
|
||||
{
|
||||
return self::STAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,8 @@ class LegacyPostUpgrade implements UpgradeStepInterface
|
|||
use ProcessStepTrait;
|
||||
|
||||
public const HANDLER_KEY = 'legacy-post-upgrade';
|
||||
public const POSITION = 800;
|
||||
public const POSITION = 700;
|
||||
public const STAGE = 'upgrade-finalize';
|
||||
|
||||
/**
|
||||
* @var PostUpgradeHandler
|
||||
|
@ -73,6 +74,14 @@ class LegacyPostUpgrade implements UpgradeStepInterface
|
|||
return self::POSITION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getStage(): string
|
||||
{
|
||||
return self::STAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,8 @@ class RunMigrations implements UpgradeStepInterface
|
|||
use ProcessStepTrait;
|
||||
|
||||
public const HANDLER_KEY = 'run-migrations';
|
||||
public const POSITION = 700;
|
||||
public const POSITION = 900;
|
||||
public const STAGE = 'upgrade-finalize';
|
||||
|
||||
/**
|
||||
* @var MigrationBridge
|
||||
|
@ -74,6 +75,14 @@ class RunMigrations implements UpgradeStepInterface
|
|||
return self::POSITION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getStage(): string
|
||||
{
|
||||
return self::STAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws Exception
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
|
||||
* Copyright (C) 2022 SalesAgility Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
|
||||
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License
|
||||
* version 3, these Appropriate Legal Notices must retain the display of the
|
||||
* "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
|
||||
* feasible for technical reasons, the Appropriate Legal Notices must display
|
||||
* the words "Supercharged by SuiteCRM".
|
||||
*/
|
||||
|
||||
namespace App\Install\Service\Upgrade;
|
||||
|
||||
use App\Engine\Service\ProcessSteps\ProcessStepExecutor;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class UpgradeFinalizeHandler extends ProcessStepExecutor implements UpgradeFinalizeHandlerInterface
|
||||
{
|
||||
/**
|
||||
* UpgradeHandler constructor.
|
||||
* @param iterable $handlers
|
||||
* @param LoggerInterface $upgradeLogger
|
||||
*/
|
||||
public function __construct(
|
||||
iterable $handlers,
|
||||
LoggerInterface $upgradeLogger
|
||||
) {
|
||||
$this->logger = $upgradeLogger;
|
||||
|
||||
$upgradeFinalizeHandlers = [];
|
||||
|
||||
/**@var $handlers UpgradeStepInterface[] */
|
||||
foreach ($handlers as $handler) {
|
||||
if ($handler->getStage() === 'upgrade-finalize') {
|
||||
$upgradeFinalizeHandlers[] = $handler;
|
||||
}
|
||||
}
|
||||
|
||||
$this->initSteps($upgradeFinalizeHandlers, $this->logger);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
|
||||
* Copyright (C) 2022 SalesAgility Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
|
||||
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License
|
||||
* version 3, these Appropriate Legal Notices must retain the display of the
|
||||
* "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
|
||||
* feasible for technical reasons, the Appropriate Legal Notices must display
|
||||
* the words "Supercharged by SuiteCRM".
|
||||
*/
|
||||
|
||||
namespace App\Install\Service\Upgrade;
|
||||
|
||||
use App\Engine\Service\ProcessSteps\ProcessStepExecutorInterface;
|
||||
|
||||
/**
|
||||
* Interface UpgradeFinalizeHandlerInterface
|
||||
* Used to allow extensibility
|
||||
* @package App\Install\Service\Upgrade
|
||||
*/
|
||||
interface UpgradeFinalizeHandlerInterface extends ProcessStepExecutorInterface
|
||||
{
|
||||
}
|
|
@ -42,7 +42,17 @@ class UpgradeHandler extends ProcessStepExecutor implements UpgradeHandlerInterf
|
|||
LoggerInterface $upgradeLogger
|
||||
) {
|
||||
$this->logger = $upgradeLogger;
|
||||
$this->initSteps($handlers, $this->logger);
|
||||
|
||||
$upgradeInstallHandlers = [];
|
||||
|
||||
/**@var $handlers UpgradeStepInterface[] */
|
||||
foreach ($handlers as $handler) {
|
||||
if ($handler->getStage() === 'upgrade-install') {
|
||||
$upgradeInstallHandlers[] = $handler;
|
||||
}
|
||||
}
|
||||
|
||||
$this->initSteps($upgradeInstallHandlers, $this->logger);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,4 +37,10 @@ use App\Engine\Model\ProcessStepInterface;
|
|||
interface UpgradeStepInterface extends ProcessStepInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Get stage
|
||||
* @return string
|
||||
*/
|
||||
public function getStage(): string;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue