Now that hook_file has been committed and files are "first class objects" I think we should add a module with some pages for listing and managing files. I'm starting this using some code that was initially developed as part of #25756: Enhanced file administration. I've been trying to rework the code to follow the node.module's admin pattern and get it fully updated to D7.

The basic features seem to be:

  • Page listing all the files on the system.
    • This should have filtering options so you can locate a particular file.
    • It should also all the admin to select operations to enact on selected files (this implies a hook_file_operations).
  • Individual file page to list the details of each file.
  • Disk usage by user page.

Most of this is working with the exception of the deletion operation. I'm not sure how the whole multi-step confirmation form should work.

The patch is to move the permission from system.module to file.module. The other files have been given a .txt file extension since I can't seem to generate a patch with a new directory in it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Junyor’s picture

@drewish: Thank you for taking over this feature request.

moshe weitzman’s picture

Lovely ... We really could use the #242962: Add tableselect form element here.

drewish’s picture

FileSize
48.22 KB
31.61 KB
27.11 KB

here's a couple of screen shots.

arthurf’s picture

Drewish- I'd like to integrate this with the sudo-proposed module here: http://groups.drupal.org/node/13898 I'm currently working on the spec and certainly don't want to duplicate effort, but do want to make it backwards compatible. Perhaps we can separate the file management API from the the GUI?

drewish’s picture

arthurf, this is really designed to be an admin management form rather than something user facing which is what i understand the other module to be focused on. i was just hoping to get some bare bones file management functionality into core as much to test the file api as anything.

arthurf’s picture

Gotcha, makes sense to me.

dopry’s picture

My ++good on this... It is a simple foundation and a new core module that will hopefully grow to provide additional functionality over time... A generic reading of the code looks good to me... I'll do some actual testing this evening.

.darrel.

webchick’s picture

This looks interesting! Subscribe.

I probably will not be able to review this thoroughly until next week.

drewish’s picture

just posted #329311: hook_file_references() should have flag to return links to usages which would make the file usage section much more interesting.

drewish’s picture

actually it just occurred to me that it'd make the deletion much more useful. on the delete confirmation form we could call file_usage() on each file and if any were in use we could prompt them to perform a hard/soft delete.

Status: Needs review » Needs work

The last submitted patch failed testing.

lilou’s picture

Status: Needs work » Needs review
drewish’s picture

Issue tags: +D7FileAPIWishlist
drewish’s picture

Rather than continually attaching files to this I've just put the file.module into my sandbox: http://cvs.drupal.org/viewvc.py/drupal/contributions/sandbox/drewish/file/

jrabeemer’s picture

subscribe

stewsnooze’s picture

Status: Needs review » Needs work

I am worried about deleting files. Particularly in instances where the Drupal site is run on more than one server.

When we delete from the database we pretty much know that the data is gone as all of the servers would share a database.

When we delete files here they, unless I'm missing something, would be deleted from only one server. We need to provide a way, perhaps a hook, perhaps something in the database that tracks what needs to be done.

Other systems have pending operations table that contain items to be processed. Perhaps in Drupal this could be a cron function for multi homed installs. There are many ways to handle this, one being that each server registers itself, perhaps with uname or something so that it can track what actions have occurred elsewhere that it needs to match.

Any thoughts?

drewish’s picture

in multisite installs the sites should NOT be sharing a files directory. if you do you're just begging for trouble. i'd say that goes for all versions of drupal.

drewish’s picture

Status: Needs work » Needs review
stewsnooze’s picture

I agree they shouldn't share a files directory. That's why the other servers need to know to delete a file.

moshe weitzman’s picture

i think stewsnooze is not talking about multi-site but rather a 'multiple web server' setup for a single drupal site. in this case, the files dir is almost always shared using NFS. So deletes are a non issue.

stewsnooze’s picture

@moshe do large sites really use nfs shares for the files directory? how does that perform?

stewsnooze’s picture

Spoke to Moshe on IM about this so I remove my concern...

webchick’s picture

Could you summarize here for the benefit of others who might have the same concern?

stewsnooze’s picture

Moshe was saying that most sites that use more than one physical server would use an nfs share for the files directory shared across the cluster. I can see how this would work. I don't think it would be fast but it would work.

I think a glamorous solution would be to make hooks available on disk operations as I believe the nfs thing is a single point of failure for your whole site.

These hooks could be used to contact the other servers in the cluster to get them to perform the actions.

I don't think those ideas need to cloud this issue.

drewish’s picture

well we've got hook_file_delete which fires when a manged file is deleted so you should have some flexibility but as you said that's not really in the scope of this issue.

Dries’s picture

Wordpress has a Media Library that went through some heavy usability testing lately. Have we looked at that? The usability reports should be available online.

drewish’s picture

here's the only link to wp usability testing that i could find: http://wordpress.org/development/2008/10/usability-testing-report-25-and...

drewish’s picture

I'm not sure how relevant that research is as at this point since they've just released 2.7 which sounds like a pretty big redesign of their admin areas. I guess the thing to do would be to install a copy of wp and do some experimentation.

I do want to make it clear that I view this feature as more of a management tool for a site admin rather than for an end user looking to upload or embed media.

dopry’s picture

This feature provides and administrative overview to files stored on the system. IT allows administrators to forcibly remove files, and get an overview of current file usage. It is meant to be an interface with the role as admin/content/node.

Status: Needs review » Needs work

The last submitted patch failed testing.

drewish’s picture

Status: Needs work » Needs review

I did some more work on this today and used the new tableselect element for the admin screen. I also stole some code from the comment module for doing the delete confirmation form and got that all working.

http://cvs.drupal.org/viewvc.py/drupal/contributions/sandbox/drewish/file/

webchick’s picture

Status: Needs review » Needs work

Initial pass:
- What?! No file.test?! FOR SHAME. ;) We should have some basic tests to ensure the interface is working.
- Most files are missing // $Id$ lines and /** @file */ blocks.
- file.module has one but it says * TODO: fill this out. There's also // TODO: provide some help. Basically, lots of TODOs here. :P It'd be nice to get those less TODO-y.
- I don't feel the permission description t('Manage user-uploaded files.') is descriptive enough to tell me what this is going to do. Maybe mention something about a files administrative interface?
- (minor) 'type' => MENU_CALLBACK needs a comma at the end.
- function file_admin_overview_form($form_state) { is missing PHPdoc.
- (critical) This admin panel does not respect private files access. To test, I enabled private file handling, File and Upload modules, created an unpublished article with a file attached, and a "file admin" role with "administer files" and "access administration pages" permissions. When I click on the file, I get access denied. When I go to admin/content/file, it is listed. This should not happen.

In IRC, you said that someone with 'administer files' perms should have access to see these since it's an admin panel, but a) if that is so, I should be able to see the file itself, and b) I'm not hot on coupling "access to admin panel" permissions with "bypass access restrictions" permissions. We split those in node module for good reason.

From file_admin_overview()...

 $edit = $_POST;

That doesn't seem safe. Can't you get that by passing in $form_state?

  if (empty($files)) {
    drupal_set_message(t('There do not appear to be any files to delete, or your selected file was deleted by another administrator.'));
    drupal_goto('admin/content/file');
  }

Should be $form_state['redirect'], not drupal_goto(), no?

UI review:
- This UI would benefit from some filters. This list is going to get LONG on most sites, and it would be nice to be able to filter it by name, size, what module it's associated with, or type. It would also be more consistent with node, comment, user, etc. admin pages.
- Why a separate page for disk usage? I can already sort the main table by size, and I can then delete really huge files while I'm at it.
- It would be cool to display images inline at the admin/content/file/X page.
- It would also be cool to display a little graphic next to them in the list to show what type of file they are at a glance.
- What does "Status: Permanent" mean? That sounds scary. Like I can't delete it.

I kind of stopped there, because I can tell this is not really ready for core committer review yet. In general, I'm in favour of the idea of this panel, though. But we need a bit more work to make it core-worthy.

murugan_mca’s picture

Version: 7.x-dev » 6.x-dev
Component: file system » install system
Priority: Normal » Critical

May i know what are the procedures are there for creating the new project.

Now i successfully installed the drupal with the help of install manual.

But i dont know how to create the project on drupal.

where i would to create . what are the methods are there for creating projects.

I want immediately the response

so make it fast and you can inform on clear manner with the help of picture to create the project.

thank you

Murugan.G
India
Tamilnadu
Chennai

jrabeemer’s picture

Version: 6.x-dev » 7.x-dev
Component: install system » file system
Priority: Critical » Normal

This is a bug issue, not a place for support. Please use the forums for general support.

Stefan Nagtegaal’s picture

Hmmm.... Most interesting...

jpetso’s picture

Ah, here's that issue. I was already wondering where drewish got the inspiration for #353458: hook_file_references() was not designed for a highly flexible field storage. Subscribe.

aaron’s picture

subscribe

scroogie’s picture

subscribing. I've been waiting for this. I think it really makes sense. If files are first class elements, they should get their own "interface" just as other elements. IMHO, there should even be a /file/$fid screen, just like with nodes.

eojthebrave’s picture

Subscribe.

Where is this at at the moment? drewish are you still working on it? Where can we jump in and help out?

drewish’s picture

It's stalled. I haven't had a chance to do anything with this in a while so if someone else wants to pickup the torch I'd really appreciate it.

mfb’s picture

Not sure what the chance is of including Views Bulk Operations in core, but it would offer some nice extensibility. I've been using VBO for file management in d6, although right now only a developer can do this as you have to write code for whatever actions you want to be able to perform, as well as a file object loader function.

drewish’s picture

mfb, yeah vbo is great... but that sort of necessitates getting views into core an that won't be happening in 7.

catch’s picture

Version: 7.x-dev » 8.x-dev

Moving to D8.

LarsKramer’s picture

Subscribing. I guess this feature could also include an option to delete module folders on the server? Or should I make a separate issue for that?
Currently after having uninstalled a module, there is no web UI option to also delete the files of that module. Such an option would also be useful in the case where you need to replace one module version with another (normally the dev version).

aaron’s picture

@LarsKramer: no, that would be another option, outside the realm of the file system; the default stream wrappers can't touch files in the modules directories (or anywhere outside of where public:// or private:// is set). maybe you should create a feature request for the update component.

LarsKramer’s picture

@aaron: Thanks for the clarification.

Added #1236364: Delete module after uninstall

BTW: Shouldn't "D7FileAPIWishlist" be changed to something else if this is now for D8?

aaron’s picture

good idea... :P

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

kim.pepper’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Closing as outdated. Please re-open if this is still relevant.