Skip to content

Commit dbda7e7

Browse files
committed
[ASCH-191] Fix Elasticsearch6 generation in Magento 2.3.1
magento/magento2#21916
1 parent cd7b6d6 commit dbda7e7

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
--- Code/Generator.php 2019-04-30 16:45:45.444157451 +0300
2+
+++ Code/Generator.php 2019-04-30 17:19:49.014949518 +0300
3+
@@ -8,11 +8,15 @@
4+
use Magento\Framework\Code\Generator\DefinedClasses;
5+
use Magento\Framework\Code\Generator\EntityAbstract;
6+
use Magento\Framework\Code\Generator\Io;
7+
+use Magento\Framework\ObjectManager\ConfigInterface;
8+
use Magento\Framework\ObjectManagerInterface;
9+
use Magento\Framework\Phrase;
10+
use Magento\Framework\Filesystem\Driver\File;
11+
use Psr\Log\LoggerInterface;
12+
13+
+/**
14+
+ * Class code generator.
15+
+ */
16+
class Generator
17+
{
18+
const GENERATION_SUCCESS = 'success';
19+
@@ -232,7 +236,21 @@
20+
{
21+
if (!$resultEntityType || !$sourceClassName) {
22+
return self::GENERATION_ERROR;
23+
- } elseif ($this->definedClasses->isClassLoadableFromDisk($resultClass)) {
24+
+ }
25+
+
26+
+ /** @var ConfigInterface $omConfig */
27+
+ $omConfig = $this->objectManager->get(ConfigInterface::class);
28+
+ $virtualTypes = $omConfig->getVirtualTypes();
29+
+
30+
+ /**
31+
+ * Do not try to autogenerate virtual types
32+
+ * For example virtual types with names overlapping autogenerated suffixes
33+
+ */
34+
+ if (isset($virtualTypes[$resultClass])) {
35+
+ return self::GENERATION_SKIP;
36+
+ }
37+
+
38+
+ if ($this->definedClasses->isClassLoadableFromDisk($resultClass)) {
39+
$generatedFileName = $this->_ioObject->generateResultFileName($resultClass);
40+
/**
41+
* Must handle two edge cases: a competing process has generated the class and written it to disc already,
42+
@@ -244,9 +263,12 @@
43+
$this->_ioObject->includeFile($generatedFileName);
44+
}
45+
return self::GENERATION_SKIP;
46+
- } elseif (!isset($this->_generatedEntities[$resultEntityType])) {
47+
+ }
48+
+
49+
+ if (!isset($this->_generatedEntities[$resultEntityType])) {
50+
throw new \InvalidArgumentException('Unknown generation entity.');
51+
}
52+
+
53+
return false;
54+
}
55+
}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ magento/framework|Patch-Magento\_Framework-M2.2.5-force-unset-translation.patch|
1515
magento/framework|Patch-Magento\_Framework-M2.2.x-drop-session-fix.patch"|#12362| >= 2.2.0 < 2.2.6
1616
magento/framework|Patch-Magento\_Framework-M2.1.x-Curl-Post-Json.patch|#8373|< 2.2.0
1717
magento/framework|Patch-Magento\_Framework-M2.2.x-PRODSECBUG-2198.patch| < 2.2.8
18+
magento/framework|Patch-Magento\_Framework-M2.3.1-fix-elasticsearch-generation.patch| >= 2.3.1
1819
magento/framework-message-queue|Patch-Message-Queue-Consumer-Transaction.patch| |EE Only < 2.2.0
1920
magento/magento2-base|Patch-Magento\_Base-M2.1.0-widgets-values-utf8-decode.patch|#4232|< 2.1.8 (2.1.4 n/a)
2021
magento/magento2-base|Patch-Magento\_Base-M2.2-cron-prevent-already-running.patch (install all 3 patches *-prevent-already-running)|pull #12497|2.2 < 2.2.6
@@ -142,7 +143,8 @@ Full composer.json example:
142143
"Fix: Unset translations for same key-value only if given force parameter": "https://raw.githubusercontent.com/ConvertGroupsAS/magento2-patches/master/Patch-Magento_Framework-M2.2.5-force-unset-translation.patch",
143144
"Fix: https://github.com/magento/magento2/issues/12362": "https://raw.githubusercontent.com/ConvertGroupsAS/magento2-patches/master/Patch-Magento_Framework-M2.2.x-drop-session-fix.patch",
144145
"Fix: https://github.com/magento/magento2/issues/12362": "https://raw.githubusercontent.com/ConvertGroupsAS/magento2-patches/master/Patch-Magento_Framework-M2.2.6-Fix-session-from-2.2.7.patch",
145-
"Fix: SQL injection vulnerability": "https://raw.githubusercontent.com/ConvertGroupsAS/magento2-patches/master/Patch-Magento_Framework-M2.2.x-PRODSECBUG-2198.patch"
146+
"Fix: SQL injection vulnerability": "https://raw.githubusercontent.com/ConvertGroupsAS/magento2-patches/master/Patch-Magento_Framework-M2.2.x-PRODSECBUG-2198.patch",
147+
"Fix: https://github.com/magento/magento2/issues/21916": "https://raw.githubusercontent.com/ConvertGroupsAS/magento2-patches/master/Patch-Magento_Framework-M2.3.1-fix-elasticsearch-generation.patch"
146148
},
147149
"magento/magento2-base": {
148150
"Fix MAGE_DIRS for CLI": "https://raw.githubusercontent.com/ConvertGroupsAS/magento2-patches/master/Patch-Magento_Base-cli.patch",

0 commit comments

Comments
 (0)