diff --git a/CHANGELOG.md b/CHANGELOG.md index 47439d9c6..b89d314d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # v1.2.4 ## 04/xx/2017 +1. [](#improved) + * Added optional ignores for `Installer::sophisticatedInstall()` [#1447](https://github.com/getgrav/grav/issues/1447) 1. [](#bugfix) * Allow multiple calls to `Themes::initTheme()` without throwing errors * Fixed querystrings in root pages with multi-lang enabled [#1436](https://github.com/getgrav/grav/issues/1436) diff --git a/system/src/Grav/Common/GPM/Installer.php b/system/src/Grav/Common/GPM/Installer.php index 0e6352147..1f8a2626e 100644 --- a/system/src/Grav/Common/GPM/Installer.php +++ b/system/src/Grav/Common/GPM/Installer.php @@ -58,6 +58,7 @@ class Installer 'sophisticated' => false, 'theme' => false, 'install_path' => '', + 'ignores' => [], 'exclude_checks' => [self::EXISTS, self::NOT_FOUND, self::IS_LINK] ]; @@ -134,7 +135,7 @@ class Installer self::moveInstall($extracted, $install_path); } } else { - self::sophisticatedInstall($extracted, $install_path); + self::sophisticatedInstall($extracted, $install_path, $options['ignores']); } Folder::delete($tmp); @@ -280,11 +281,11 @@ class Installer * * @return bool */ - public static function sophisticatedInstall($source_path, $install_path) + public static function sophisticatedInstall($source_path, $install_path, $ignores = []) { foreach (new \DirectoryIterator($source_path) as $file) { - if ($file->isLink() || $file->isDot()) { + if ($file->isLink() || $file->isDot() || in_array($file->getBasename(),$ignores)) { continue; } @@ -296,7 +297,7 @@ class Installer if ($file->getBasename() == 'bin') { foreach (glob($path . DS . '*') as $bin_file) { - @chmod($bin_file, 0755); + @chmod($bin_file, 0755); } } } else {