@@ -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 );
@@ -139,20 +140,21 @@ public function install(InstalledRepositoryInterface $repo, PackageInterface $pa
139140 public function update (InstalledRepositoryInterface $ repo , PackageInterface $ initial , PackageInterface $ target )
140141 {
141142 $ this ->setRoundcubemailInstallPath ($ repo );
142- $ this ->initializeRoundcubemailEnvironment ();
143- $ this ->rcubeVersionCheck ($ target );
144143
145- $ extra = $ target ->getExtra ();
146- $ fs = new Filesystem ();
144+ $ postUpdate = function () use ($ initial , $ target ) {
145+ $ this ->initializeRoundcubemailEnvironment ();
146+ $ this ->rcubeVersionCheck ($ target );
147+
148+ $ extra = $ target ->getExtra ();
149+ $ fs = new Filesystem ();
147150
148- // backup persistent files e.g. config.inc.php
149- $ package_dir = $ this ->getInstallPath ($ initial );
150- $ temp_dir = $ package_dir . '- ' . sprintf ('%010d%010d ' , mt_rand (), mt_rand ());
151+ // backup persistent files e.g. config.inc.php
152+ $ package_dir = $ this ->getInstallPath ($ initial );
153+ $ temp_dir = $ package_dir . '- ' . sprintf ('%010d%010d ' , mt_rand (), mt_rand ());
151154
152- // make a backup of existing files (for restoring persistent files)
153- $ fs ->copy ($ package_dir , $ temp_dir );
155+ // make a backup of existing files (for restoring persistent files)
156+ $ fs ->copy ($ package_dir , $ temp_dir );
154157
155- $ postUpdate = function () use ($ target , $ extra , $ fs , $ temp_dir ) {
156158 $ package_name = $ this ->getPackageName ($ target );
157159 $ package_dir = $ this ->getInstallPath ($ target );
158160
@@ -209,11 +211,12 @@ public function update(InstalledRepositoryInterface $repo, PackageInterface $ini
209211 public function uninstall (InstalledRepositoryInterface $ repo , PackageInterface $ package )
210212 {
211213 $ this ->setRoundcubemailInstallPath ($ repo );
212- $ this ->initializeRoundcubemailEnvironment ();
213214
214- $ config = $ this ->composer ->getConfig ()->get ('roundcube ' );
215+ $ postUninstall = function () use ($ package ) {
216+ $ this ->initializeRoundcubemailEnvironment ();
217+
218+ $ config = $ this ->composer ->getConfig ()->get ('roundcube ' );
215219
216- $ postUninstall = function () use ($ package , $ config ) {
217220 // post-uninstall: deactivate package
218221 $ package_name = $ this ->getPackageName ($ package );
219222 $ package_dir = $ this ->getInstallPath ($ package );
0 commit comments