diff --git a/src/Console/Deployer.php b/src/Console/Deployer.php index 0dd7b77fc..7437a9bd5 100644 --- a/src/Console/Deployer.php +++ b/src/Console/Deployer.php @@ -164,15 +164,7 @@ private function generateArchive(SymfonyStyle $io, ProgressBar $progress) : void $projectConfig['php']['extensions'] ?? [] ); // Remove unused extensions - foreach (glob('.bref/output/.bref/bin/ext/*.so') as $extensionFile) { - if ($extensionFile === '.bref/output/.bref/bin/ext/opcache.so') { - continue; - } - $extensionName = substr($extensionFile, strrpos($extensionFile, '/') + 1, -3); - if (!array_key_exists($extensionName, $phpConfig)) { - $this->fs->remove($extensionFile); - } - } + $this->removeUnusedExtensions($phpConfig); $progress->advance(); $progress->setMessage('Installing Bref files for NodeJS'); @@ -282,4 +274,16 @@ private function buildPhpConfig(string $sourceFile, string $targetFile, array $f return $config; } + + private function removeUnusedExtensions(array $phpConfig) + { + foreach (glob('.bref/output/.bref/bin/ext/*.so') as $extensionFile) { + if ($extensionFile === '.bref/output/.bref/bin/ext/opcache.so') { + continue; + } + if (!array_key_exists(basename($extensionFile, '.so'), $phpConfig)) { + $this->fs->remove($extensionFile); + } + } + } }