Ver código fonte

Fixed an issue when .composer folder does not exitsts (#1982)

* Fixed an issue when .composer folder does not exitsts

Install of composer failed when .composer is missing

* Fix markup
Jaap Marcus 4 anos atrás
pai
commit
d657f5a232
2 arquivos alterados com 9 adições e 0 exclusões
  1. 1 0
      CHANGELOG.md
  2. 8 0
      web/src/app/System/HestiaApp.php

+ 1 - 0
CHANGELOG.md

@@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
 - Fixed #1956 to prevent reset of defined webmail client.
 - Explicitly disable cron reports #1978 
 - Fixed an issue where in rare cases certificate failed to install @dpeca and @myvesta
+- Fixed an issue where composer failed to install when .composer folder is missing
 
 ## [1.4.5] - Service release
 

+ 8 - 0
web/src/app/System/HestiaApp.php

@@ -69,6 +69,14 @@ class HestiaApp {
         }
 
         $install_folder = $this->getUserHomeDir() . DIRECTORY_SEPARATOR . '.composer';
+        
+        if (!file_exists($install_folder)) {
+            exec(HESTIA_CMD .'v-rebuild-user '.$this -> user(), $output, $return_code);
+            if($return_code !== 0){
+                throw new \Exception("Unable to rebuild user");
+            }
+        }
+        
         $this->runUser('v-run-cli-cmd', ["/usr/bin/php", $composer_setup, "--quiet", "--install-dir=".$install_folder, "--filename=composer", "--$version" ], $status);
 
         unlink($composer_setup);