Skip to content

Grunt job is not ignoring hidden directories #297

Open
@ewallah

Description

@ewallah

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]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions