Thanks for the module! Here is a patch the removes the need to patch file.inc.

Comments

grendzy’s picture

Status: Active » Needs review
grendzy’s picture

whoops. Sorry for the multiple posts. Anyway, what this does is create an alternative menu item. So instead of /system/files/sample.jpg, you have /xsend/sample.jpg. Then you add the following .htaccess rule to let the new path take over:
RewriteRule ^system/files/(.*) index.php?q=xsend/$1

hypertext200’s picture

Assigned: Unassigned » hypertext200

Thanks for the patch I will test it and add to the module

grendzy’s picture

StatusFileSize
new5.3 KB

heshanmw, thanks! I also realized the rewrite rule isn't needed either; instead hook_menu_alter can change the callback for system/files.

Here's an updated patch:

grendzy’s picture

Title: avoid patching core via alternative URL and RewriteRule » avoid patching core via hook_menu_alter
hypertext200’s picture

Status: Needs review » Patch (to be ported)
hypertext200’s picture

Status: Patch (to be ported) » Closed (fixed)
hypertext200’s picture

Fixed in latest version.

gribnif’s picture

Status: Closed (fixed) » Needs work

One advantage of the original patch (which, IMHO, should be included in core!) is that modules which call the file_transfer() function directly will benefit from it. The method adopted by this issue removes the patch, thereby degrading performance for code that calls the function directly.

grendzy’s picture

Status: Needs work » Closed (fixed)

I can see your point (other modules do use this function, e.g. imagecache, alfresco). Still patching core is rarely a good solution. Why not work with the module maintainers to provide integration with xsend?

Or if you like applying patches you could always patch the modules. :-)