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

Use cweagans/composer-configurable-plugin #164

Merged
merged 13 commits into from
Apr 13, 2018
Prev Previous commit
Next Next commit
Clean up isPatchingEnabled()
  • Loading branch information
cweagans committed Apr 13, 2018
commit f6b4455915d10af0bf4fa7a3160b4e5ae526345e
16 changes: 9 additions & 7 deletions src/Patches.php
Original file line number Diff line number Diff line change
@@ -487,15 +487,17 @@ protected function getAndApplyPatch(RemoteFilesystem $downloader, $install_path,
*/
protected function isPatchingEnabled()
{
$extra = $this->composer->getPackage()->getExtra();
$enabled = true;

if (empty($extra['patches']) && empty($extra['patches-ignore']) && !isset($extra['patches-file'])) {
// The root package has no patches of its own, so only allow patching if
// it has specifically opted in.
return isset($extra['enable-patching']) ? $extra['enable-patching'] : false;
} else {
return true;
$has_no_patches = empty($extra['patches']);
$has_no_patches_file = !isset($extra['patches_file']);
$patching_disabled = $this->getConfig('disable-patching');

if ($patching_disabled || ($has_no_patches && $has_no_patches_file)) {
$enabled = false;
}

return $enabled;
}

/**