diff --git a/composer.json b/composer.json index f08d7df..ce412a2 100644 --- a/composer.json +++ b/composer.json @@ -31,12 +31,6 @@ "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-strict-rules": "^1.3" }, - "repositories": [ - { - "type": "git", - "url": "https://github.com/roundcube/roundcubemail.git" - } - ], "minimum-stability": "dev", "prefer-stable": true, "autoload": { 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); diff --git a/test-composer/composer.json b/test-composer/composer.json index cd3533a..d3e8bbe 100644 --- a/test-composer/composer.json +++ b/test-composer/composer.json @@ -1,13 +1,10 @@ { "name": "roundcube/plugin-installer-test", "require": { - "roundcube/carddav": "^4 || ^5" + "roundcube/carddav": "^4 || ^5", + "roundcube/roundcubemail": "dev-master as 1.99" }, "repositories": [ - { - "type": "git", - "url": "https://github.com/roundcube/roundcubemail.git" - }, { "type": "path", "url": ".."