diff --git a/bootstrap/app.php b/bootstrap/app.php index e1cbf9613..0a03bfd24 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -8,6 +8,7 @@ use Illuminate\Foundation\Exceptions\Handler; use Illuminate\Foundation\Http\Kernel as Kernel3; use Monolog\Formatter\LineFormatter; use Monolog\Handler\RotatingFileHandler; +use ProcessMaker\Core\System; /* |-------------------------------------------------------------------------- @@ -50,6 +51,8 @@ $app->singleton( Handler::class ); +$app->useStoragePath(System::getPathsInstalled()->pathData); + /* |-------------------------------------------------------------------------- | Return The Application diff --git a/workflow/engine/src/ProcessMaker/Core/System.php b/workflow/engine/src/ProcessMaker/Core/System.php index 37661ee38..50807f6cd 100644 --- a/workflow/engine/src/ProcessMaker/Core/System.php +++ b/workflow/engine/src/ProcessMaker/Core/System.php @@ -1655,5 +1655,30 @@ class System app()->make(Kernel::class)->bootstrap(); restore_error_handler(); } + + /** + * If the installation file exists it returns the defined values. + * @return object + */ + public static function getPathsInstalled() + { + //default values + $result = [ + 'pathData' => getcwd() . '/shared', + 'pathCompiled' => getcwd() . '/shared/compiled', + ]; + + $pathsInstalled = getcwd() . "/workflow/engine/config/paths_installed.php"; + if (file_exists($pathsInstalled)) { + $script = "require_once '{$pathsInstalled}';" + . "return [" + . "'pathData' => PATH_DATA," + . "'pathCompiled' => PATH_C," + . "'hashInstallation' => HASH_INSTALLATION," + . "'systemHash' => SYSTEM_HASH," + . "];"; + $result = eval($script); + } + return (object) $result; + } } -// end System class