Skip to content

Commit c4335e2

Browse files
committed
Fix "Constant INSTALL_PATH already defined" error
1 parent 9c66c27 commit c4335e2

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/Roundcube/Composer/ExtensionInstaller.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ public function getInstallPath(PackageInterface $package)
4343
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
4444
{
4545
// initialize Roundcube environment
46-
define('INSTALL_PATH', getcwd() . '/');
46+
if (!defined('INSTALL_PATH')) {
47+
define('INSTALL_PATH', getcwd() . '/');
48+
}
4749
include_once(INSTALL_PATH . 'program/include/clisetup.php');
4850

4951
$this->rcubeVersionCheck($package);
@@ -115,7 +117,9 @@ public function install(InstalledRepositoryInterface $repo, PackageInterface $pa
115117
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
116118
{
117119
// initialize Roundcube environment
118-
define('INSTALL_PATH', getcwd() . '/');
120+
if (!defined('INSTALL_PATH')) {
121+
define('INSTALL_PATH', getcwd() . '/');
122+
}
119123
include_once(INSTALL_PATH . 'program/include/clisetup.php');
120124

121125
$this->rcubeVersionCheck($target);
@@ -190,7 +194,9 @@ public function update(InstalledRepositoryInterface $repo, PackageInterface $ini
190194
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
191195
{
192196
// initialize Roundcube environment
193-
define('INSTALL_PATH', getcwd() . '/');
197+
if (!defined('INSTALL_PATH')) {
198+
define('INSTALL_PATH', getcwd() . '/');
199+
}
194200
include_once(INSTALL_PATH . 'program/include/clisetup.php');
195201

196202
$self = $this;

0 commit comments

Comments
 (0)