Skip to content

Commit 49dd09f

Browse files
committed
include RC iniset.php using async promise
1 parent 4d91081 commit 49dd09f

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

src/ExtensionInstaller.php

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,17 @@ public function getInstallPath(PackageInterface $package)
4747

4848
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
4949
{
50-
// initialize Roundcube environment
5150
$this->setRoundcubemailInstallPath($repo);
52-
if (!defined('INSTALL_PATH')) {
53-
define('INSTALL_PATH', $this->getRoundcubemailInstallPath() . '/');
54-
}
55-
require_once INSTALL_PATH . 'program/include/iniset.php';
56-
57-
$this->rcubeVersionCheck($package);
5851

5952
$postInstall = function () use ($package) {
53+
// initialize Roundcube environment
54+
if (!defined('INSTALL_PATH')) {
55+
define('INSTALL_PATH', $this->getRoundcubemailInstallPath() . '/');
56+
}
57+
require_once INSTALL_PATH . 'program/include/iniset.php';
58+
59+
$this->rcubeVersionCheck($package);
60+
6061
$config_file = $this->rcubeConfigFile();
6162
$package_name = $this->getPackageName($package);
6263
$package_dir = $this->getVendorDir() . \DIRECTORY_SEPARATOR . $package_name;
@@ -118,27 +119,28 @@ public function install(InstalledRepositoryInterface $repo, PackageInterface $pa
118119

119120
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
120121
{
121-
// initialize Roundcube environment
122122
$this->setRoundcubemailInstallPath($repo);
123-
if (!defined('INSTALL_PATH')) {
124-
define('INSTALL_PATH', $this->getRoundcubemailInstallPath() . '/');
125-
}
126-
require_once INSTALL_PATH . 'program/include/iniset.php';
127123

128-
$this->rcubeVersionCheck($target);
124+
$postUpdate = function () use ($target) {
125+
// initialize Roundcube environment
126+
if (!defined('INSTALL_PATH')) {
127+
define('INSTALL_PATH', $this->getRoundcubemailInstallPath() . '/');
128+
}
129+
require_once INSTALL_PATH . 'program/include/iniset.php';
129130

130-
$extra = $target->getExtra();
131-
$fs = new Filesystem();
131+
$this->rcubeVersionCheck($target);
132132

133-
// backup persistent files e.g. config.inc.php
134-
$package_name = $this->getPackageName($initial);
135-
$package_dir = $this->getVendorDir() . \DIRECTORY_SEPARATOR . $package_name;
136-
$temp_dir = $package_dir . '-' . sprintf('%010d%010d', mt_rand(), mt_rand());
133+
$extra = $target->getExtra();
134+
$fs = new Filesystem();
135+
136+
// backup persistent files e.g. config.inc.php
137+
$package_name = $this->getPackageName($initial);
138+
$package_dir = $this->getVendorDir() . \DIRECTORY_SEPARATOR . $package_name;
139+
$temp_dir = $package_dir . '-' . sprintf('%010d%010d', mt_rand(), mt_rand());
137140

138-
// make a backup of existing files (for restoring persistent files)
139-
$fs->copy($package_dir, $temp_dir);
141+
// make a backup of existing files (for restoring persistent files)
142+
$fs->copy($package_dir, $temp_dir);
140143

141-
$postUpdate = function () use ($target, $extra, $fs, $temp_dir) {
142144
$package_name = $this->getPackageName($target);
143145
$package_dir = $this->getVendorDir() . \DIRECTORY_SEPARATOR . $package_name;
144146

@@ -192,16 +194,17 @@ public function update(InstalledRepositoryInterface $repo, PackageInterface $ini
192194

193195
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
194196
{
195-
// initialize Roundcube environment
196197
$this->setRoundcubemailInstallPath($repo);
197-
if (!defined('INSTALL_PATH')) {
198-
define('INSTALL_PATH', $this->getRoundcubemailInstallPath() . '/');
199-
}
200-
require_once INSTALL_PATH . 'program/include/iniset.php';
201198

202-
$config = $this->composer->getConfig()->get('roundcube');
199+
$postUninstall = function () use ($package) {
200+
// initialize Roundcube environment
201+
if (!defined('INSTALL_PATH')) {
202+
define('INSTALL_PATH', $this->getRoundcubemailInstallPath() . '/');
203+
}
204+
require_once INSTALL_PATH . 'program/include/iniset.php';
205+
206+
$config = $this->composer->getConfig()->get('roundcube');
203207

204-
$postUninstall = function () use ($package, $config) {
205208
// post-uninstall: deactivate package
206209
$package_name = $this->getPackageName($package);
207210
$package_dir = $this->getVendorDir() . \DIRECTORY_SEPARATOR . $package_name;

0 commit comments

Comments
 (0)