mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-09-01 08:00:47 +08:00
Add missing permissions warning page to install pre-checks
This commit is contained in:
parent
35ec0f6105
commit
e9cf01f911
3 changed files with 160 additions and 37 deletions
|
@ -0,0 +1,85 @@
|
|||
<!--
|
||||
/**
|
||||
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
|
||||
* Copyright (C) 2025 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 SALESAGILITY, SALESAGILITY 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.
|
||||
*
|
||||
* 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
|
||||
* "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 "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">
|
||||
<link rel="icon" type="image/png" href="dist/themes/suite8/images/favicon.ico">
|
||||
<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 full-height-view">
|
||||
<div class="install-view-header container-fluid">
|
||||
<center>
|
||||
<div class="row mr-0">
|
||||
<div class="install-header-title-col col">
|
||||
<div class="install-view-title record-view-name justify-content-center d-flex">
|
||||
<scrm-label>{{ mod_strings.ERR_CHECKSYS_NOT_WRITABLE }}</scrm-label>
|
||||
</div>
|
||||
<pre class="bg-transparent text-body pt-3">'{{ path }}'</pre>
|
||||
<div>
|
||||
<scrm-label>{{ mod_strings.LBL_DISABLED_DESCRIPTION_3 }}</scrm-label>
|
||||
</div>
|
||||
<div class="pb-3">
|
||||
{{ 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>
|
||||
</center>
|
||||
</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>
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
namespace App\Install\Service;
|
||||
|
||||
use AllowDynamicProperties;
|
||||
use Monolog\Logger;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
|
@ -84,20 +83,31 @@ class InstallPreChecks
|
|||
$this->log = $log;
|
||||
}
|
||||
|
||||
public function showMissingPermissionsPage($path): void
|
||||
{
|
||||
$sugar_config = $this->getConfigValues();
|
||||
$this->loadModStrings();
|
||||
|
||||
$cssFile = $this->getCssFile();
|
||||
|
||||
$loader = new FilesystemLoader(__DIR__ . '/../Resources');
|
||||
$twig = new Environment($loader);
|
||||
$template = $twig->load('installer_missing_permissions.html.twig');
|
||||
echo $template->render([
|
||||
'cssFile' => $cssFile,
|
||||
'path' => $path,
|
||||
'mod_strings' => $this->modStrings
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
public function setupTwigTemplate(): void
|
||||
{
|
||||
|
||||
$sugar_config = $this->getConfigValues();
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$files = scandir('dist');
|
||||
|
||||
foreach ($files as $file) {
|
||||
|
||||
if (preg_match("/styles\.[^.]+\.css/", $file)) {
|
||||
$cssFile = $file;
|
||||
}
|
||||
}
|
||||
$cssFile = $this->getCssFile();
|
||||
|
||||
if (file_exists('legacy/config.php') && ($sugar_config['installer_locked'] ?? false) === true) {
|
||||
$loader = new FilesystemLoader(__DIR__ . '/../Resources');
|
||||
|
@ -182,7 +192,7 @@ class InstallPreChecks
|
|||
|
||||
function checkMainPage(string $baseUrl = ''): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
$this->log->info('Running curl for SuiteCRM Main Page');
|
||||
$ch = curl_init();
|
||||
$timeout = 5;
|
||||
|
@ -313,7 +323,7 @@ class InstallPreChecks
|
|||
*/
|
||||
function checkGraphQlAPI(string $baseUrl = ''): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$this->log->info('Running curl for Api');
|
||||
$ch = curl_init();
|
||||
|
@ -410,7 +420,7 @@ class InstallPreChecks
|
|||
$enUsStrings = [];
|
||||
$lang = 'en_us';
|
||||
|
||||
$sugarConfig = $this->getConfigValues();
|
||||
$sugar_config = $this->getConfigValues();
|
||||
$configOverride = $this->getConfigOverrideValues();
|
||||
|
||||
$enUsLangPack = __DIR__ . '/../../../../public/legacy/install/language/' . $lang . '.lang.php';
|
||||
|
@ -467,7 +477,7 @@ class InstallPreChecks
|
|||
|
||||
private function runPHPChecks($labels, $results): void
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$key = $this->modStrings['LBL_PHP_CHECKS'];
|
||||
|
||||
|
@ -484,7 +494,7 @@ class InstallPreChecks
|
|||
|
||||
private function checkMemoryLimit(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$labels[] = $this->modStrings['LBL_CHECKSYS_MEM'];
|
||||
|
||||
|
@ -541,7 +551,7 @@ class InstallPreChecks
|
|||
|
||||
private function checkAllowsStream(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$labels[] = $this->modStrings['LBL_STREAM'];
|
||||
|
||||
|
@ -618,7 +628,7 @@ class InstallPreChecks
|
|||
|
||||
private function runPermissionChecks($labels, $results): void
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$key = $this->modStrings['LBL_PERMISSION_CHECKS'];
|
||||
|
||||
|
@ -655,7 +665,7 @@ class InstallPreChecks
|
|||
|
||||
private function isWritableCustomDir(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$this->log->info('Checking if Custom Dir is writable');
|
||||
|
||||
|
@ -679,7 +689,7 @@ class InstallPreChecks
|
|||
|
||||
private function isWritableUploadDir(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$this->log->info('Checking if Upload Dir is Writable');
|
||||
|
||||
|
@ -704,7 +714,7 @@ class InstallPreChecks
|
|||
|
||||
private function isWritableLegacyCacheSubDir(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$this->log->info('Checking Legacy Cache Sub Dirs are writable');
|
||||
|
||||
|
@ -754,7 +764,7 @@ class InstallPreChecks
|
|||
|
||||
private function checkMbStringsModule(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
$labels[] = $this->modStrings['LBL_CHECKSYS_MBSTRING'];
|
||||
|
||||
$results = [
|
||||
|
@ -777,7 +787,7 @@ class InstallPreChecks
|
|||
|
||||
private function isWritableConfigFile(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
$labels[] = $this->modStrings['LBL_CHECKSYS_CONFIG'];
|
||||
|
||||
$results = [
|
||||
|
@ -806,7 +816,7 @@ class InstallPreChecks
|
|||
|
||||
private function isWritableSubDirFiles(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$labels[] = $this->modStrings['LBL_CHECKSYS_MODULE'];
|
||||
|
||||
|
@ -847,7 +857,7 @@ class InstallPreChecks
|
|||
|
||||
private function checkXMLParsing(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$results = [
|
||||
'result' => '',
|
||||
|
@ -871,7 +881,7 @@ class InstallPreChecks
|
|||
|
||||
private function checkRequiredModulesInExtensions(&$labels, &$results): void
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$this->log->info('Checking required loaded extensions');
|
||||
|
||||
|
@ -915,7 +925,7 @@ class InstallPreChecks
|
|||
|
||||
private function checkPCRELibrary(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$results = [
|
||||
'result' => '',
|
||||
|
@ -946,7 +956,7 @@ class InstallPreChecks
|
|||
|
||||
private function checkSpriteSupport(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$results = [
|
||||
'result' => '',
|
||||
|
@ -970,7 +980,7 @@ class InstallPreChecks
|
|||
|
||||
private function checkUploadFileSize(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$results = [
|
||||
'result' => '',
|
||||
|
@ -1022,7 +1032,7 @@ class InstallPreChecks
|
|||
|
||||
private function runServerConfigurationCheck(array $labels, array $results): void
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$key = $this->modStrings['LBL_SERVER_CHECKS'];
|
||||
|
||||
|
@ -1043,7 +1053,7 @@ class InstallPreChecks
|
|||
|
||||
private function checkSystemPhpVersion(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$labels[] = $this->modStrings['LBL_CHECKSYS_PHPVER'];
|
||||
|
||||
|
@ -1063,7 +1073,7 @@ class InstallPreChecks
|
|||
|
||||
private function addChecks(string $key, $labels, $results, $optional = false): void
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$this->systemChecks[$key] = [
|
||||
'label' => '',
|
||||
|
@ -1107,7 +1117,7 @@ class InstallPreChecks
|
|||
|
||||
private function optionalInstallChecks(): void
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$this->checkOptionalModulesInExtensions();
|
||||
|
||||
|
@ -1123,7 +1133,7 @@ class InstallPreChecks
|
|||
|
||||
private function checkOptionalModulesInExtensions(): void
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();;
|
||||
$this->loadModStrings();;
|
||||
|
||||
$this->log->info('Checking optional loaded extensions');
|
||||
|
||||
|
@ -1177,7 +1187,7 @@ class InstallPreChecks
|
|||
|
||||
protected function isRootWritable(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$this->log->info('Checking if root is writable');
|
||||
|
||||
|
@ -1205,7 +1215,7 @@ class InstallPreChecks
|
|||
public function checkFolderIsWritable(string $folderName, array &$labels, string $parentDir = ''): array
|
||||
{
|
||||
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$this->log->info('Checking ' . $folderName . ' is writable');
|
||||
|
||||
|
@ -1245,7 +1255,7 @@ class InstallPreChecks
|
|||
|
||||
private function canTouchEnv(&$labels): array
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
$this->loadModStrings();
|
||||
|
||||
$labels[] = $this->modStrings['LBL_CHECKSYS_ENV'];
|
||||
|
||||
|
@ -1256,7 +1266,7 @@ class InstallPreChecks
|
|||
'errors' => []
|
||||
];
|
||||
|
||||
if (file_exists($env) && is_writable($env) || !file_exists($env) && touch($env)) {
|
||||
if ((file_exists($env) && is_writable($env)) || (!file_exists($env) && touch($env))) {
|
||||
$this->log->info('.env exists or is writable');
|
||||
$results['result'] = $this->modStrings['LBL_CHECKSYS_OK'];
|
||||
|
||||
|
@ -1266,4 +1276,28 @@ class InstallPreChecks
|
|||
$results['errors'][] = $this->modStrings['ERR_CHECKSYS_ENV_NOT_WRITABLE'];
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getCssFile(): mixed
|
||||
{
|
||||
$files = scandir('dist');
|
||||
|
||||
foreach ($files as $file) {
|
||||
|
||||
if (preg_match("/styles\.[^.]+\.css/", $file)) {
|
||||
$cssFile = $file;
|
||||
}
|
||||
}
|
||||
return $cssFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function loadModStrings(): void
|
||||
{
|
||||
$this->modStrings = $this->getLanguageStrings();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue