From eeb4064a9c7c7ff91e6936bfb82b6a6c30c126c5 Mon Sep 17 00:00:00 2001 From: Fernando Ontiveros Date: Tue, 17 Jun 2025 16:02:14 -0400 Subject: [PATCH] Throws an exception when the installer has not yet been executed. --- framework/src/templates/Exception.phtml | 107 +++++++-------- framework/src/templates/error.phtml | 128 +++++++++--------- .../Exception/ExecuteInstallerException.php | 20 +++ workflow/public_html/app.php | 8 ++ workflow/public_html/sysGeneric.php | 34 +---- 5 files changed, 150 insertions(+), 147 deletions(-) create mode 100644 workflow/engine/src/ProcessMaker/Exception/ExecuteInstallerException.php diff --git a/framework/src/templates/Exception.phtml b/framework/src/templates/Exception.phtml index 369e4332f..2473d591c 100644 --- a/framework/src/templates/Exception.phtml +++ b/framework/src/templates/Exception.phtml @@ -5,71 +5,72 @@ Runtime Exception.
-

System Exception.

+

Runtime Exception

- RuntimeException:

diff --git a/framework/src/templates/error.phtml b/framework/src/templates/error.phtml index 443dcf739..767473589 100644 --- a/framework/src/templates/error.phtml +++ b/framework/src/templates/error.phtml @@ -1,80 +1,82 @@ - + - - - Runtime Exception. + + + Runtime Exception -
-

System Error.

-
+
+

System Error

+

- : +

-
-        
-        
+
- \ No newline at end of file + diff --git a/workflow/engine/src/ProcessMaker/Exception/ExecuteInstallerException.php b/workflow/engine/src/ProcessMaker/Exception/ExecuteInstallerException.php new file mode 100644 index 000000000..e88f87ee4 --- /dev/null +++ b/workflow/engine/src/ProcessMaker/Exception/ExecuteInstallerException.php @@ -0,0 +1,20 @@ +getPath()); +} catch (ExecuteInstallerException $e) { + $view = new PhtmlView($rootDir . "framework/src/templates/error.phtml"); + $view->set("title", "Installation Required"); + $view->set("message", "Please run lurana-installer to use the software. \n\nIf you've already run it, there might be an issue. \nPlease contact support."); +$view->set("exception", $e); + $response = new Response($view->getOutput(), 403); + $response->send(); } catch (Exception $e) { $view = new PhtmlView($rootDir . "framework/src/templates/Exception.phtml"); $view->set("message", $e->getMessage()); diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index 9705b0169..5f04fe899 100644 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Log; use ProcessMaker\Core\AppEvent; use ProcessMaker\Core\JobsManager; use ProcessMaker\ChangeLog\ChangeLog; +use ProcessMaker\Exception\ExecuteInstallerException; use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Validation\ValidationUploadedFiles; @@ -344,37 +345,8 @@ $oHeadPublisher = headPublisher::getSingleton(); // Installer, redirect to install if we don't have a valid shared data folder if (!defined('PATH_DB') || !file_exists(PATH_DB)) { - // new installer, extjs based - - //important to start laravel classes - app()->useStoragePath(realpath(PATH_DATA)); - app()->make(Kernel::class)->bootstrap(); - restore_error_handler(); - - $pathFile = PATH_CONTROLLERS . 'InstallerModule.php'; - require_once ($pathFile); - $controller = InstallerModule::class; - - // if the method name is empty set default to index method - if (strpos(SYS_TARGET, '/') !== false) { - list($controller, $controllerAction) = explode('/', SYS_TARGET); - } else { - $controllerAction = SYS_TARGET; - } - - $controllerAction = ($controllerAction != '' && $controllerAction != 'login') ? $controllerAction : 'index'; - - // create the installer controller and call its method - if (method_exists(InstallerModule::class, $controllerAction)) { - $installer = new $controller(); - $installer->setHttpRequestData($_REQUEST); - - $installer->call($controllerAction); - } else { - $_SESSION['phpFileNotFound'] = $_SERVER['REQUEST_URI']; - header("location: /errors/error404.php?url=" . urlencode($_SERVER['REQUEST_URI'])); - } - exit(); + // installer was removed from core. Display an error message + throw new ExecuteInstallerException(); } app()->useStoragePath(realpath(PATH_DATA));