[drupal-devel] [task] Enhanced upload administration

Junyor drupal-devel at drupal.org
Mon Jul 25 14:39:26 UTC 2005

Issue status update for 
Post a follow up: 

 Project:      Drupal
 Version:      cvs
 Component:    upload.module
 Category:     tasks
 Priority:     normal
 Assigned to:  Junyor
 Reported by:  Junyor
 Updated by:   Junyor
 Status:       patch
 Attachment:   http://drupal.org/files/issues/drupal-4-6.junyor.upload3.patch (15.62 KB)

New patch.

Changes since last patch:
* Added basic statistical information to /admin/upload and /upload
* Fixed problem getting correct username on /admin/upload


Previous comments:

Sat, 25 Jun 2005 22:43:40 +0000 : Junyor

Attachment: http://drupal.org/files/issues/drupal-4-6.upload.junyor.patch (4.84 KB)

I've found the need to have some administration for file attachments. 
Here's a demo patch of some of the proposed added functionality.  This
functionality should easily allow users to get a list of the files
they've uploaded, so they can get rid of old files if they reach their
size limit.

- Added an 'administer uploaded files' permission
- Added admin/uploads and 'my uploads', which list uploaded files

Planned changes:
- statistics for the 'my uploads' and admin/uploads pages with total
size of uploaded files and size limit
- functionality to delete/rename files (using checkboxes to select
multiple files)

Please comment on code quality, current functionality, and planned
functionality.  Thanks.

Patch applies to 4.6 and HEAD.


Sat, 25 Jun 2005 23:57:07 +0000 : clydefrog

Sounds like a good idea from your description. I haven't tested, but a
quick glance at the patch shows an odd comment:

+ * Menu callback:
+ * Pages where users add and delete their subscriptions to nodes
+ */


Sun, 26 Jun 2005 08:52:50 +0000 : Junyor

Oops.  That's what I get for copying code.  I'll fix that in the next


Tue, 19 Jul 2005 04:12:14 +0000 : moshe weitzman

Looks useful to me. If I had more uploads on my dev site I would try it

Some code comments:

- don't reuse upload_page() for both user and admin page. split off
admin stuff into a new menu callback which points to a new
upload_admin_page() function.
- in the query for admin page, don't directly use the UID when building
the $sql. instead, pass that as an argument at end of pager_query().
this protects against SQL injection attack
- do we really want to show file locations to regular users? i think
- perhaps show node title in the file listing tables 

your proposed enhancements look swell to me.

related question: do attachments on unpublished nodes acount against
user quota? if so, user is powerless to delete them? this module could
fix that I think. when unpublished, i suggest showing node title
without hyperlink.


Tue, 19 Jul 2005 05:21:09 +0000 : Junyor

Thanks for the feedback, Moshe!  I haven't worked on this in a couple of
weeks, but I'll try to get back to it soon and I'll add in your
feedback.  Moving back to active so it doesn't clog up the patch queue
any longer.


Thu, 21 Jul 2005 11:43:16 +0000 : Junyor

Moshe: When you said the following:

- do we really want to show file locations to regular users? i think
- perhaps show node title in the file listing tables

what did you mean?  The "Location" column is the node title where the
file is attached.  What file location is being shown to users?


Thu, 21 Jul 2005 13:32:06 +0000 : moshe weitzman

yeah, i think we are ok on file location .... you might consider
releasing this as a contrib module if core is uninterested.


Sun, 24 Jul 2005 21:26:39 +0000 : Junyor

Attachment: http://drupal.org/files/issues/drupal-4-6.junyor.upload2.patch (11.09 KB)

Here's a new update.  Still not ready for commit, but much further
along.  Developed against 4.6, but patch applies to CVS with some fuzz.
 Uploading files didn't seem to work for me in CVS, so I couldn't test
whether the patch worked.

When the time comes, I hope this will be considered for core, as it
seems like missing functionality to upload.module now.

Changes since last patch:
* Split upload_page into upload_page and upload_admin
* Added 'delete all selected files' operation on admin/upload and
upload pages
* Fixed upload_admin query to avoid SQL code injection (thanks, Moshe)
* Renamed "Location" column to "Title"
* Don't show unpublished nodes as links in the "Title" column
* Fixed bugs so that you can actually delete files now ;)

To Do:
* statistics for the 'my uploads' and admin/uploads pages with total
size of uploaded files and size limit
* figure out why status messages remain across page loads
* get Operations column working

* What operations should go in the Operations column, anyway?
* What other operations should be added to the mass-operations

More information about the drupal-devel mailing list