mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-09-02 08:09:19 +08:00
Add Check Route Access to Install Handler
This commit is contained in:
parent
4cc11dc63a
commit
d98d898ca9
1 changed files with 43 additions and 5 deletions
|
@ -32,6 +32,7 @@ use App\Engine\LegacyHandler\LegacyScopeState;
|
||||||
use App\Engine\Model\Feedback;
|
use App\Engine\Model\Feedback;
|
||||||
use App\Install\Service\Installation\InstallStatus;
|
use App\Install\Service\Installation\InstallStatus;
|
||||||
use App\Install\Service\InstallationUtilsTrait;
|
use App\Install\Service\InstallationUtilsTrait;
|
||||||
|
use App\Install\Service\InstallPreChecks;
|
||||||
use PDO;
|
use PDO;
|
||||||
use PDOException;
|
use PDOException;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
@ -78,13 +79,13 @@ class InstallHandler extends LegacyHandler
|
||||||
* @param LoggerInterface $logger
|
* @param LoggerInterface $logger
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $projectDir,
|
string $projectDir,
|
||||||
string $legacyDir,
|
string $legacyDir,
|
||||||
string $legacySessionName,
|
string $legacySessionName,
|
||||||
string $defaultSessionName,
|
string $defaultSessionName,
|
||||||
LegacyScopeState $legacyScopeState,
|
LegacyScopeState $legacyScopeState,
|
||||||
SessionInterface $session,
|
SessionInterface $session,
|
||||||
LoggerInterface $logger
|
LoggerInterface $logger
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
|
@ -202,6 +203,43 @@ class InstallHandler extends LegacyHandler
|
||||||
return $feedback;
|
return $feedback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function runCheckRouteAccess(array $inputArray): FeedBack
|
||||||
|
{
|
||||||
|
$results = [];
|
||||||
|
$url = $inputArray['site_host'];
|
||||||
|
|
||||||
|
require_once "core/backend/Install/Service/InstallPreChecks.php";
|
||||||
|
$installChecks = new InstallPreChecks($this->logger);
|
||||||
|
$results[] = $installChecks->checkMainPage($url);
|
||||||
|
$results[] = $installChecks->checkGraphQlAPI($url);
|
||||||
|
$modStrings = $installChecks->getLanguageStrings();
|
||||||
|
|
||||||
|
$feedback = new Feedback();
|
||||||
|
$feedback->setSuccess(true);
|
||||||
|
$warnings = [];
|
||||||
|
|
||||||
|
foreach ($results as $result) {
|
||||||
|
if (is_array($result['errors'])) {
|
||||||
|
foreach ($result['errors'] as $error) {
|
||||||
|
if (in_array($error, $modStrings)) {
|
||||||
|
$warnings[] = "Check Failed:" . $error . " Please refer to the logs/install.log";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($result['errors'])) {
|
||||||
|
$warnings[] = $result['errors'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($warnings)){
|
||||||
|
$feedback->setWarnings($warnings);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $feedback;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $inputArray
|
* @param array $inputArray
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue