The module-created directories (mail_archive and its children) have permissions 740 (and a different owner?) in a managed web-hosting environment. That means that 1) the mails cannot be saved to them (no execute permission) and I cannot change the permissions as I didn't create the folders.

Comments

javanaut’s picture

The folder was probably created by the webserver user.
This won't fix the bug, but you can upload code invoking the chmod function as the webserver user on the directory in question as a workaround.

chmod("/somedir/somefile", 0775);
jeremy’s picture

Looking over all files created by Drupal, they seem to have the same ownership and privilege information. ie, this is not unique to the mail_archive module. Perhaps this "bug" should be against Drupal core?

robertdouglass’s picture

Yes, you are right. The solution would be to enforce use of the file.inc API which already provides this functionality. Where are the examples you found?

From file.inc::file_check_directory

 // Check to see if the directory is writable.
  if (!is_writable($directory)) {
    if (($mode & FILE_MODIFY_PERMISSIONS) && @chmod($directory, 0760)) {
      drupal_set_message(t('Modified permissions on directory %directory.', array('%directory' => "<em>$directory</em>")));
    }
    else {
      form_set_error($form_item, t('The directory %directory is not writable.', array('%directory' => "<em>$directory</em>")));
      return false;
    }
  }
robertdouglass’s picture

I tracked the mail_archive code and it is already using the file.inc correctly, so my issue is misplaced. It is very bizarre, though. File inc creates and chmods dirs using 0760 but the result on my server is 0744.

jeremy’s picture

I'm closing this issue, as it's not related to the mail archive. I suggest opening an issue in the proper place (or move this one and reopen it).

Anonymous’s picture