File tree Expand file tree Collapse file tree 1 file changed +35
-3
lines changed
app/code/Meta/BusinessExtension/Model/Api Expand file tree Collapse file tree 1 file changed +35
-3
lines changed Original file line number Diff line number Diff line change 21
21
namespace Meta \BusinessExtension \Model \Api ;
22
22
23
23
use Meta \BusinessExtension \Api \AdobeCloudConfigInterface ;
24
+ use Magento \Framework \Filesystem \DirectoryList ;
24
25
25
26
class AdobeCloudConfig implements AdobeCloudConfigInterface
26
27
{
28
+ /**
29
+ * List of files and directories unique to an Adobe Commerce Cloud deployment.
30
+ * Their presence indicates the site is running on the cloud infrastructure.
31
+ */
32
+ public const CLOUD_FILES = [
33
+ '.magento.app.yaml ' ,
34
+ '/vendor/magento/ece-tools/composer.json '
35
+ ];
36
+
37
+ /**
38
+ * @var DirectoryList
39
+ */
40
+ private $ directoryList ;
41
+
42
+ /**
43
+ * Class constructor
44
+ *
45
+ * @param DirectoryList $directoryList
46
+ */
47
+ public function __construct (
48
+ DirectoryList $ directoryList
49
+ ) {
50
+ $ this ->directoryList = $ directoryList ;
51
+ }
52
+
27
53
/**
28
54
* Detect if the current seller's service is on hosted Adobe Cloud
29
55
*
30
56
* @return bool
31
57
*/
32
58
public function isSellerOnAdobeCloud (): bool
33
59
{
34
- // Need to grab the env var in someway, and getenv() function also generates linter error
35
- // phpcs:ignore
36
- return isset ($ _ENV ['MAGENTO_CLOUD_ENVIRONMENT ' ]);
60
+ $ rootPath = $ this ->directoryList ->getRoot ();
61
+
62
+ foreach (self ::CLOUD_FILES as $ file ) {
63
+ if (file_exists ($ rootPath . '/ ' . $ file )) {
64
+ return true ;
65
+ }
66
+ }
67
+
68
+ return false ;
37
69
}
38
70
39
71
/**
You can’t perform that action at this time.
0 commit comments