Skip to content

Commit

Permalink
Include RC iniset.php using async promise
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Apr 22, 2024
1 parent 8897e88 commit 331e079
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/ExtensionInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 331e079

Please sign in to comment.