The LESS module sets the path for processed CSS to file_default_scheme() . '://less'. If the file_default_scheme() is 'private', then generated files will be unavailable to the anonymous user, and site formatting will be broken.
The attached patch:
- Adds a
less_pathvariable for storing the directory path for processed CSS files. - Adds the
less_pathsetting to theless_settingsform. - Changes both instances of
$less_path = file_default_scheme() . '://less';to
$less_path = variable_get('less_path', 'public://less'); - Adds a
less.installfile containing:- A
hook_requirements()implementation to check writability of the less_path setting. - A
hook_uninstall()implementation to delete module settings variables when the module is uninstalled.
- A
- Incorporates overlapping changes from #1241184: Check for directory existence before calling file_unmanaged_delete_recursive().
Comments
Comment #1
pillarsdotnet commentedPatch.
Comment #2
pillarsdotnet commentedBetter patch moves existing
less_requirements()function fromless.moduletoless.installwhere it belongs.Comment #3
pillarsdotnet commentedFixed typos.
Comment #4
psynaptic commentedMissing @file directive above the description.
The description should be on the following line.
Looks like this line should be removed.
Comment #5
pillarsdotnet commentedCorrected patch.
Comment #6
pillarsdotnet commentedBetter title.
Comment #7
imp7 commentedconfirmed patch works, great work psynaptic
Comment #8
corey.aufang commentedI've changed the path to be public://less, but I think its a bad idea to allow the user to choose the folder location.
That would allow the user to change something that is vital to functionality of the project that could cause problems and also open a security hole.
Granted they would already have to have high permissions to use it, but its better to avoid it completely.
If you can convince me that the administrator should be able to configure the folder for the compiled css, I'll add it back in.
I'm also splitting off the moving of hook_requirements into #1421044: move hook_requirements to .install.
Comment #9
rooby commentedIn my case, less wasn't working at all in the private file system.
With this patch everything is AOK.
I think corey.aufang has a point in #8, I can't see any reason why I would want to have anything other than public:// on any of my sites.
Comment #10
corey.aufang commentedThis should be resolved in 7.x-2.5.