Add installer locked page

This commit is contained in:
Jack Anderson 2024-02-28 14:31:14 +00:00
parent 078cc21182
commit 74a8e36e30
2 changed files with 122 additions and 20 deletions

View file

@ -0,0 +1,97 @@
<!--
/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2024 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
-->
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="manifest" href="site.webmanifest">
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport'/>
<link rel="stylesheet" href="dist/{{ cssFile }}">
</head>
<body>
<app-root>
<div class="top-panel fixed-top">
<nav class="navbar ml-0 pl-0">
<div class="navbar-collapse">
<ul class="navbar-nav">
<li class="pl-1">
<img alt=""
src="legacy/themes/default/images/company_logo.png"
title=""
class="">
</li>
</ul>
</div>
</nav>
</div>
<div class="install-view">
<div class="install-view-header">
<div class="row mr-0">
<div class="col-md-5 install-header-title-col pl-4">
<div class="install-view-title record-view-name">
<scrm-label>{{ mod_strings.LBL_DISABLED_TITLE_2 }}</scrm-label>
</div>
<div class="pl-4">
<scrm-label>{{ mod_strings.LBL_DISABLED_DESCRIPTION }}</scrm-label>
</div>
<pre class="bg-transparent text-body pl-4 pt-3">'installer_locked' => false,</pre>
<div class="pl-4">
<scrm-label>{{ mod_strings.LBL_DISABLED_DESCRIPTION_3 }}</scrm-label>
</div>
<div class="pl-4">
{{ mod_strings.LBL_DISABLED_HELP_1 }}
<a href="{{mod_strings.LBL_DISABLED_HELP_LNK}}" target="_blank">{{mod_strings.LBL_DISABLED_HELP_2}}</a>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<div class="copyright-links"><a data-toggle="modal" data-target=".copyright-suitecrm" class="footer-link"> ©
Supercharged by SuiteCRM </a><a data-toggle="modal" data-target=".copyright-sugarcrm"
class="footer-link"> © Powered By SugarCRM </a></div>
</div>
<div class="copyright"></div>
</app-root>
</body>
</html>

View file

@ -87,13 +87,29 @@ class InstallPreChecks
{
$sugar_config = $this->getConfigValues();
$this->modStrings = $this->getLanguageStrings();
if (file_exists('legacy/config.php')) {
return;
$files = scandir('dist');
foreach ($files as $file) {
if (preg_match("/styles\.[^.]+\.css/", $file)) {
$cssFile = $file;
}
}
if (file_exists('legacy/config.php') && isTrue($sugar_config['installer_locked'])) {
$loader = new FilesystemLoader(__DIR__ . '/../Resources');
$twig = new Environment($loader);
$template = $twig->load('installer_locked.html.twig');
$this->modStrings = $this->getLanguageStrings();
echo $template->render([
'cssFile' => $cssFile,
'mod_strings' => $this->modStrings
]);
return;
}
$path = realpath('./');
$loader = new FilesystemLoader(__DIR__ . '/../Resources');
@ -109,15 +125,6 @@ class InstallPreChecks
$this->optionalInstallChecks();
$files = scandir('dist');
foreach ($files as $file) {
if (preg_match("/styles\.[^.]+\.css/", $file)) {
$cssFile = $file;
}
}
echo $template->render([
'path' => $path,
'systemChecks' => $this->systemChecks,
@ -201,7 +208,7 @@ class InstallPreChecks
curl_setopt($ch, CURLOPT_VERBOSE, true);
ob_start();
$path = 'php://output';
$streamVerboseHandle = fopen($path, 'w');
$streamVerboseHandle = fopen($path, 'r+');
curl_setopt($ch, CURLOPT_STDERR, $streamVerboseHandle);
$headers = [];
@ -257,6 +264,7 @@ class InstallPreChecks
$output['result'] = $this->modStrings['LBL_CHECKSYS_OK'] ?? 'OK';
fclose($streamVerboseHandle);
$debug = ob_get_clean();
$this->log->info($debug);
return $output;
@ -268,10 +276,10 @@ class InstallPreChecks
fwrite($streamVerboseHandle, $error);
file_put_contents($logFile, stream_get_contents($streamVerboseHandle), FILE_APPEND);
$output['errors'][] = stream_get_contents($streamVerboseHandle);
fclose($streamVerboseHandle);
$debug = ob_get_clean();
$this->log->error($debug);
$output['errors'][] = $result;
$output['errors'][] = $error;
return $output;
@ -323,7 +331,7 @@ class InstallPreChecks
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
ob_start();
$path = 'php://output';
$streamVerboseHandle = fopen($path, 'w');
$streamVerboseHandle = fopen($path, 'r+');
curl_setopt($ch, CURLOPT_STDERR, $streamVerboseHandle);
@ -352,7 +360,6 @@ class InstallPreChecks
}
curl_close($ch);
rewind($streamVerboseHandle);
file_put_contents('public/legacy/install.log', stream_get_contents($streamVerboseHandle, -1, 0), FILE_APPEND);
$output['result'] = $this->modStrings['LBL_CHECKSYS_OK'] ?? 'OK';
@ -1039,20 +1046,18 @@ class InstallPreChecks
'ldap',
];
$result = [
'result' => '',
'warnings' => []
];
$key = 'SERVER CHECKS';
$loadedExtensions = get_loaded_extensions();
foreach ($modules as $module) {
$result['warnings'] = [];
$label = $this->modStrings['LBL_CHECKSYS_' . strtoupper($module) . '_EXTENSIONS'];
$this->systemChecks[$key]['checks'][$label]['label'] = $label;
$this->log->info('Checking if ' . $module . ' exists in loaded extensions');
if (!in_array($module, $loadedExtensions)) {
$result['result'] = '';
$result['warnings'][] = $this->modStrings['ERR_CHECKSYS_' . strtoupper($module)] ?? strtoupper($module) . ' not found in extensions.';
$this->systemChecks[$key]['checks'][$label]['warnings'] = $result['warnings'];
} else {