Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
DependencyReadinessCheck Class Reference

Public Member Functions

 __construct (ComposerJsonFinder $composerJsonFinder, DirectoryList $directoryList, File $file, MagentoComposerApplicationFactory $composerAppFactory)
 
 runReadinessCheck (array $packages)
 

Detailed Description

This class checks for dependencies between components after an upgrade. It is used in readiness check.

Definition at line 18 of file DependencyReadinessCheck.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ComposerJsonFinder  $composerJsonFinder,
DirectoryList  $directoryList,
File  $file,
MagentoComposerApplicationFactory  $composerAppFactory 
)

Constructor

Parameters
ComposerJsonFinder$composerJsonFinder
DirectoryList$directoryList
File$file
MagentoComposerApplicationFactory$composerAppFactory

Definition at line 53 of file DependencyReadinessCheck.php.

58  {
59  $this->composerJsonFinder = $composerJsonFinder;
60  $this->directoryList = $directoryList;
61  $this->file = $file;
62  $this->requireUpdateDryRunCommand = $composerAppFactory->createRequireUpdateDryRunCommand();
63  $this->magentoComposerApplication = $composerAppFactory->create();
64  }

Member Function Documentation

◆ runReadinessCheck()

runReadinessCheck ( array  $packages)

Run Composer dependency check

Parameters
array$packages
Returns
array
Exceptions

Definition at line 73 of file DependencyReadinessCheck.php.

74  {
75  $composerJson = $this->composerJsonFinder->findComposerJson();
76  $this->file->copy($composerJson, $this->directoryList->getPath(DirectoryList::VAR_DIR) . '/composer.json');
77  $workingDir = $this->directoryList->getPath(DirectoryList::VAR_DIR);
78  try {
79  foreach ($packages as $package) {
80  if (strpos($package, 'magento/product-enterprise-edition') !== false) {
81  $this->magentoComposerApplication->runComposerCommand(
82  [
83  'command' => 'remove',
84  'packages' => ['magento/product-community-edition'],
85  '--no-update' => true
86  ],
87  $workingDir
88  );
89  }
90  }
91  $this->requireUpdateDryRunCommand->run($packages, $workingDir);
92  return ['success' => true];
93  } catch (\RuntimeException $e) {
94  $message = str_replace(PHP_EOL, '<br/>', htmlspecialchars($e->getMessage()));
95  return ['success' => false, 'error' => $message];
96  }
97  }
$message

The documentation for this class was generated from the following file: