9
9
use Magento \Framework \Config \ConfigOptionsListConstants ;
10
10
use Magento \Framework \Config \Data \ConfigData ;
11
11
use Magento \Framework \Config \File \ConfigFilePool ;
12
+ use Magento \Framework \App \ObjectManager ;
12
13
13
14
/**
14
15
* Encryption key changer resource model
@@ -66,15 +67,13 @@ public function __construct(
66
67
\Magento \Config \Model \Config \Structure $ structure ,
67
68
\Magento \Framework \Encryption \EncryptorInterface $ encryptor ,
68
69
\Magento \Framework \App \DeploymentConfig \Writer $ writer ,
69
- \Magento \Framework \Math \Random $ random ,
70
70
$ connectionName = null
71
71
) {
72
72
$ this ->encryptor = clone $ encryptor ;
73
73
parent ::__construct ($ context , $ connectionName );
74
74
$ this ->directory = $ filesystem ->getDirectoryWrite (DirectoryList::CONFIG );
75
75
$ this ->structure = $ structure ;
76
76
$ this ->writer = $ writer ;
77
- $ this ->random = $ random ;
78
77
}
79
78
80
79
/**
@@ -102,7 +101,7 @@ public function changeEncryptionKey($key = null)
102
101
}
103
102
104
103
if (null === $ key ) {
105
- $ key = md5 ($ this ->random ->getRandomString (ConfigOptionsListConstants::STORE_KEY_RANDOM_STRING_SIZE ));
104
+ $ key = md5 ($ this ->getRandom () ->getRandomString (ConfigOptionsListConstants::STORE_KEY_RANDOM_STRING_SIZE ));
106
105
}
107
106
$ this ->encryptor ->setNewKey ($ key );
108
107
@@ -125,6 +124,19 @@ public function changeEncryptionKey($key = null)
125
124
}
126
125
}
127
126
127
+ /**
128
+ * Get Math Random
129
+ *
130
+ * @return \Magento\Framework\Math\Random
131
+ */
132
+ public function getRandom ()
133
+ {
134
+ if (!$ this ->random ) {
135
+ $ this ->random = ObjectManager::getInstance ()->get ('\Magento\Framework\Math\Random ' );
136
+ }
137
+ return $ this ->random ;
138
+ }
139
+
128
140
/**
129
141
* Gather all encrypted system config values and re-encrypt them
130
142
*
0 commit comments