@@ -73,10 +73,11 @@ private function initializeRoundcubemailEnvironment(): void
7373 public function install (InstalledRepositoryInterface $ repo , PackageInterface $ package )
7474 {
7575 $ this ->setRoundcubemailInstallPath ($ repo );
76- $ this ->initializeRoundcubemailEnvironment ();
77- $ this ->rcubeVersionCheck ($ package );
7876
7977 $ postInstall = function () use ($ package ) {
78+ $ this ->initializeRoundcubemailEnvironment ();
79+ $ this ->rcubeVersionCheck ($ package );
80+
8081 $ config_file = $ this ->rcubeConfigFile ();
8182 $ package_name = $ this ->getPackageName ($ package );
8283 $ package_dir = $ this ->getInstallPath ($ package );
@@ -134,20 +135,21 @@ public function install(InstalledRepositoryInterface $repo, PackageInterface $pa
134135 public function update (InstalledRepositoryInterface $ repo , PackageInterface $ initial , PackageInterface $ target )
135136 {
136137 $ this ->setRoundcubemailInstallPath ($ repo );
137- $ this ->initializeRoundcubemailEnvironment ();
138- $ this ->rcubeVersionCheck ($ target );
139138
140- $ extra = $ target ->getExtra ();
141- $ fs = new Filesystem ();
139+ $ postUpdate = function () use ($ initial , $ target ) {
140+ $ this ->initializeRoundcubemailEnvironment ();
141+ $ this ->rcubeVersionCheck ($ target );
142+
143+ $ extra = $ target ->getExtra ();
144+ $ fs = new Filesystem ();
142145
143- // backup persistent files e.g. config.inc.php
144- $ package_dir = $ this ->getInstallPath ($ initial );
145- $ temp_dir = $ package_dir . '- ' . sprintf ('%010d%010d ' , mt_rand (), mt_rand ());
146+ // backup persistent files e.g. config.inc.php
147+ $ package_dir = $ this ->getInstallPath ($ initial );
148+ $ temp_dir = $ package_dir . '- ' . sprintf ('%010d%010d ' , mt_rand (), mt_rand ());
146149
147- // make a backup of existing files (for restoring persistent files)
148- $ fs ->copy ($ package_dir , $ temp_dir );
150+ // make a backup of existing files (for restoring persistent files)
151+ $ fs ->copy ($ package_dir , $ temp_dir );
149152
150- $ postUpdate = function () use ($ target , $ extra , $ fs , $ temp_dir ) {
151153 $ package_name = $ this ->getPackageName ($ target );
152154 $ package_dir = $ this ->getInstallPath ($ target );
153155
@@ -199,11 +201,12 @@ public function update(InstalledRepositoryInterface $repo, PackageInterface $ini
199201 public function uninstall (InstalledRepositoryInterface $ repo , PackageInterface $ package )
200202 {
201203 $ this ->setRoundcubemailInstallPath ($ repo );
202- $ this ->initializeRoundcubemailEnvironment ();
203204
204- $ config = $ this ->composer ->getConfig ()->get ('roundcube ' );
205+ $ postUninstall = function () use ($ package ) {
206+ $ this ->initializeRoundcubemailEnvironment ();
207+
208+ $ config = $ this ->composer ->getConfig ()->get ('roundcube ' );
205209
206- $ postUninstall = function () use ($ package , $ config ) {
207210 // post-uninstall: deactivate package
208211 $ package_name = $ this ->getPackageName ($ package );
209212 $ package_dir = $ this ->getInstallPath ($ package );
0 commit comments