snapshot of https://github.com/espocrm/espocrm.git (master, 2026-09-18; blobs > 131072B omitted)
Some checks failed
Test / Test on PHP 8.3 (push) Failing after 5s
Test / Test on PHP 8.4 (push) Failing after 4s
Test / Test on PHP 8.5 (push) Failing after 3s
TypeScript static analysis / TypeScript check (push) Failing after 14s
Test Integration on MySQL / Test on PHP 8.3 (push) Failing after 2s
Test Integration on MySQL / Test on PHP 8.5 (push) Failing after 0s
Test Integration on PostgreSQL / Test on PHP 8.4 fix (push) Failing after 1s
Test Integration on PostgreSQL / Test on PHP 8.4 master (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-18 04:19:15 +05:00
commit 7cc7e6b4f3
10077 changed files with 900756 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Application\Runner;
use Espo\Core\Api\Starter;
/**
* Runs API request processing.
*/
class Api implements Runner
{
public function __construct(private Starter $starter)
{}
public function run(): void
{
$this->starter->start();
}
}

View File

@@ -0,0 +1,39 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Application\Runner;
/**
* @deprecated For backward compatibility.
*/
interface ApplicationRunner extends Runner
{
}

View File

@@ -0,0 +1,53 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Application\Runner;
use Espo\Core\DataManager;
use Espo\Core\Exceptions\Error;
/**
* Clears an application cache.
*/
class ClearCache implements Runner
{
use Cli;
public function __construct(private DataManager $dataManager)
{}
/**
* @throws Error
*/
public function run(): void
{
$this->dataManager->clearCache();
}
}

View File

@@ -0,0 +1,38 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
/**
* Can be run only via CLI.
*/
trait Cli
{
public static bool $cli = true;
}

View File

@@ -0,0 +1,54 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Application\Runner;
use Espo\Core\Utils\ClientManager;
use Espo\Core\Utils\Config;
/**
* Displays the main HTML page.
*/
class Client implements Runner
{
public function __construct(private ClientManager $clientManager, private Config $config)
{}
public function run(): void
{
if (!$this->config->get('isInstalled')) {
header("Location: install/");
return;
}
$this->clientManager->display();
}
}

View File

@@ -0,0 +1,59 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Application\Runner;
use Espo\Core\Console\CommandManager as ConsoleCommandManager;
use Exception;
/**
* Runs a console command.
*/
class Command implements Runner
{
use Cli;
public function __construct(private ConsoleCommandManager $commandManager)
{}
public function run(): void
{
try {
$exitStatus = $this->commandManager->run($_SERVER['argv']);
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
exit(1);
}
exit($exitStatus);
}
}

View File

@@ -0,0 +1,77 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Application\Exceptions\RunnerException;
use Espo\Core\Application\Runner;
use Espo\Core\Job\Exceptions\TooFrequentRun;
use Espo\Core\Job\JobManager;
use Espo\Core\Job\PrepareProcessor;
use Espo\Core\Utils\Config\SystemConfig;
use Espo\Core\Utils\Log;
/**
* Runs Cron.
*/
class Cron implements Runner
{
use Cli;
use SetupSystemUser;
public function __construct(
private PrepareProcessor $prepareProcessor,
private JobManager $jobManager,
private SystemConfig $config,
private Log $log,
) {}
public function run(): void
{
if (!$this->config->isCronEnabled()) {
$this->log->warning("Cron is skipped as 'cronDisabled' is set to true in the config.");
return;
}
if ($this->config->isMaintenanceMode()) {
$this->log->warning("Cron run is skipped in maintenance mode.");
return;
}
try {
$this->prepareProcessor->process();
} catch (TooFrequentRun $e) {
throw new RunnerException('Too frequent run.', previous: $e);
}
$this->jobManager->processMainQueue();
}
}

View File

@@ -0,0 +1,123 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Application\Runner;
use Espo\Core\Job\Processing\Util\ExitSetup;
use Espo\Core\Utils\Config;
use Espo\Core\Utils\Log;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
/**
* Runs daemon. The daemon runs the cron more often than once a minute.
*/
class Daemon implements Runner
{
use Cli;
private bool $stopped = false;
public function __construct(
private Config $config,
private Log $log,
private ExitSetup $exitSetup,
) {}
public function run(): void
{
$maxProcessNumber = $this->config->get('daemonMaxProcessNumber');
$interval = $this->config->get('daemonInterval');
$timeout = $this->config->get('daemonProcessTimeout');
$phpExecutablePath = $this->config->get('phpExecutablePath');
if (!$phpExecutablePath) {
$phpExecutablePath = (new PhpExecutableFinder)->find();
}
if (!$maxProcessNumber || !$interval) {
$this->log->error("Daemon config params are not set.");
return;
}
$this->exitSetup->setup(function () {
$this->stopped = true;
});
$processList = [];
while (!$this->isStopped()) { /** @phpstan-ignore-line */
$toSkip = false;
$runningCount = 0;
foreach ($processList as $i => $process) {
if ($process->isRunning()) {
$runningCount++;
} else {
unset($processList[$i]);
}
}
$processList = array_values($processList);
if ($runningCount >= $maxProcessNumber) {
$toSkip = true;
}
if (!$toSkip) {
$process = new Process([$phpExecutablePath, 'cron.php']);
$process->setTimeout($timeout);
$process->start();
$processList[] = $process;
}
/** @noinspection PhpConditionAlreadyCheckedInspection */
if ($this->isStopped()) {
break;
}
sleep($interval);
}
}
/**
* @phpstan-impure
*/
private function isStopped(): bool
{
return $this->stopped;
}
}

View File

@@ -0,0 +1,78 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Application\Exceptions\RunnerException;
use Espo\Core\Application\RunnerParameterized;
use Espo\Core\Application\Runner\Params;
use Espo\Core\EntryPoint\Params as EntryPointParams;
use Espo\Core\EntryPoint\Starter;
use Espo\Core\Exceptions\Forbidden;
use Espo\Core\Exceptions\NotFound;
use RuntimeException;
/**
* Runs an entry point.
*/
class EntryPoint implements RunnerParameterized
{
public const string PARAM_ENTRY_POINT = 'entryPoint';
public const string PARAM_FINAL = 'final';
public function __construct(private Starter $starter)
{}
public function run(Params $params): void
{
$entryPointParams = new EntryPointParams(
name: $this->getName($params),
final: $params->get(self::PARAM_FINAL) === true,
);
try {
$this->starter->start($entryPointParams);
} catch (Forbidden|NotFound $e) {
$message = $e->getMessage();
throw new RunnerException($message, previous: $e);
}
}
private function getName(Params $params): ?string
{
$name = $params->get(self::PARAM_ENTRY_POINT);
if ($name !== null && !is_string($name)) {
throw new RuntimeException("Bad 'entryPoint' value.");
}
return $name;
}
}

View File

@@ -0,0 +1,53 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Application\Runner\Params;
use Espo\Core\Application\RunnerParameterized;
use Espo\Core\Job\JobManager;
/**
* Runs a job by ID. A job record should exist in database.
*/
class Job implements RunnerParameterized
{
use Cli;
use SetupSystemUser;
public function __construct(private JobManager $jobManager)
{}
public function run(Params $params): void
{
$id = $params->get('id');
$this->jobManager->runJobById($id);
}
}

View File

@@ -0,0 +1,107 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Api\ErrorOutput;
use Espo\Core\Api\RequestWrapper;
use Espo\Core\Api\ResponseWrapper;
use Espo\Core\Application\Runner\Params;
use Espo\Core\Application\RunnerParameterized;
use Espo\Core\Exceptions\BadRequest;
use Espo\Core\Exceptions\NotFound;
use Espo\Core\Portal\Application as PortalApplication;
use Espo\Core\Portal\ApplicationRunners\Client as PortalPortalClient;
use Espo\Core\Portal\Utils\Url;
use Espo\Core\Utils\ClientManager;
use Espo\Core\Utils\Config;
use Slim\Factory\ServerRequestCreatorFactory;
use Slim\Psr7\Response;
use Slim\ResponseEmitter;
use Exception;
/**
* Runs a portal client.
*/
class PortalClient implements RunnerParameterized
{
public function __construct(
private ClientManager $clientManager,
private Config $config,
private ErrorOutput $errorOutput
) {}
/**
* @throws BadRequest
*/
public function run(Params $params): void
{
$id = $params->get('id') ??
Url::detectPortalId() ??
$this->config->get('defaultPortalId');
$basePath = $params->get('basePath') ?? $this->clientManager->getBasePath();
$requestWrapped = new RequestWrapper(
ServerRequestCreatorFactory::create()->createServerRequestFromGlobals()
);
$responseWrapped = new ResponseWrapper(new Response());
if ($requestWrapped->getMethod() !== 'GET') {
throw new BadRequest("Only GET request is allowed.");
}
try {
if (!$id) {
throw new NotFound("Portal ID not detected.");
}
$application = new PortalApplication($id);
} catch (Exception $e) {
$this->processError($requestWrapped, $responseWrapped, $e);
return;
}
$application->setClientBasePath($basePath);
$application->run(PortalPortalClient::class);
}
private function processError(RequestWrapper $request, ResponseWrapper $response, Exception $exception): void
{
$this->errorOutput->processWithBodyPrinting($request, $response, $exception);
(new ResponseEmitter())->emit($response->toPsr7());
}
}

View File

@@ -0,0 +1,85 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Application\Runner;
use Espo\Core\Utils\Preload as PreloadUtil;
use Throwable;
/**
* Runs a preload.
*
* @see https://www.php.net/manual/en/opcache.preloading.php
*/
class Preload implements Runner
{
use Cli;
/**
* @throws Throwable
*/
public function run(): void
{
$preload = new PreloadUtil();
try {
$preload->process();
} catch (Throwable $e) {
$this->processException($e);
throw $e;
}
$count = $preload->getCount();
echo "Success." . PHP_EOL;
echo "Files loaded: " . $count . "." . PHP_EOL;
}
protected function processException(Throwable $e): void
{
echo "Error occurred." . PHP_EOL;
$msg = $e->getMessage();
if ($msg) {
echo "Message: $msg" . PHP_EOL;
}
$file = $e->getFile();
if ($file) {
echo "File: $file" . PHP_EOL;
}
echo "Line: " . $e->getLine() . PHP_EOL;
}
}

View File

@@ -0,0 +1,63 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Application\Runner;
use Espo\Core\DataManager;
use Espo\Core\Utils\Log;
use Exception;
/**
* Rebuilds an application.
*/
class Rebuild implements Runner
{
use Cli;
public function __construct(private DataManager $dataManager, private Log $log)
{}
public function run(): void
{
try {
$this->dataManager->rebuild();
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
$this->log->error('Rebuild: ' . $e->getMessage(), [
'file' => $e->getFile(),
'line' => $e->getLine(),
'exception' => $e,
]);
exit(1);
}
}
}

View File

@@ -0,0 +1,38 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
/**
* System user will be set up for an application.
*/
trait SetupSystemUser
{
public static bool $setupSystemUser = true;
}

View File

@@ -0,0 +1,49 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM – Open Source CRM application.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
* 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 "EspoCRM" word.
************************************************************************/
namespace Espo\Core\ApplicationRunners;
use Espo\Core\Application\Runner;
use Espo\Core\WebSocket\ServerStarter;
/**
* Runs WebSocket.
*/
class WebSocket implements Runner
{
use Cli;
public function __construct(private ServerStarter $serverStarter)
{}
public function run(): void
{
$this->serverStarter->start();
}
}