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 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
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
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 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
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
This commit is contained in:
76
upgrades/6.0/scripts/AfterUpgrade.php
Normal file
76
upgrades/6.0/scripts/AfterUpgrade.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?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.
|
||||
************************************************************************/
|
||||
|
||||
class AfterUpgrade
|
||||
{
|
||||
public function run($container)
|
||||
{
|
||||
$this->container = $container;
|
||||
|
||||
$this->processEmailAccountsUpdate();
|
||||
|
||||
$this->cleanupFiles();
|
||||
}
|
||||
|
||||
protected function processEmailAccountsUpdate()
|
||||
{
|
||||
$pdo = $this->container->get('entityManager')->getPDO();
|
||||
|
||||
$q1 = "UPDATE `email_account` SET email_account.security = '' WHERE email_account.ssl = 0";
|
||||
$q2 = "UPDATE `inbound_email` SET inbound_email.security = '' WHERE inbound_email.ssl = 0";
|
||||
|
||||
$pdo->exec($q1);
|
||||
$pdo->exec($q2);
|
||||
}
|
||||
|
||||
protected function cleanupFiles()
|
||||
{
|
||||
$fileManager = $this->container->get('fileManager');
|
||||
|
||||
$fileList = [
|
||||
'application/Espo/Core/Loaders/ClientManager.php',
|
||||
'client/res/templates/record/panels/default-side.tpl',
|
||||
'application/Espo/Resources/templates/noteEmailRecieved',
|
||||
];
|
||||
|
||||
foreach ($fileList as $file) {
|
||||
if (is_dir($file)) {
|
||||
$fileManager->removeInDir($file, true);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!file_exists($file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
185
upgrades/6.0/scripts/BeforeUpgrade.php
Normal file
185
upgrades/6.0/scripts/BeforeUpgrade.php
Normal file
@@ -0,0 +1,185 @@
|
||||
<?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.
|
||||
************************************************************************/
|
||||
|
||||
use Espo\Core\Exceptions\Error;
|
||||
|
||||
class BeforeUpgrade
|
||||
{
|
||||
public function run($container)
|
||||
{
|
||||
$this->container = $container;
|
||||
|
||||
$this->processCheckCLI();
|
||||
|
||||
$this->processCheckExtensions();
|
||||
|
||||
$this->processMyIsamCheck();
|
||||
|
||||
$this->processNextNumberAlterTable();
|
||||
}
|
||||
|
||||
protected function processCheckCLI()
|
||||
{
|
||||
$isCli = (substr(php_sapi_name(), 0, 3) == 'cli') ? true : false;
|
||||
|
||||
if (!$isCli) {
|
||||
throw new Error("This upgrade can be run only from CLI.");
|
||||
}
|
||||
}
|
||||
|
||||
protected function processCheckExtensions()
|
||||
{
|
||||
$em = $this->container->get('entityManager');
|
||||
|
||||
$extension = $em->getRepository('Extension')
|
||||
->where([
|
||||
'name' => 'Google Integration',
|
||||
'isInstalled' => true,
|
||||
])
|
||||
->findOne();
|
||||
|
||||
if ($extension) {
|
||||
$version = $extension->get('version');
|
||||
|
||||
if (version_compare($version, '1.4.2', '<')) {
|
||||
$message =
|
||||
"EspoCRM 6.0.0 is not compatible with Google Integration extension of a version lower than 1.4.2. " .
|
||||
"Please upgrade the extension or uninstall it. Then run the upgrade command again.";
|
||||
|
||||
throw new Error($message);
|
||||
}
|
||||
}
|
||||
|
||||
$extension = $em->getRepository('Extension')
|
||||
->where([
|
||||
'name' => 'Real Estate',
|
||||
'isInstalled' => true,
|
||||
])
|
||||
->findOne();
|
||||
|
||||
if ($extension) {
|
||||
$version = $extension->get('version');
|
||||
|
||||
if (version_compare($version, '1.4.0', '<')) {
|
||||
$message =
|
||||
"EspoCRM 6.0.0 is not compatible with Real Estate extension of a version lower than 1.4.0. " .
|
||||
"Please upgrade the extension or uninstall it. Then run the upgrade command again.";
|
||||
|
||||
throw new Error($message);
|
||||
}
|
||||
}
|
||||
|
||||
$extension = $em->getRepository('Extension')
|
||||
->where([
|
||||
'name' => 'VoIP Integration',
|
||||
'isInstalled' => true,
|
||||
])
|
||||
->findOne();
|
||||
|
||||
if ($extension) {
|
||||
$version = $extension->get('version');
|
||||
|
||||
if (version_compare($version, '1.15.0', '<')) {
|
||||
$message =
|
||||
"EspoCRM 6.0.0 is not compatible with VoIP Integration extension of a version lower than 1.15.0. " .
|
||||
"Please upgrade the extension or uninstall it. Then run the upgrade command again.";
|
||||
|
||||
throw new Error($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function processMyIsamCheck()
|
||||
{
|
||||
$myisamTableList = $this->getMyIsamTableList();
|
||||
|
||||
if (empty($myisamTableList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$isCli = (substr(php_sapi_name(), 0, 3) == 'cli') ? true : false;
|
||||
|
||||
$tableListString = implode(", ", $myisamTableList);
|
||||
|
||||
$lineBreak = $isCli ? "\n" : "<br>";
|
||||
|
||||
$link = "https://www.espocrm.com/blog/converting-myisam-engine-to-innodb";
|
||||
|
||||
$linkString = $isCli ? $link : "<a href=\"{$link}\" target=\"_blank\">link</a>";
|
||||
|
||||
$message =
|
||||
"In v6.0 we have dropped a support of MyISAM engine for DB tables. " .
|
||||
"You have the following tables that use MyISAM: {$tableListString}.{$lineBreak}{$lineBreak}" .
|
||||
"Please change the engine to InnoDB for these tables then run upgrade again.{$lineBreak}{$lineBreak}" .
|
||||
"See: {$linkString}.";
|
||||
|
||||
throw new Error($message);
|
||||
}
|
||||
|
||||
protected function getMyIsamTableList()
|
||||
{
|
||||
$container = $this->container;
|
||||
|
||||
$pdo = $container->get('entityManager')->getPDO();
|
||||
$databaseInfo = $container->get('config')->get('database');
|
||||
|
||||
try {
|
||||
$sth = $pdo->prepare("
|
||||
SELECT TABLE_NAME as tableName
|
||||
FROM information_schema.TABLES
|
||||
WHERE TABLE_SCHEMA = '". $databaseInfo['dbname'] ."'
|
||||
AND ENGINE = 'MyISAM'
|
||||
");
|
||||
|
||||
$sth->execute();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$tableList = $sth->fetchAll(PDO::FETCH_COLUMN);
|
||||
|
||||
if (empty($tableList)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $tableList;
|
||||
}
|
||||
|
||||
protected function processNextNumberAlterTable()
|
||||
{
|
||||
$pdo = $this->container->get('entityManager')->getPDO();
|
||||
|
||||
$q1 = "ALTER TABLE `next_number` CHANGE `entity_type` `entity_type` VARCHAR(100)";
|
||||
$q2 = "ALTER TABLE `next_number` CHANGE `field_name` `field_name` VARCHAR(100)";
|
||||
|
||||
$pdo->exec($q1);
|
||||
$pdo->exec($q2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user