2 namespace TYPO3\CMS\Core\Package;
53 $activePackageStatesConfiguration = array_filter($packageStatesConfiguration,
function ($packageState) {
54 return isset($packageState[
'state']) && $packageState[
'state'] ===
'active';
56 $inactivePackageStatesConfiguration = array_diff_key($packageStatesConfiguration, $activePackageStatesConfiguration);
58 $sortedPackageKeys = $this->dependencyOrderingService->calculateOrder($this->
buildDependencyGraph($activePackageStatesConfiguration));
61 $newPackageStatesConfiguration = array();
62 foreach ($sortedPackageKeys as $packageKey) {
63 $newPackageStatesConfiguration[$packageKey] = $packageStatesConfiguration[$packageKey];
67 $newPackageStatesConfiguration = array_merge($newPackageStatesConfiguration, $inactivePackageStatesConfiguration);
69 return $newPackageStatesConfiguration;
85 foreach ($packageKeys as $packageKey) {
86 if (!isset($packageStatesConfiguration[$packageKey][
'dependencies']) && !isset($packageStatesConfiguration[$packageKey][
'suggestions'])) {
89 $dependencies[$packageKey] = [
92 if (isset($packageStatesConfiguration[$packageKey][
'dependencies'])) {
93 foreach ($packageStatesConfiguration[$packageKey][
'dependencies'] as $dependentPackageKey) {
94 if (!in_array($dependentPackageKey, $packageKeys,
true)) {
95 throw new \UnexpectedValueException(
96 'The package "' . $packageKey .
'" depends on "'
97 . $dependentPackageKey .
'" which is not present in the system.',
100 $dependencies[$packageKey][
'after'][] = $dependentPackageKey;
103 if (isset($packageStatesConfiguration[$packageKey][
'suggestions'])) {
104 foreach ($packageStatesConfiguration[$packageKey][
'suggestions'] as $suggestedPackageKey) {
106 if (in_array($suggestedPackageKey, $packageKeys,
true)) {
113 $dependencies[$packageKey][
'after-resilient'][] = $suggestedPackageKey;
118 return $dependencies;
133 $frameworkPackageKeys = $this->findFrameworkPackages($packageStateConfiguration);
134 $extensionPackageKeys = array_diff(array_keys($packageStateConfiguration), $frameworkPackageKeys);
135 foreach ($extensionPackageKeys as $packageKey) {
137 $packageKeysWithoutFramework = array_diff(
138 $packageStateConfiguration[$packageKey][
'dependencies'],
139 $frameworkPackageKeys
143 $packageStateConfiguration[$packageKey][
'dependencies'] = array_merge(
144 $rootPackageKeys, $packageKeysWithoutFramework
147 return $packageStateConfiguration;
161 $frameworkPackageKeys = $this->findFrameworkPackages($packageStateConfiguration);
162 $frameworkPackagesDependencyGraph = $this->dependencyOrderingService->buildDependencyGraph($this->
convertConfigurationForGraph($packageStateConfiguration, $frameworkPackageKeys));
165 $packageKeys = array_keys($packageStateConfiguration);
166 return $this->dependencyOrderingService->buildDependencyGraph($this->
convertConfigurationForGraph($packageStateConfiguration, $packageKeys));
174 protected function findFrameworkPackages(array $packageStateConfiguration)
176 $frameworkPackageKeys = array();
179 foreach ($packageStateConfiguration as $packageKey => $packageConfiguration) {
181 $package = $packageManager->getPackage($packageKey);
182 if ($package->getValueFromComposerManifest(
'type') ===
'typo3-cms-framework') {
183 $frameworkPackageKeys[] = $packageKey;
187 return $frameworkPackageKeys;