From 62b8b30e3a0ecb84bc7c09706163c9a41bc001dc Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 29 Apr 2020 15:16:47 +0300 Subject: [PATCH 1/4] Update SECURITY.md --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index e835ef2d23..5325e8d538 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,4 +6,4 @@ If you believe you have discovered a vulnerability in EspoCRM please contacts us ## Supported versions -For severe vulnerabilities we provide fixes for 5 minor versions (the second number in the version string) back from the current stable version. +For severe vulnerabilities we provide fixes for 2 minor versions (the second number in the version string) back from the current stable version. Separate patches or manual fix guidelines will be provided for more old versions. From e9103eb796139aae4f099a554012052c22cef63a Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 30 Apr 2020 11:09:04 +0300 Subject: [PATCH 2/4] Update README.md --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6efa2c5c44..f9e660ee61 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ ## EspoCRM -EspoCRM is an Open Source CRM (Customer Relationship Management) software that allows you to see, enter and evaluate all your company relationships regardless of the type. People, companies or opportunities - all in an easy and intuitive interface. +[EspoCRM is an Open Source CRM](https://www.espocrm.com) (Customer Relationship Management) software that allows you to see, enter and evaluate all your company relationships regardless of the type. People, companies or opportunities - all in an easy and intuitive interface. -It's a web application with a frontend designed as a single page application based on backbone.js and a REST API backend written in PHP. +It's a web application with a frontend designed as a single page application and REST API backend written in PHP. -Download the latest release from our [website](https://www.espocrm.com). +[Download](https://www.espocrm.com/download/) the latest release from our website. ### Requirements * PHP 7.2 and later (with pdo, json, gd, openssl, zip, imap, mbstring, curl extensions); * MySQL 5.7 (and later), or MariaDB 10.1 (and later). -For more information about server configuration see [this article](https://www.espocrm.com/documentation/administration/server-configuration/). +For more information about server configuration see [this article](https://docs.espocrm.com/administration/server-configuration/). ### Documentation -Documentation for administrators, users and developers is available [here](https://www.espocrm.com/documentation/). +Documentation for administrators, users and developers is available [here](https://docs.espocrm.com). ### How to report a bug @@ -23,13 +23,13 @@ Create an issue [here](https://github.com/espocrm/espocrm/issues) or post on our ### How to install a stable version -[Download](https://www.espocrm.com/download/) the latest version. See the [instructions](https://www.espocrm.com/documentation/administration/installation/) about installation. +[Download](https://www.espocrm.com/download/) the latest version. See the [instructions](https://docs.espocrm.com/administration/installation/) about installation. ### Development -* [Getting started](https://github.com/espocrm/documentation/blob/master/development/how-to-start.md) -* [Running tests](https://github.com/espocrm/documentation/blob/master/development/tests.md) -* [Making translation](https://github.com/espocrm/documentation/blob/master/development/translation.md) +* [Getting started](https://docs.espocrm.com/development/how-to-start) +* [Running tests](https://docs.espocrm.com/development/tests) +* [Making translation](https://docs.espocrm.com/development/translation) ### How to contribute From bc9715656917f21f44bd05bec6721d404d885b68 Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Thu, 30 Apr 2020 11:54:52 +0300 Subject: [PATCH 3/4] Displaying upgrading process --- application/Espo/Core/Console/Commands/Upgrade.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/application/Espo/Core/Console/Commands/Upgrade.php b/application/Espo/Core/Console/Commands/Upgrade.php index 38d61c821a..8219e729c8 100644 --- a/application/Espo/Core/Console/Commands/Upgrade.php +++ b/application/Espo/Core/Console/Commands/Upgrade.php @@ -261,6 +261,8 @@ class Upgrade extends Base try { foreach ($stepList as $stepName) { + fwrite(\STDOUT, "."); + $upgradeManager = $this->getUpgradeManager(true); $upgradeManager->runInstallStep($stepName, ['id' => $upgradeId]); } @@ -277,8 +279,9 @@ class Upgrade extends Base $phpExecutablePath = $this->getPhpExecutablePath(); foreach ($stepList as $stepName) { - $command = $phpExecutablePath . " command.php upgrade-step --step=". ucfirst($stepName) ." --id=". $upgradeId; + fwrite(\STDOUT, "."); + $command = $phpExecutablePath . " command.php upgrade-step --step=". ucfirst($stepName) ." --id=". $upgradeId; $shellResult = shell_exec($command); if ($shellResult !== 'true') { $GLOBALS['log']->error('Upgrade Error: ' . $shellResult); From bf131b7a0e2c13fdca549d036bb8ae37b64847ee Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Fri, 1 May 2020 14:29:28 +0300 Subject: [PATCH 4/4] Added 'dbType' => 'longtext' for text fields --- .../DBAL/FieldTypes/JsonArrayType.php | 8 +-- .../DBAL/FieldTypes/JsonObjectType.php | 8 +-- .../Database/DBAL/FieldTypes/LongtextType.php | 52 +++++++++++++++++++ .../Database/DBAL/FieldTypes/TextType.php | 45 ++++++++++++++++ .../Utils/Database/DBAL/Schema/Comparator.php | 21 ++++---- .../DBAL/Schema/MySqlSchemaManager.php | 2 +- .../Database/Schema/tables/preferences.php | 3 +- 7 files changed, 112 insertions(+), 27 deletions(-) create mode 100644 application/Espo/Core/Utils/Database/DBAL/FieldTypes/LongtextType.php create mode 100644 application/Espo/Core/Utils/Database/DBAL/FieldTypes/TextType.php diff --git a/application/Espo/Core/Utils/Database/DBAL/FieldTypes/JsonArrayType.php b/application/Espo/Core/Utils/Database/DBAL/FieldTypes/JsonArrayType.php index d963273004..36550886d4 100644 --- a/application/Espo/Core/Utils/Database/DBAL/FieldTypes/JsonArrayType.php +++ b/application/Espo/Core/Utils/Database/DBAL/FieldTypes/JsonArrayType.php @@ -29,7 +29,7 @@ namespace Espo\Core\Utils\Database\DBAL\FieldTypes; -class JsonArrayType extends \Doctrine\DBAL\Types\TextType +class JsonArrayType extends TextType { const JSON_ARRAY = 'jsonArray'; @@ -37,10 +37,4 @@ class JsonArrayType extends \Doctrine\DBAL\Types\TextType { return self::JSON_ARRAY; } - - public static function getDbTypeName() - { - return 'TEXT'; - } - } diff --git a/application/Espo/Core/Utils/Database/DBAL/FieldTypes/JsonObjectType.php b/application/Espo/Core/Utils/Database/DBAL/FieldTypes/JsonObjectType.php index f112af8d88..26daf8d5e0 100644 --- a/application/Espo/Core/Utils/Database/DBAL/FieldTypes/JsonObjectType.php +++ b/application/Espo/Core/Utils/Database/DBAL/FieldTypes/JsonObjectType.php @@ -29,7 +29,7 @@ namespace Espo\Core\Utils\Database\DBAL\FieldTypes; -class JsonObjectType extends \Doctrine\DBAL\Types\TextType +class JsonObjectType extends TextType { const JSON_OBJECT = 'jsonObject'; @@ -37,10 +37,4 @@ class JsonObjectType extends \Doctrine\DBAL\Types\TextType { return self::JSON_OBJECT; } - - public static function getDbTypeName() - { - return 'TEXT'; - } - } diff --git a/application/Espo/Core/Utils/Database/DBAL/FieldTypes/LongtextType.php b/application/Espo/Core/Utils/Database/DBAL/FieldTypes/LongtextType.php new file mode 100644 index 0000000000..fb430322d6 --- /dev/null +++ b/application/Espo/Core/Utils/Database/DBAL/FieldTypes/LongtextType.php @@ -0,0 +1,52 @@ +getType() != $column2->getType() ) { //espo: fix problem with executing query for custom types @@ -82,15 +83,6 @@ class Comparator extends \Doctrine\DBAL\Schema\Comparator } } - if ($column1->getType() instanceof \Doctrine\DBAL\Types\TextType) { - $length1 = $column1->getLength() ?: 16777215/* mediumtext length*/; - $length2 = $column2->getLength() ?: 16777215; - - if ($length1 != -1 && $length2 != -1 && $length2 > $length1) { - $changedProperties[] = 'length'; - } - } - if ($column1->getType() instanceof \Doctrine\DBAL\Types\DecimalType) { if (($column1->getPrecision()?:10) != ($column2->getPrecision()?:10)) { $changedProperties[] = 'precision'; @@ -124,7 +116,7 @@ class Comparator extends \Doctrine\DBAL\Schema\Comparator $changedProperties = array_merge($changedProperties, $diffKeys); - /** Espo: do not change a field length while changing other parameters */ + /** Espo: do not change a field length downwards */ if (!empty($changedProperties) && !in_array('length', $changedProperties) && $column1->getType() instanceof \Doctrine\DBAL\Types\StringType) { $length1 = $column1->getLength() ?: 255; $length2 = $column2->getLength() ?: 255; @@ -134,6 +126,15 @@ class Comparator extends \Doctrine\DBAL\Schema\Comparator $column2->setLength($length1); } } + + if (in_array('type', $changedProperties) && $column1->getType() instanceof \Doctrine\DBAL\Types\TextType && isset($column1DbTypeName) && isset($column2DbTypeName)) { + $constName1 = '\Espo\Core\Utils\Database\DBAL\Platforms\MySqlPlatform::LENGTH_LIMIT_' . strtoupper($column1DbTypeName); + $constName2 = '\Espo\Core\Utils\Database\DBAL\Platforms\MySqlPlatform::LENGTH_LIMIT_' . strtoupper($column2DbTypeName); + + if (defined($constName1) && defined($constName2) && constant($constName1) >= constant($constName2)) { + $changedProperties = array_diff($changedProperties, ['type']); + } + } /** Espo: end */ return $changedProperties; diff --git a/application/Espo/Core/Utils/Database/DBAL/Schema/MySqlSchemaManager.php b/application/Espo/Core/Utils/Database/DBAL/Schema/MySqlSchemaManager.php index bd70317930..96e5fad554 100644 --- a/application/Espo/Core/Utils/Database/DBAL/Schema/MySqlSchemaManager.php +++ b/application/Espo/Core/Utils/Database/DBAL/Schema/MySqlSchemaManager.php @@ -209,7 +209,7 @@ class MySqlSchemaManager extends \Doctrine\DBAL\Schema\MySqlSchemaManager case 'text': case 'mediumtext': case 'longtext': - $length = $this->_platform->getClobTypeLength($dbType); + $length = null; break; /* Espo: end */ } diff --git a/application/Espo/Core/Utils/Database/Schema/tables/preferences.php b/application/Espo/Core/Utils/Database/Schema/tables/preferences.php index b6a5fe06fc..b777c52395 100644 --- a/application/Espo/Core/Utils/Database/Schema/tables/preferences.php +++ b/application/Espo/Core/Utils/Database/Schema/tables/preferences.php @@ -46,8 +46,7 @@ return [ 'type' => 'id', ], 'data' => [ - 'type' => 'text', - 'len' => 16777216, + 'type' => 'text' ] ] ],