moodle-plugin-ci
moodle-plugin-ci copied to clipboard
Grunt job is not ignoring hidden directories
The grunt job is not ignoring hidden directories. The job copies the complete directory of a plugin to a temporary space, does an excellent job and mirrors is back. If you have for example a .git folder with special directory permissions, the restore fails with a permission denied error.
Failed to copy "/tmp/moodle-plugin-ci-grunt-backup-1711963880/.git/objects/57/..." to ".../.git/objects/57/..." because target file could not be opened for writing: fopen(../.git/objects/57/...): Failed to open stream: Permission denied
Therefore I changed the restorePlugin method
$flags = \FilesystemIterator::SKIP_DOTS;
$iterator = new \RecursiveDirectoryIterator($this->backupDir, $flags);
(new Filesystem())->mirror($this->backupDir, $this->plugin->directory, $iterator, ['delete' => true, 'override' => true]);