Skip to content

Commit

Permalink
Added ignores to install options for `Installer::sophisticatedInsta…
Browse files Browse the repository at this point in the history
…ll()` #1447
  • Loading branch information
rhukster committed Apr 24, 2017
1 parent 34281a1 commit e5a522a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
9 changes: 5 additions & 4 deletions system/src/Grav/Common/GPM/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Installer
'sophisticated' => false,
'theme' => false,
'install_path' => '',
'ignores' => [],
'exclude_checks' => [self::EXISTS, self::NOT_FOUND, self::IS_LINK]
];

Expand Down Expand Up @@ -134,7 +135,7 @@ public static function install($zip, $destination, $options = [], $extracted = n
self::moveInstall($extracted, $install_path);
}
} else {
self::sophisticatedInstall($extracted, $install_path);
self::sophisticatedInstall($extracted, $install_path, $options['ignores']);
}

Folder::delete($tmp);
Expand Down Expand Up @@ -280,11 +281,11 @@ public static function copyInstall($source_path, $install_path)
*
* @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;
}

Expand All @@ -296,7 +297,7 @@ public static function sophisticatedInstall($source_path, $install_path)

if ($file->getBasename() == 'bin') {
foreach (glob($path . DS . '*') as $bin_file) {
@chmod($bin_file, 0755);
@chmod($bin_file, 0755);
}
}
} else {
Expand Down

0 comments on commit e5a522a

Please sign in to comment.