Setting WebFM too to the file system root

gragus - May 27, 2008 - 17:50
Project:Web File Manager
Version:6.x-2.11
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:by design
Description

Hi, stupid question:

I'd like to the the root for WebFM to the dir that is specified under admin/settings/file-system, NOT a subdir of that.
But the WebFM root directory field at admin/settings/webfm won't take a dot or a blank line.

How can I get WebFM to access all of my files?

Thanks!

#1

robmilne - May 29, 2008 - 01:36
Status:active» by design

Sorry - can't be done since file security is linked to roles. Each role must have a distinct root directory under the webfm root. Only way to do what you're asking for is to give all webfm roles with webfm access 'administer-webfm' permissions.

#2

gragus - May 29, 2008 - 19:48

That would be ok, only one user is supposed to use WebFM on this site anyway.
But the global WebFM configuration wants that all WebFM content is rooted in a subfolder of the file-system root, not in the root itself. I planned to use WebFM manly just as a file manager for all media content. Should I look into a different plugin?

Thanks!))

#3

Murz - July 9, 2008 - 12:10
Component:User interface» Code
Priority:critical» normal
Status:by design» active

I need this functionality too. And can't find any other modules that can do this.
For example, I have a hosting with bad ftp access (I can't change content and delete of files in root folder, but I can rename/add/delete this files from php (as apache user).

At now I need to change robots.txt file and can't do this with any exists Drupal module.

Maybe do this feature as patch (hack), not as module functional?

#4

K.J. - July 23, 2008 - 13:26

Actually, you don't "need" this technology. It's easily subverted. In Windows, create an NTFS Junction point (free tools available) in the files folder to point to the actual location of the share or in Linux, simply create the mount point/symbolic link in that directory.

The only limitation is that you can't create NTFS junction point across network shares, it's also a security risk if you allow writable directories to anonymous users if you allow junction points (they can create one to anywhere and get write access to it). But that shouldn't be a problem with this module because none of the directories need to be writable to anyone but the server.

#5

nirvanajyothi - August 16, 2008 - 14:04

I would love to have this too!

Basically....i give authenticated users permission to upload pdfs and flash as attachments to content types 'document' and flash respectively.As of now all the files are in one folder under default/files....so as the no of files increases its becoming too messed up.

Would like to reorganize these files(or files uploaded in future,atleast) into different folders based on their type and category manually.

So only i would need to have access to webfm.

But can files already attached to nodes be moved into a different folder using webfm ..and will it affect the node when it doesnt find the file in old location?

#6

HansBKK - October 5, 2008 - 09:03

Would be great if someone could address these questions.

It seems to me in my additional playing around, that the point of WebFM is to allow for management of files/documents uploaded and "owned" by WebFM, NOT those uploaded/owned by other file-related modules like Image, Imagefield, Upload, Asset et al.

There doesn't seem to be any way to easily manage files owned by different modules, and each has their own destination path logic, mostly IMO following the core Drupal philosophy of "just dump them all in one place and forget about it".

Apparently there are major problems with allowing more than one node to reference a given file if you want the file to be deleted along with the node - they may be able to get back-referencing into D7 and then it becomes possible.

For my use-case, the only reason to use WebFM would be for files I'm intending for visitors to see and download as files, and for that use it seems to be a good fit, with proper file management and security features.

It doesn't help solve the overall file management problems inherent in Drupal - that will have to wait for future enhancements to core.

Note I'm just a newbie who's been researching these issues so I could be completely wrong - it would be great if someone who actually knows what they're talking about could give feedback to the above rank speculation.

#7

robmilne - December 2, 2008 - 16:15
Status:active» by design

It doesn't help solve the overall file management problems inherent in Drupal - that will have to wait for future enhancements to core.

Quite so. This module has never received an official sanction from any core developer and thus it would be folly to allow it to mess with the files managed by core modules or other contrib modules. I've set this back to "by design".

#8

robmilne - October 18, 2008 - 03:15

In addition:
If a contrib module like WebFM was allowed to affect file root we could never trust that our own data was uncorrupted. I encountered this during the development phase when I was using ssh to access test servers running WebFM. I could easily delete a file without the db's knowledge. The need to clean up the disparity between db and physical storage was the reason for creating the WebFM cron feature for #1 user.

#9

kkkk - November 27, 2008 - 08:53

Roles can share the same root directory - I have setup all roles to have the same sub directory to files/webfm/downloads and they all have access. Could this be the solution?

#10

robmilne - December 2, 2008 - 16:21

Roles have always been able to share root directories. Roles can also have multiple root directories. The constraint I referred to above is that the root directory cannot be the same as the path set in .../admin/settings/file-system. I will not allow this module to monkey with the Drupal flat filesystem.

#11

tavin.cole - February 5, 2009 - 22:20

It'd be great if the visual, hierarchical file management features could be abstracted and used to manage the files in the root of Drupal's "flat" filesystem.

I've manually put hierarchical paths into the filepath column of the files table, and linked more than one vid to the same fid in the upload table, and it seems to work.

I'm just looking for a GUI-driven way to manage this within Drupal.

#12

vacilando - November 6, 2009 - 09:19
Version:5.x-2.13» 6.x-2.11

I have been looking everywhere or a solution, even a hack, that would enable WebFM to access the the whole files folder as set in Drupal.

Despite all the explanations against, I do not see why this cannot be allowed for admins. Surely, many if not most modules allow admins do things that can ruin Drupal installations; it's their responsibility to use the powerful tools wisely. (Indeed, any of the modules that offer to run PHP code, can -- if misused -- allow a Drupal website be damaged beyond recognition.)

There are so many people requesting this, in many posts in the issue queue here, and in other fora!

I've decided to comment on this particular one because initially I thought it was my solution: in #1 it says that this can be achieved by setting the 'administer-webfm' permission. Sadly, this is not so. Even though I am logged as an admin, and even when setting such that permission for role called 'webmaster' I created, I cannot access the files folder.

Besides my above point about not needing to protect us against ourselves, there is another strong point. The existing system, and argumentation against access to the files folder, assumes that all WebFM users are just starting up new sites. This is not so. Many of us have had sites in D4 through D5 and D6, and our files folders contain a myriad of resources - images, PDFs, etc. We cannot start moving all content into a particular folder if we want to start using WebFM; the file manager, if the admin uses it, really ought to be able to access any of the existing files and folders.

Could you please comment esp. on this latest point.

Hoping for some kind of a solution here... and I am sure I am not alone.

Thank you.

#13

drein - November 13, 2009 - 14:08

Ok... Today I downloaded the module for the first time. d6 version.
I see that it doesn't allow access to the root filesystem.
So I hacked the module... I'm sorry but I'm not a programmer, so the solution is stupid but it works.
I'm going to explain how to obtain access to the root of filesystem but I decline any responsability and I hope authors of the module will not be angry for this.
So...
Go to your modules/webfm folder.
Open webfm.admin.inc, not with notepad, use at least wordpad or something serious if you use windows.
search for the string "preg_match".
You should see:
if(!preg_match('/^[0-9a-zA-Z]/', $webfm_root_dir_name)) {

delete the two lines below, that says you should use only alphanumeric characters.

and replace with:
$webfm_root_dir = file_directory_path()."/".$webfm_root_dir_name;
$valid_webfm_root = file_check_directory($webfm_root_dir, FILE_CREATE_DIRECTORY, 'webfm_root_dir');

In a few words, what you must obtain is:
if(!preg_match('/^[0-9a-zA-Z]/', $webfm_root_dir_name)) {
$webfm_root_dir = file_directory_path()."/".$webfm_root_dir_name;
$valid_webfm_root = file_check_directory($webfm_root_dir, FILE_CREATE_DIRECTORY, 'webfm_root_dir');
} else if(preg_match('[\.]', $webfm_root_dir_name)) {
........

I can say this is the most stupid solution, but I need access to the root.
hope this helps.

I repeat, this is not to go against the authors opinion. The fact is that I have 700 files in the root and I must re-organize it and I think webfm is the best for this.
Bye.

#14

sdsheridan - December 4, 2009 - 18:58

I think there's a better way to do what you're suggesting, which is make the following changes (note the comments):

<?php
 
if(!empty($webfm_root_dir_name)) {
    if(!
preg_match('/^[.0-9a-zA-Z]/', $webfm_root_dir_name)) { // put a period in the regex to let it through
     
form_set_error('webfm_root_dir'. $rid, t('The leading character of the webfm root directory name must be alphanumeric.'));
    }
    else if(
preg_match('[\.]', $webfm_root_dir_name) && $webfm_root_dir_name != '.' ) { // check if it is a single period
    
form_set_error('webfm_root_dir'. $rid, t('The webfm root directory name is not valid.'));
    }
    else {
     
$webfm_root_dir = file_directory_path()."/".$webfm_root_dir_name;
     
$valid_webfm_root = file_check_directory($webfm_root_dir, FILE_CREATE_DIRECTORY, 'webfm_root_dir');
    }
  }
?>

This way, putting a period in the field will give you the root of the files directory. Works for me. :-)

 
 

Drupal is a registered trademark of Dries Buytaert.