diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b39dee6..3ccccbd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -116,3 +116,16 @@ jobs: cd test-composer/vendor/roundcube/roundcubemail ls -lah plugins/acl/config.* if [ ! -f plugins/acl/config.inc.php ]; then echo 'Config file was not created' && exit 1; fi + + - name: Test update - install plugin + run: | + cd test-composer + echo '// xxx no config update xxx' >> vendor/roundcube/roundcubemail/plugins/carddav/config.inc.php + composer update -v --prefer-dist --no-interaction --no-progress roundcube/carddav --prefer-lowest + + - name: Test update - verify install + run: | + cd test-composer + ls -lah vendor/roundcube/roundcubemail/plugins/carddav/config.* + if [ ! -f vendor/roundcube/roundcubemail/plugins/carddav/config.inc.php ]; then echo 'Config file was deleted' && exit 1; fi + if ! grep -Fq 'xxx no config update xxx' vendor/roundcube/roundcubemail/plugins/carddav/config.inc.php; then echo 'Config file was replaced' && exit 1; fi diff --git a/src/ExtensionInstaller.php b/src/ExtensionInstaller.php index 8cfbd61..e24cd01 100644 --- a/src/ExtensionInstaller.php +++ b/src/ExtensionInstaller.php @@ -63,13 +63,19 @@ public function getInstallPath(PackageInterface $package) private function initializeRoundcubemailEnvironment(): void { - // initialize Roundcube environment if (!defined('INSTALL_PATH')) { define('INSTALL_PATH', $this->getRoundcubemailInstallPath() . '/'); } require_once INSTALL_PATH . 'program/include/iniset.php'; } + public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package) + { + $this->setRoundcubemailInstallPath($repo); + + return parent::isInstalled($repo, $package); + } + public function install(InstalledRepositoryInterface $repo, PackageInterface $package) { $this->setRoundcubemailInstallPath($repo);