Throws an exception when the installer has not yet been executed.

This commit is contained in:
Fernando Ontiveros
2025-06-17 16:02:14 -04:00
parent aa91c83867
commit eeb4064a9c
5 changed files with 150 additions and 147 deletions

View File

@@ -5,71 +5,72 @@
<meta name="robots" content="noindex,nofollow" /> <meta name="robots" content="noindex,nofollow" />
<title>Runtime Exception.</title> <title>Runtime Exception.</title>
<style> <style>
/* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */ body {
html{ color:#000;background:#FFF; }body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{ margin:0;padding:0; }table{ border-collapse:collapse;border-spacing:0; }fieldset,img{ border:0; }address,caption,cite,code,dfn,em,strong,th,var{ font-style:normal;font-weight:normal; }li{ list-style:none; }caption,th{ text-align:left; }h1,h2,h3,h4,h5,h6{ font-size:100%;font-weight:normal; }q:before,q:after{ content:''; }abbr,acronym{ border:0;font-variant:normal; }sup{ vertical-align:text-top; }sub{ vertical-align:text-bottom; }input,textarea,select{ font-family:inherit;font-size:inherit;font-weight:inherit; }input,textarea,select{ *font-size:100%; }legend{ color:#000; } font-family: Verdana, Arial, sans-serif;
font-size: 13px;
html { background: #eee; padding: 10px } color: #333;
body { font: 11px Verdana, Arial, sans-serif; color: #333 } background: #eee;
img { border: 0; } padding: 10px;
.clear { clear:both; height:0; font-size:0; line-height:0; } margin: 0;
.clear_fix:after { display:block; height:0; clear:both; visibility:hidden; } display: flex;
.clear_fix { display:inline-block; } justify-content: center; /* Center horizontally */
* html .clear_fix { height:1%; } align-items: flex-start; /* Center vertically */
.clear_fix { display:block; } height: 100vh; /* Full viewport height */
#content { width:970px; margin:0 auto; }
.sf-exceptionreset, .sf-exceptionreset .block { margin: auto }
.sf-exceptionreset abbr { border-bottom: 1px dotted #000; cursor: help; }
.sf-exceptionreset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
.sf-exceptionreset strong { font-weight:bold; }
.sf-exceptionreset a { color:#6c6159; }
.sf-exceptionreset a img { border:none; }
.sf-exceptionreset a:hover { text-decoration:underline; }
.sf-exceptionreset em { font-style:italic; }
.sf-exceptionreset h1, .sf-exceptionreset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
.sf-exceptionreset h2 span { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; }
.sf-exceptionreset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
.sf-exceptionreset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
-webkit-border-bottom-right-radius: 16px;
-webkit-border-bottom-left-radius: 16px;
-moz-border-radius-bottomright: 16px;
-moz-border-radius-bottomleft: 16px;
border-bottom-right-radius: 16px;
border-bottom-left-radius: 16px;
border-bottom:1px solid #ccc;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
} }
.sf-exceptionreset .block_exception { background-color:#ddd; color: #333; padding:20px; #content {
-webkit-border-top-left-radius: 16px; max-width: 800px; /* Set a max width for the content */
-webkit-border-top-right-radius: 16px; width: 100%; /* Allow it to be responsive */
-moz-border-radius-topleft: 16px;
-moz-border-radius-topright: 16px;
border-top-left-radius: 16px;
border-top-right-radius: 16px;
border-top:1px solid #ccc;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
} }
.sf-exceptionreset li a { background:none; color:#868686; text-decoration:none; } h1 {
.sf-exceptionreset li a:hover { background:none; color:#313131; text-decoration:underline; } font-size: 19px;
.sf-exceptionreset ol { padding: 10px 0; } background-color: #fff;
.sf-exceptionreset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px; padding: 15px 28px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 12px;
margin: 20px 0 20px 0;
}
h2 {
margin: 0px 0 0px 0;
font-size: 18px;
}
.block {
background-color: #fff;
margin-bottom: 20px;
font-size: 14px;
border: 1px solid #ccc;
border-radius: 0px 0px 12px 12px;
}
.block_exception {
background-color: #ddd;
color: #333;
padding: 15px 28px;
border: 1px solid #ccc;
border-radius: 12px 12px 0px 0px;
} }
pre { pre {
font: 18px Georgia, "Times New Roman", Times, serif; font-family: inherit;
font-size: inherit;
color: #333;
margin: 0;
}
abbr {
border-bottom: 1px dotted #000;
cursor: help;
}
a {
color: #6c6159;
text-decoration: none;
}
a:hover {
text-decoration: underline;
} }
</style> </style>
</head> </head>
<body> <body>
<div id="content" class="sf-exceptionreset"> <div id="content" class="sf-exceptionreset">
<h1>System Exception.</h1> <h1>Runtime Exception</h1>
<div class="block_exception clear_fix"> <div class="block_exception clear_fix">
<h2> <h2>
<abbr title="RuntimeException">RuntimeException</abbr>:
<pre><?php echo htmlspecialchars($message)?></pre> <pre><?php echo htmlspecialchars($message)?></pre>
</h2> </h2>
</div> </div>

View File

@@ -1,79 +1,81 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta charset="UTF-8"/>
<meta name="robots" content="noindex,nofollow"/> <meta name="robots" content="noindex,nofollow"/>
<title>Runtime Exception.</title> <title>Runtime Exception</title>
<style> <style>
/* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */ body {
html{ color:#000;background:#FFF; }body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{ margin:0;padding:0; }table{ border-collapse:collapse;border-spacing:0; }fieldset,img{ border:0; }address,caption,cite,code,dfn,em,strong,th,var{ font-style:normal;font-weight:normal; }li{ list-style:none; }caption,th{ text-align:left; }h1,h2,h3,h4,h5,h6{ font-size:100%;font-weight:normal; }q:before,q:after{ content:''; }abbr,acronym{ border:0;font-variant:normal; }sup{ vertical-align:text-top; }sub{ vertical-align:text-bottom; }input,textarea,select{ font-family:inherit;font-size:inherit;font-weight:inherit; }input,textarea,select{ *font-size:100%; }legend{ color:#000; } font-family: Verdana, Arial, sans-serif;
font-size: 14px;
html { background: #eee; padding: 10px } color: #333;
body { font: 11px Verdana, Arial, sans-serif; color: #333 } background: #eee;
pre { font: 11px Verdana, Arial, sans-serif; color: #333 } padding: 10px;
img { border: 0; } margin: 0;
.clear { clear:both; height:0; font-size:0; line-height:0; } display: flex;
.clear_fix:after { display:block; height:0; clear:both; visibility:hidden; } justify-content: center; /* Center horizontally */
.clear_fix { display:inline-block; } align-items: flex-start; /* Center vertically */
* html .clear_fix { height:1%; } height: 100vh; /* Full viewport height */
.clear_fix { display:block; }
#content { width:970px; margin:0 auto; }
.sf-exceptionreset, .sf-exceptionreset .block { margin: auto }
.sf-exceptionreset abbr { border-bottom: 1px dotted #000; cursor: help; }
.sf-exceptionreset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
.sf-exceptionreset strong { font-weight:bold; }
.sf-exceptionreset a { color:#6c6159; }
.sf-exceptionreset a img { border:none; }
.sf-exceptionreset a:hover { text-decoration:underline; }
.sf-exceptionreset em { font-style:italic; }
.sf-exceptionreset h1, .sf-exceptionreset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
.sf-exceptionreset h2 span { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; }
.sf-exceptionreset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
.sf-exceptionreset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
-webkit-border-bottom-right-radius: 16px;
-webkit-border-bottom-left-radius: 16px;
-moz-border-radius-bottomright: 16px;
-moz-border-radius-bottomleft: 16px;
border-bottom-right-radius: 16px;
border-bottom-left-radius: 16px;
border-bottom:1px solid #ccc;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
} }
.sf-exceptionreset .block_exception { background-color:#ddd; color: #333; padding:20px; #content {
-webkit-border-top-left-radius: 16px; max-width: 800px; /* Set a max width for the content */
-webkit-border-top-right-radius: 16px; width: 100%; /* Allow it to be responsive */
-moz-border-radius-topleft: 16px;
-moz-border-radius-topright: 16px;
border-top-left-radius: 16px;
border-top-right-radius: 16px;
border-top:1px solid #ccc;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
} }
.sf-exceptionreset li a { background:none; color:#868686; text-decoration:none; } h1 {
.sf-exceptionreset li a:hover { background:none; color:#313131; text-decoration:underline; } font-size: 19px;
.sf-exceptionreset ol { padding: 10px 0; } background-color: #fff;
.sf-exceptionreset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px; padding: 15px 28px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 12px;
margin: 20px 0 20px 0;
}
h2 {
margin: 0px 0 0px 0;
font-size: 18px;
}
.block {
background-color: #fff;
padding: 15px 28px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 0px 0px 12px 12px;
}
.block_exception {
background-color: #ddd;
color: #333;
padding: 15px 28px;
border: 1px solid #ccc;
border-radius: 12px 12px 0px 0px;
}
pre {
font-family: inherit;
font-size: inherit;
color: #333;
margin: 0;
}
abbr {
border-bottom: 1px dotted #000;
cursor: help;
}
a {
color: #6c6159;
text-decoration: none;
}
a:hover {
text-decoration: underline;
} }
</style> </style>
</head> </head>
<body> <body>
<div id="content" class="sf-exceptionreset"> <div id="content">
<h1>System Error.</h1> <h1>System Error</h1>
<div class="block_exception clear_fix"> <div class="block_exception">
<h2> <h2>
<abbr title="RuntimeException"><?php echo $title?></abbr>: <span><?php echo htmlspecialchars($title) ?></span>
</h2> </h2>
</div> </div>
<div class="block"> <div class="block">
<pre> <pre><?php echo htmlspecialchars($message); ?></pre>
<?php echo $message?>
</pre>
</div> </div>
</div> </div>
</body> </body>

View File

@@ -0,0 +1,20 @@
<?php
namespace ProcessMaker\Exception;
use G;
/**
* Class ExecuteInstallerException
* @package ProcessMaker\Exception
*/
class ExecuteInstallerException extends \Exception
{
/**
* @param string $message
*/
public function __construct()
{
parent::__construct("");
}
}

View File

@@ -4,6 +4,7 @@ use Maveriks\Http\Response;
use Maveriks\Pattern\Mvc\PhtmlView; use Maveriks\Pattern\Mvc\PhtmlView;
use ProcessMaker\Core\AppEvent; use ProcessMaker\Core\AppEvent;
use ProcessMaker\Exception\RBACException; use ProcessMaker\Exception\RBACException;
use ProcessMaker\Exception\ExecuteInstallerException;
// Because laravel has a __ helper function, it's important we include the class.g file to ensure our __ is used. // Because laravel has a __ helper function, it's important we include the class.g file to ensure our __ is used.
require_once __DIR__ . '/../../gulliver/system/class.g.php'; require_once __DIR__ . '/../../gulliver/system/class.g.php';
@@ -57,6 +58,13 @@ try {
} }
} catch (RBACException $e) { } catch (RBACException $e) {
G::header('location: ' . $e->getPath()); G::header('location: ' . $e->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) { } catch (Exception $e) {
$view = new PhtmlView($rootDir . "framework/src/templates/Exception.phtml"); $view = new PhtmlView($rootDir . "framework/src/templates/Exception.phtml");
$view->set("message", $e->getMessage()); $view->set("message", $e->getMessage());

View File

@@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Log;
use ProcessMaker\Core\AppEvent; use ProcessMaker\Core\AppEvent;
use ProcessMaker\Core\JobsManager; use ProcessMaker\Core\JobsManager;
use ProcessMaker\ChangeLog\ChangeLog; use ProcessMaker\ChangeLog\ChangeLog;
use ProcessMaker\Exception\ExecuteInstallerException;
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Validation\ValidationUploadedFiles; 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 // Installer, redirect to install if we don't have a valid shared data folder
if (!defined('PATH_DB') || !file_exists(PATH_DB)) { if (!defined('PATH_DB') || !file_exists(PATH_DB)) {
// new installer, extjs based // installer was removed from core. Display an error message
throw new ExecuteInstallerException();
//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();
} }
app()->useStoragePath(realpath(PATH_DATA)); app()->useStoragePath(realpath(PATH_DATA));