protected function setFilePermissions($destinationFilename, $referenceFilename)
  {
    clearstatcache();
    $perms = fileperms($referenceFilename);
    if ($perms===false) $this->logError("Unable to get permissions of file '%s'", $referenceFilename);

    $status = chmod($destinationFilename, $perms);
    if ($status===false) $this->logError("Unable to set permissions for file '%s'", $destinationFilename);
  }