From cfb0559c44e8e1343595855d6137e1675d911cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sun, 21 Apr 2024 01:31:01 +0200 Subject: [PATCH] Include RC iniset.php using async promise --- src/ExtensionInstaller.php | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/ExtensionInstaller.php b/src/ExtensionInstaller.php index 8cfbd61..5d0ca1a 100644 --- a/src/ExtensionInstaller.php +++ b/src/ExtensionInstaller.php @@ -73,10 +73,11 @@ private function initializeRoundcubemailEnvironment(): void public function install(InstalledRepositoryInterface $repo, PackageInterface $package) { $this->setRoundcubemailInstallPath($repo); - $this->initializeRoundcubemailEnvironment(); - $this->rcubeVersionCheck($package); $postInstall = function () use ($package) { + $this->initializeRoundcubemailEnvironment(); + $this->rcubeVersionCheck($package); + $config_file = $this->rcubeConfigFile(); $package_name = $this->getPackageName($package); $package_dir = $this->getInstallPath($package); @@ -134,20 +135,21 @@ public function install(InstalledRepositoryInterface $repo, PackageInterface $pa public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target) { $this->setRoundcubemailInstallPath($repo); - $this->initializeRoundcubemailEnvironment(); - $this->rcubeVersionCheck($target); - $extra = $target->getExtra(); - $fs = new Filesystem(); + $postUpdate = function () use ($initial, $target) { + $this->initializeRoundcubemailEnvironment(); + $this->rcubeVersionCheck($target); + + $extra = $target->getExtra(); + $fs = new Filesystem(); - // backup persistent files e.g. config.inc.php - $package_dir = $this->getInstallPath($initial); - $temp_dir = $package_dir . '-' . sprintf('%010d%010d', mt_rand(), mt_rand()); + // backup persistent files e.g. config.inc.php + $package_dir = $this->getInstallPath($initial); + $temp_dir = $package_dir . '-' . sprintf('%010d%010d', mt_rand(), mt_rand()); - // make a backup of existing files (for restoring persistent files) - $fs->copy($package_dir, $temp_dir); + // make a backup of existing files (for restoring persistent files) + $fs->copy($package_dir, $temp_dir); - $postUpdate = function () use ($target, $extra, $fs, $temp_dir) { $package_name = $this->getPackageName($target); $package_dir = $this->getInstallPath($target); @@ -199,11 +201,12 @@ public function update(InstalledRepositoryInterface $repo, PackageInterface $ini public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package) { $this->setRoundcubemailInstallPath($repo); - $this->initializeRoundcubemailEnvironment(); - $config = $this->composer->getConfig()->get('roundcube'); + $postUninstall = function () use ($package) { + $this->initializeRoundcubemailEnvironment(); + + $config = $this->composer->getConfig()->get('roundcube'); - $postUninstall = function () use ($package, $config) { // post-uninstall: deactivate package $package_name = $this->getPackageName($package); $package_dir = $this->getInstallPath($package);