Download & Extend

Files directory check doesn't disable uploads if check fails, in admin/user/settings

Project:Drupal core
Version:5.1
Component:user system
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

To reproduce:
1. Enable user picture uploads in admin/user/settings
2. Via console, disable write access to the files/ directory
3. Try to change user registrations to "only admins can create accounts". You'll get an error, because the picture uploads directory is invalid.
3a. Try disabling picture uploads and trying again. Same problem.

Expected behavior: if the upload directory is invalid, picture uploads should be disabled so that other changes can be made to the user settings.

Resultant behavior: there is no way to change user settings, because disabling uploads does not work, and there is no value for the upload directory that will not give an error.

Possible workaround: set /tmp as the upload dir, then make the changes and disable picture uploads.

Fix (see patch):

user.module, starting at line 2303:

  if (variable_get('user_pictures', 0)) {
    $picture_path = file_create_path(variable_get('user_picture_path', 'pictures'));
    file_check_directory($picture_path, 1, 'user_picture_path');
  }

Should be:

  if (variable_get('user_pictures', 0)) {
    $picture_path = file_create_path(variable_get('user_picture_path', 'pictures'));
    if (file_check_directory($picture_path, 1, 'user_picture_path')) {
       variable_set('user_picture_path', 0);
    }
  }
AttachmentSizeStatusTest resultOperations
user_picture_path_check.patch204 bytesIgnored: Check issue status.NoneNone

Comments

#1

Status:active» closed (duplicate)

Marking as a duplicate to be merged into #305802: Improve default user picture interface.

nobody click here