From b5d2eb93aa532da785d080816144e4a4b252f4bb Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Tue, 17 Feb 2015 13:46:37 +0200 Subject: [PATCH] Upgrades: impoved beforeRunAction(), afterRunAction() --- application/Espo/Core/Upgrades/Actions/Base/Install.php | 8 ++++---- application/Espo/Core/Upgrades/Actions/Base/Uninstall.php | 8 ++++---- application/Espo/Core/Upgrades/Actions/Base/Upload.php | 4 ++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/application/Espo/Core/Upgrades/Actions/Base/Install.php b/application/Espo/Core/Upgrades/Actions/Base/Install.php index 85b4a42b99..512b6362b8 100644 --- a/application/Espo/Core/Upgrades/Actions/Base/Install.php +++ b/application/Espo/Core/Upgrades/Actions/Base/Install.php @@ -66,11 +66,11 @@ class Install extends \Espo\Core\Upgrades\Actions\Base $this->backupExistingFiles(); + $this->beforeRunAction(); + /* run before install script */ $this->runScript('before'); - $this->beforeRunAction(); - /* copy files from directory "Files" to EspoCRM files */ if (!$this->copyFiles()) { $this->throwErrorAndRemovePackage('Cannot copy files.'); @@ -84,11 +84,11 @@ class Install extends \Espo\Core\Upgrades\Actions\Base $this->throwErrorAndRemovePackage('Error occurred while EspoCRM rebuild.'); } - $this->afterRunAction(); - /* run before install script */ $this->runScript('after'); + $this->afterRunAction(); + $this->clearCache(); /* delete unziped files */ diff --git a/application/Espo/Core/Upgrades/Actions/Base/Uninstall.php b/application/Espo/Core/Upgrades/Actions/Base/Uninstall.php index 910ad9dd29..0c39b42b16 100644 --- a/application/Espo/Core/Upgrades/Actions/Base/Uninstall.php +++ b/application/Espo/Core/Upgrades/Actions/Base/Uninstall.php @@ -41,11 +41,11 @@ class Uninstall extends \Espo\Core\Upgrades\Actions\Base $this->checkIsWritable(); + $this->beforeRunAction(); + /* run before install script */ $this->runScript('beforeUninstall'); - $this->beforeRunAction(); - $backupPath = $this->getPath('backupPath'); if (file_exists($backupPath)) { @@ -64,11 +64,11 @@ class Uninstall extends \Espo\Core\Upgrades\Actions\Base throw new $this->throwErrorAndRemovePackage('Error occurred while EspoCRM rebuild.'); } - $this->afterRunAction(); - /* run before install script */ $this->runScript('afterUninstall'); + $this->afterRunAction(); + $this->clearCache(); /* delete backup files */ diff --git a/application/Espo/Core/Upgrades/Actions/Base/Upload.php b/application/Espo/Core/Upgrades/Actions/Base/Upload.php index 03ebae176e..1effbd029d 100644 --- a/application/Espo/Core/Upgrades/Actions/Base/Upload.php +++ b/application/Espo/Core/Upgrades/Actions/Base/Upload.php @@ -40,6 +40,8 @@ class Upload extends \Espo\Core\Upgrades\Actions\Base $this->initialize(); + $this->beforeRunAction(); + $packagePath = $this->getPackagePath(); $packageArchivePath = $this->getPackagePath(true); @@ -57,6 +59,8 @@ class Upload extends \Espo\Core\Upgrades\Actions\Base $this->isAcceptable(); + $this->afterRunAction(); + $this->finalize(); $GLOBALS['log']->debug('Installation process ['.$processId.']: end upload the package.');