Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be less strict for PackageStates.php generation #128

Merged
merged 1 commit into from
Apr 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions Classes/Command/InstallCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function generatePackageStatesCommand($removeInactivePackages = FALSE) {
$installationPackages = $this->getPackagesFromRootComposerFile();
foreach ($this->packageManager->getAvailablePackages() as $package) {
if (
in_array($package->getPackageKey(), $installationPackages)
in_array($package->getPackageKey(), $installationPackages, TRUE)
|| $package->isProtected()
|| ($package instanceof Package && $package->isPartOfMinimalUsableSystem())
) {
Expand All @@ -106,24 +106,24 @@ public function generatePackageStatesCommand($removeInactivePackages = FALSE) {
*/
protected function getPackagesFromRootComposerFile() {
if (!file_exists(PATH_site . 'composer.json')) {
$this->outputLine('No composer.json found in project root');
$this->sendAndExit(1);
$this->outputLine('No composer.json found in project root. Only activating required extensions!');
return array();
}

$composerData = json_decode(file_get_contents(PATH_site . 'composer.json'));
$composerData = @json_decode(file_get_contents(PATH_site . 'composer.json'), TRUE);

if (!is_object($composerData)) {
$this->outputLine('composer.json seems to be invalid');
if (!is_array($composerData)) {
$this->outputLine('composer.json is invalid!');
$this->sendAndExit(1);
}

$activePackageKey = 'active-packages';
if (!isset($composerData->extra->{$activePackageKey}) || !is_array($composerData->extra->{$activePackageKey})) {
$this->outputLine('No packages found to activate!');
$this->sendAndExit();
if (!isset($composerData['extra'][$activePackageKey]) || !is_array($composerData['extra'][$activePackageKey])) {
$this->outputLine('No packages found to activate. Only activating required extensions!');
return array();
}

return $composerData->extra->{$activePackageKey};
return $composerData['extra'][$activePackageKey];
}

/**
Expand Down