7
7
8
8
namespace Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey ;
9
9
10
+ use Magento \Framework \App \DeploymentConfig ;
11
+ use Magento \Framework \Config \ConfigOptionsListConstants ;
10
12
use Magento \Framework \ObjectManagerInterface ;
11
13
use Magento \GraphQl \Model \Query \ContextFactoryInterface ;
12
14
use Magento \GraphQlResolverCache \Model \Resolver \Result \ValueProcessorInterface ;
16
18
*/
17
19
class Calculator
18
20
{
21
+ /**
22
+ * @var DeploymentConfig
23
+ */
24
+ private $ deploymentConfig ;
25
+
19
26
/**
20
27
* @var ContextFactoryInterface
21
28
*/
@@ -42,17 +49,20 @@ class Calculator
42
49
private ValueProcessorInterface $ valueProcessor ;
43
50
44
51
/**
52
+ * @param DeploymentConfig $deploymentConfig
45
53
* @param ContextFactoryInterface $contextFactory
46
54
* @param ObjectManagerInterface $objectManager
47
55
* @param ValueProcessorInterface $valueProcessor
48
56
* @param string[] $factorProviders
49
57
*/
50
58
public function __construct (
59
+ DeploymentConfig $ deploymentConfig ,
51
60
ContextFactoryInterface $ contextFactory ,
52
61
ObjectManagerInterface $ objectManager ,
53
62
ValueProcessorInterface $ valueProcessor ,
54
63
array $ factorProviders = []
55
64
) {
65
+ $ this ->deploymentConfig = $ deploymentConfig ;
56
66
$ this ->contextFactory = $ contextFactory ;
57
67
$ this ->factorProviders = $ factorProviders ;
58
68
$ this ->objectManager = $ objectManager ;
@@ -76,7 +86,8 @@ public function calculateCacheKey(?array $parentData = null): ?string
76
86
try {
77
87
$ this ->initializeFactorProviderInstances ();
78
88
$ factors = $ this ->getFactors ($ parentData );
79
- $ keysString = strtoupper (implode ('| ' , array_values ($ factors )));
89
+ $ salt = (string )$ this ->deploymentConfig ->get (ConfigOptionsListConstants::CONFIG_PATH_CRYPT_KEY );
90
+ $ keysString = strtoupper (implode ('| ' , array_values ($ factors ))). "| $ salt " ;
80
91
return hash ('sha256 ' , $ keysString );
81
92
} catch (\Throwable $ e ) {
82
93
throw new CalculationException ($ e ->getMessage (), $ e ->getCode (), $ e );
0 commit comments