Download & Extend

File system administration should not create files directory

Project:Drupal core
Version:6.x-dev
Component:file system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

I've a multisite config and I decided to hardcode (i.e variable override) in settings.php the file_directory_path for each domain:

$conf = array (
'file_directory_path' => 'sites/rizoma.org/files',
);

..to avoid site-admins to change it. But It can be changed and after submission:

* The directory sites/rizoma.org/files2 has been created.
* The configuration options have been saved.

although the value returns back to the settings.php defined. So the bug is not checking this field is hardcoded prior to make the directory.

I've been looking the code with no success. I think it's a drupal design issue that the directory must be created before the config is saved (and in this point it's checked the value can't be changed because it's hardcoded in setttings.php).

So instead of going deep inside flow control, I think the solution is to advert in the form that this value is hardcoded and can't be changed (i.e. a readonly field or like). This also will avoid headaches to admin's that don't know nor control settings.php.

Comments

#1

Version:4.7.0-rc2» 4.7.0

I think the solution is to advert in the form that this value is hardcoded and can't be changed (i.e. a readonly field or like). This also will avoid headaches to admin's that don't know nor control settings.php.

+1 for disabling the files field on admin -> settings when $conf is set (this can be done easily with Forms API)

Drupal creating the folder specified on this page regardless of $conf is a bug still present in 4.7.0, as far as I can see.

#2

Version:4.7.0» x.y.z

Confirmed. The ?q=admin/settings/file-system should be disabled saying that it is already configured through the settings.php file.

This is a bug because it creates the directory, and it should not do that at least.

#3

Title:settings.php variable overrides & admin settings» File system administration creates directory despite the settings.php configuration
Component:system.module» file system

#4

Title:File system administration creates directory despite the settings.php configuration » File system administration should not create files directory

(I must practice my english)

#5

Version:x.y.z» 4.7.x-dev

(Moving x.y.z version to a real version number)

I don't know if this is bug should be in this branch or the 5.x-dev branch.

#6

Any updates on this? Does it affect 5.x, too?

#7

Version:4.7.x-dev» 6.x-dev

I just confirmed this bug in HEAD.
Problem is, as far as I know is that there is no easy way to know if the setting has been hard coded, so you don't know if the field should be disabled or not.
Please correct me if I'm wrong.

A simple (and dirty?) workaround is to set
define('FILE_CREATE_DIRECTORY', 0);
in your settings.php file.

#8

Status:active» needs review

Let's try this.. might lead to false positives but not likely.

AttachmentSizeStatusTest resultOperations
file_57979-8.patch1.62 KBIgnored: Check issue status.NoneNone

#9

chx's patch would probably do the job but i think it's a bad precedent to set. unless we're going to do that for all the admin settings i don't think it's good to do it for just one.

#10

Status:needs review» postponed (maintainer needs more info)

Is this still a problem in current D6?

#11

Status:postponed (maintainer needs more info)» needs work

We want your patch if it is still needed. Please resubmit it with a proper filename.

http://drupal.org/node/1054616
[description]-[issue-number]-[comment-number].patch