DNDataArchive::fixArchivePermissions PHP Method

fixArchivePermissions() public method

Normally, command line tar will use permissions found in the archive, but will substract the user's umask from them. This has a potential to create unreadable files, e.g. cygwin on Windows will pack files with mode 000, hence why this fix is necessary.
public fixArchivePermissions ( string | null $workingDir ) : boolean
$workingDir string | null The path of where the sspak has been extracted to
return boolean
    public function fixArchivePermissions($workingDir)
    {
        $fixCmds = array(sprintf('find %s -type d -exec chmod 755 {} \\;', escapeshellarg($workingDir)), sprintf('find %s -type f -exec chmod 644 {} +', escapeshellarg($workingDir)));
        foreach ($fixCmds as $cmd) {
            $process = new AbortableProcess($cmd);
            $process->setTimeout(3600);
            $process->run();
            if (!$process->isSuccessful()) {
                throw new RuntimeException($process->getErrorOutput());
            }
        }
        return true;
    }