Drain Hole Plugin

download

Download: Drain Hole
Version: 2.2.8
Supports: WordPress 2.5-2.9
Other: This plugin is no longer actively maintained

Drain Hole is a centralized download manager, with full monitoring and statistics, versioning, SVN support, and SEO download URLs (no more nasty query strings!).

In addition to it’s monitoring abilities, Drain Hole has a run-time tag replacement feature that lets you embed special tags in your post which are replaced with information from Drain Hole. For example, you can embed download URLs, version information, last update times, and so on. Whenever you change a downloadable file it is automatically updated throughout your blog, without you needing to change anything else.

Features include:

  • SEO download URLs – a unique feature that allows files to look like real links
  • Local or remote file storage – keep your files on your own server or have them stored somewhere else such as Amazon S3 or wordpress.org
  • SVN support – attach a file directly to an SVN repository and have the contents automatically updated
  • Versioning – maintain multiple versions of a file, allowing users to download older files
  • Full download statistics, including number of downloads, access times, referrer, and download speed, available as CSV and Flash-based graphs
  • Download security – permissions can be assigned to downloads (including Flash files), restricting them to WordPress roles
  • Template tags – insert dynamic download data into posts, and into the sidebar as a Widget
  • Hot-link protection
  • Fully localized

Installation

Installation is like any WordPress plugin:

  • Download Drain Hole
  • Unzip
  • Upload drain-hole directory to /wp-content/plugins on your server
  • Activate the plugin
  • Use Drain Hole from the Manage/Drain Hole menu

You can find full details of installing a plugin on the plugin installation page. SVN access to the plugin is provided at the SVN repository.

General Concepts

The Drain Hole plugin makes use of two fundamental concepts:

  • Drain hole – a base URL and associated directory where files are stored and downloaded from
  • Files – a file belongs to a particular Drain hole

It is important to understand the mapping between a Drain Hole’s URL and its associated directory. To do this you need to know two pieces of information:

  1. Where files are to be downloaded from (i.e. http://urbangiraffe.com/download/)
  2. Where files are to be stored (i.e /users/john/download/)

This is a mapping from URL to directory:

http://urbangiraffe.com/download/ => /users/john/download/

All files inside the directory will be available at the Drain Hole URL. For example:

/users/john/download/myplugin.zip => http://urbangiraffe.com/download/myplugin.zip

It is preferable that your directory is not in a public location (i.e. in public_html) as Drain Hole may not then be able to function. Your URL must be part of your WordPress installation, but you should not create a directory for it.

Creating a Drain Hole

New Drain Holes require the following information:

New Drain Hole

The URL is the URL on your website at which to make the files available. The directory is the real directory in which the files exist. These two values do not have to match up and the files do not (and ideally should not) be publicly available.

Once a Drain Hole has been created you can then edit it from the list of Drain Holes:

Drain Holes

Editing a Drain Hole will allow you to set additional options:

Edit Hole

The Access Level is the minimum user level required to download files from the hole. This allows you to restrict download access to certain types of user. If a user does not meet the required access level then they will be returned a 404 error page or will be redirected to the configured URL.

The Stop Hot-links option allows you to stop external users from downloading files in the hole. This protection is achieved by analyzing the referring page for a given download – if the referrer is not from your site then the user is sent a 404 error page or redirect to the error URL.

Files

A Drain Hole can contain any number of files and sub-directories.

Files

As with the rest of the plugin, columns are sortable, and data can be searched.

Each file allows you to:

  • Edit the file configuration
  • Manage version history (by clicking on the version number)
  • View download statistics (by clicking on the number of hits or the charts link)
  • Create a new version or update from SVN (by clicking on the branch link)

When editing a file you will be shown additional configuration details:

Edit File

The filename is the actual name of the file and this may differ from the name, which is what will be shown in a download link. If no name is given then the filename will be used. As an extra function, you can insert $version$ into the name and it will be replaced with the file’s current version.

The description is a free-form field allowing you to enter further details about the download. This can be shown when the file is displayed.

The SVN field allows you to enter an SVN repository. See the SVN section later.

When displaying a file to download, an icon can be shown. You can change which icon is shown when editing a file.

The MIME type allows you to specify a custom MIME type for the file. This may be useful if you want a file to open inside the browser. If set to ‘automatic’ then Drain Hole will try and decide what the file is.

Forcing a download allows you to override default browser behaviour and force the file to always be downloaded. This is useful if you have a file that a browser usually tries to open (for example, a PDF), but you want it to always be downloaded.

Forcing the access level is an advanced option that is useful if you are trying to restrict files that are used inside Flash. For example, you may have a video tutorial that you want to restrict to registered users only. The flash video player requires your video file to be available, but may not provide any restriction options. Storing the video inside Drain Hole and then forcing the access level will ensure that only allowed users can access the file, even inside Flash.

Adding new files

New files can be added by any of these methods:

  • Uploading a file directly into the Drain Hole directory and ‘rescanning’
  • Uploading a file through the browser
  • Creating an empty file which can be uploaded later, or which requires an SVN repository

Add File

Versions

Drain Hole allows you to retain old versions of files, either for archiving purposes or for user downloads. To modify a file’s version you need to create a new branch:

Branch

You can enter details about the reason for the new version, and this will be presented to the end user. To retain an old version you must check ‘retain old version’. This old version can be downloaded as follows:

http://urbangiraffe.com/download/myplugin.zip?version=1.2

SVN

Drain Hole provides simple SVN functionality that allows you to associate a file with an SVN repository. A file that uses SVN can then be ‘refreshed’ directly from the SVN repository, rather than requiring you to manually update the file.

SVN functionality requires that you have SVN installed on your host. You must configure the Drain Hole options and provide the full path to the svn executable. If you are in doubt you should consult your host for details.

When an SVN-based file is refreshed, Drain Hole will use SVN to retrieve the latest copy of the files. If a repository contains multiple files they will be automatically zipped.

As additional functionality, Drain Hole will detect if the SVN repository is for a WordPress plugin, and will automatically set the version according to the version information inside the plugin.

Note that no direct capabilities are provided for username and passwords. However, you can pass a username and password to SVN by including it on the SVN field:

http://svn.mysite.com/plugin/trunk/ --username=john --password=thing

Download As – Remote File Storage

With version 2.2, Drain Hole now allows you to keep your files stored on a remote server. For example, you may want to have the files stored on Amazon’s S3. To achieve this you can enter the full URL of the remote file in the ‘download as’ field on a file.

Note that entering a filename in the ‘download as’ will allow you to have the file download with a name different to the original. Additionally, if you enter $version$ in this filename then Drain Hole will automatically replace it with the file’s current version. This will be useful if you want one download URL that when clicked will download a versioned file.

Download Tags

The following tags can be inserted inside posts and pages to embed Drain Hole information. This information is generated dynamically, and will change whenever the underlying information changes:

  • [drain hole ID hits] – Displays the total number of hits from the specified hole ID
  • [drain hole ID show] – Show a list of all files in the specified hole (change display code by copying view/drain-hole/show_hole.php from the Drain Hole plugin directory to the same directory path in your theme’s directory and editing the file)
  • [drain file ID show template] – Displays the download template for the specified file ID. ‘template‘ is optional and can be ignored (the default template will be used)
  • [drain file ID version] – Displays the version of the specified file
  • [drain file ID versions limit] – Displays the specified number of versions from the file’s history
  • [drain file ID hits] – Displays the total downloads for the specified file
  • [drain file ID url name] – Displays a URL allowing the specified file to be downloaded. ‘name‘ is optional and is the text that will appear inside the download link (if not specified then the filename is used)
  • [drain file ID updated] – Displays the update time of the specified file
  • [drain file ID size] – Displays the size of the specified file
  • [drain file ID icon] – Displays the download icon for the specified file
  • [drain file ID href] – Displays the URL of the file

Where ID refers to the ID of the file or hole, as shown in the Drain Hole administration pages.

Download Templates & File Icons

A download template is a section of HTML code that is used to display all the information for a file download. For example, on this page in the top right corner is the download for Drain Hole itself. The icon and file information are all part of a download template that is re-used on each of the other plugin pages available from this site.

A download template is a file that is stored in your theme directory and contains standard HTML as well as special Drain Hole template tags:

  • $icon$
  • $url$
  • $version$
  • $updated$
  • $size$
  • $href$

These template tags function similar to the post & page tags, but do not require an ID to be specified.

A default template is provided with Drain Hole. Custom templates are PHP files that are stored in view/drain-hole, inside your theme directory. For example, if you are using the default WordPress theme then:

/wp-content/themes/default/view/drain-hole/mytemplate.php

To use this template in a post you would insert the tag:

[drain file 5 show mytemplate]

This tells Drain Hole to use ‘mytemplate.php‘ to display file 5.

Custom icons can be stored inside your theme:

/wp-content/themes/default/view/drain-hole/icons/

Statistics

Drain Hole provides full download statistics:

Statistics

Support & Bugs

This plugin is no longer actively maintained.

438 comments

  1. I tried to put a test hole at /home/rishi-ku/public_html/notes (with the create htaccess option enabled before-hand) and I populated it with some random files. I added the hole to a page, clicked on numerous links, refreshed the page several times, and tried to access the stats on the admin interface. It said there were no downloads. I appreciate your prompt reply though!

  2. I’m a little lost here. I’ve used drain hole on my blog and it looks like just what I want.

    I wanted to hide my files I’m serving in a directory that is not accessible to the public – and they all show on the list of files available. When I try to download one I get a 404 error. I’ve followed the advice with permalinks to no avail.

    At the moment I haven’t restricted access to subscribers while I get the setup working but that is my intention. I’ve ready the FAQ and the comments but I’m still at a loss as to what to do next?

  3. I’m having the same 404 error as referenced by several people above (#141 and #192 and others). I can access the files from within a post, but not from within a page buried in the site. I’ll try the solution mentioned above (#141 by Lee) but would love to know if there’s a way to alter the plugin itself to handle this. John – is this even possible?

  4. Additional info about my 404 error:

    1. It works when the post is on the front page, but not when the post is access elsewhere on the site (i.e. when permalinks show up in the URL).

    2. The URL for my blog is in this form:
    http://12.34.56.789/~mylastname/myblogname
    …but when I enter this as the Drain Hole URL:
    /~mylastname/myblogname/downloads/
    …it strips out the ~ and leaves:
    /mylastname/myblogname/downloads/
    Is that the problem?

    3. If I just enter the Drain Hole URL as:
    /downloads/
    …it works on the front page but not when that same post is accessed from anywhere else. In those situations I get the 404 and this shows up in the address bar:
    http://12.34.56.789/mylastname/myblogname/2008/01/18/postname/downloads/filename.pdf

    Is it something I’m doing wrong, or the fact that the ~ gets stripped out, or something else? Thanks, in advance, for your help.

  5. Fixed. As a workaround, I created a subdomain. So instead of having:
    http://12.34.56.789/~mylastname/myblogname

    …I now have my WordPress site at:
    http://blog.domain.com

    It was the long-term plan anyway, but this just created some extra incentive to do it right away. And, sure enough, it fixed the problem. I’m still not sure whether it was the ~ (tildee?) symbol or something else, but it works now. I hope this info helps someone with a similar problem in the future.

  6. I think it would be great to be able to move files to different drain holes. Otherwise, this plugin is great.

  7. Ok, i’m running my wordpress from domain.com/blog/

    i’ve got permalinks enabled: (custom structure: /%category%/%postname%/)

    RewriteEngine On
    RewriteBase /blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]

    I cannot get the download link to validate. it forwards to a 404.

    my URL is set to /blog/download

  8. Is it just me, or when a file gets a hit, does it show as 7 hits? I uploaded a new file last night, and immediately tried to download it just to make sure it was working, and when i checked the hits on it, it showed 7. Any reason why?

  9. Rishi, I’ve updated the FAQ to state the directory.

    Tim, yes it probably was the tilde. I’ll see if I can make the plugin cope with it.

    Grant, suggestion added to the feature requests!

    Infect, at the moment I’d like to say it’s just you! Drain hole certainly should not register 7 hits, and no one else has reported this problem so it may be a site-specific issue. If you want to report it in the bug tracker and provide as much detail as you can then I’ll take a look

    Rob & Kat, can you installed Advanced Permalinks and send me the output from the Options/Permalinks/Debug screen?

  10. I felt a bit silly when I found out that my problems with permalinks were due to mod_rewrite not being enabled in Apache. I’m running my own LAMP server and had forgotten to check which modules were enabled. For those that need to check – I created a blank webpage called phptest.php and put:
    <?php
    phpinfo ();
    ?>

    Look down the modules for mod_rewrite. Worth checking if you are having problems 🙂

  11. Hi John,
    Thanks for the great plug-in.
    I got this message when I open the download page that I created.

    Warning: Wrong parameter count for str_replace() in /home/***/www/***/wp-content/plugins/drain-hole/drain-hole.php on line 555

    what does this mean?

  12. Great plugin, but my DrainHole not counts downloads – hits still is "0".
    WP 2.3.2, DH 2.0.14 and 2.0.15

  13. i installed drain hole and when i scan it shows me files under download directory and i can add it too mean everything is ok .

    Question is how to Show Files on my WordPress Site like i want to create a on Side bar " Downloads " and when user click on that a Page with all downloads show up .

    2nd i want to show Latest Files or Most Downloaded Files on Sidebar of my Site .

    its possible or not ?

  14. Hello can anyone help me get this working? The support forum
    doesn’t appear to be working. I registered, submitted a post and
    it’s nowhere to be found. I installed drainhole, and I thought it
    was fine until I clicked a link to try and download a file, and got
    a 404 error. WordPress is using permalinks, and they’re working. I
    believe my host has mod_rewrite enabled
    (http://www.greenerpastures.us/wordpress/info.php). What else could
    be wrong? Please help.

  15. I also got the warning as toppos:

    Warning: Wrong parameter count for str_replace() in drain-hole.php on line 555

    I think the current line 555 in drain-hole.php

    $text = str_replace ('$href$', $file->url_ref ($hole));

    should be modified to:

    $text = str_replace ('$href$', $file->url_ref ($hole), $text);

    Thanks for the great plugin.

  16. So, drain hole is great, however I ran into a problem with it this afternoon.

    After setting ‘force download’ true I was getting corrupted downloads; disabling this gave me a lovely error message relating to a missing parameter to the ‘file’ function in file.php

    Some debugging later and the problem turned out to be on line 508 in the mime_type function where the line;
    $mime = mime_content_type ($this->file ());
    should read
    $mime = mime_content_type ($this->file ($hole));

    I’m 99% sure I’ve got the latest version (2.0.16/2.0.17 based on comments in the drain-hole.php file), so I figure I should let you know about the problem 🙂

    Still, great plugin, should allow me to orginise things much easier 🙂

  17. Really nice plugin.

    I need the user to agree on download terms and only registered users are allowed to proceed with the download. For this purpose I was forced to add two new tags $name$ and $iconref$. The formed returns the name of the download target and not a link to it as $url$ does. The latter returns an url to the icon and not a download link to the icon.

    To force the user to accept the terms I use a show template similar to the following.

    $iconref$

    :
    $name$

    :
    $version$

    :
    $updated$

    :
    $size$

    You must be logged in to download this item!
    Please <a href="/wp-login.php?redirect_to=">login
    or <a href="/wp-login.php?action=register&redirect_to=">
    register now.

    I agree to the terms and conditions.

    <?php $options = get_option ('drainhole_options');
    if (!$options || !isset ($options['kitten']) || $options['kitten'] == false)
    _e ('Powered by Drain Hole', 'drainhole');
    ?>

  18. Really nice plugin.

    I need the user to agree on download terms and only registered users are allowed to proceed with the download. For this purpose I was forced to add two new tags $name$ and $iconref$. The formed returns the name of the download target and not a link to it as $url$ does. The latter returns an url to the icon and not a download link to the icon.

    To force the user to accept the terms I use a show template similar to the following.

    :
    $name$

    :
    $version$

    :
    $updated$

    :
    $size$

    You must be logged in to download this item!
    Please <a href="/wp-login.php?redirect_to=">login
    or <a href="/wp-login.php?action=register&redirect_to=">
    register now.

    I agree to the terms and conditions.

    <?php $options = get_option ('drainhole_options');
    if (!$options || !isset ($options['kitten']) || $options['kitten'] == false)
    _e ('Powered by Drain Hole', 'drainhole');
    ?>

  19. Hi, GREAT plug-in. I suspect I found a tiny bug: the “downloaded at” time stamp doesn’t compensate for different timezones between the server and the current client. I mean, if I set my current timezone as +7 in wordpress preferences, I expect the “downloaded at” statistics in drain hole use that setting. But they do not…is that true? Is that a bug or an expected behavior? Thanks for your GREAT work, it works like a charm…

    Dario

  20. I’ve tried every possible combination to create a new drain hole.

    My blog is located at http://mysite.com/blog

    URL: /blog/downloads
    Directory: /home/user/mysite.com/blog/downloads

    After every effort, I get the error message: Drain Hole was not created.

    Additioanlly, I’ve look at all the comments, the forum, and the FAQs.

    Not sure if it’s makes a difference, but my site is hosted at DreamHost, PHP v5.2.3.

    Any help is appreciated.

  21. How can I insert the tags in templates vs. post/pages?

    Are you thining of adding in tag capability?

    One more question: Can you post some examples of cutom templates? multi-column etc.

  22. I’ve asked on a few of your other plugins, but any idea on 2.5 compatibility for Drain Hole yet?

  23. Kevin, you would need to use the DH widget. How would tags be used for downloading files?

    Lomes, DH works fine with WP 2.5

    knowlimit, have you given the directory the correct permissions? DH needs to be able to create files/directories

  24. I can’t get Drain Hole working with WordPress 2.5, while it was working with WP 2.3. I made a fresh installation of WP 2.3 and got Drain Hole working right away. What can be the problem in WP 2.5?

  25. I have discovered a possible bug, and is that drain-hole will work only if wordpress is installed in the root of the webserver, or if it has been configured in a virtual host and looks like it is in the root. If you configure wordpress to be in a subdirectory, then drain hole will fail, because is unable to detect that the file are in a subdir and not in a root directory.

  26. re: original comment 215 and author’s reply 218.

    I CHMOD’d the directories 777, for setup/testing.

    Are Edison’s comments (221) true? If so, then it may be the cause of my issue.

    My blog is located at http://mysite.com/blog

  27. I got like many others the problem about 0 hits although I´ve created the hole successfully.
    I believe the problem is that my files are under the html folder which is public, my hosting service is Godaddy and they don´t provide any other folder than this one, is there a solution?

  28. re: Edison (comment 223):

    I have a virtual host at blog.mysite.com and tried the following:

    URL: http://blog.mysite.com/downloads (with and without the http://)
    Directory: /home/.neo/mysite/blog.mysite.com/downloads

    Based on the above inputs, the DH plugin actually created a new download folder located at blog.mysite.com/downloads; but states that a DH was not created.

  29. Hey John
    I had a feature request. This is to do with hotlinking, that can actually drive traffic towards the site.
    If some site hotlinks to the download, then the person who clicks it, should not get blocked or 404’d etc but should be given a captcha or something before downloading. This would ensure that the person visits your site and then downloads the real thing.

  30. Shantanu Goel: I’ve setup my drainhole to redirect to my download page in the case of hotlinking (error). You may want drainhole to redirect to something like /hotlink.html in which you explain that hotlinking is disabled and that the user have to go to a certain page.

  31. @sid: How do you do that? I’ve checked the option for “Stop Hotlinking” for my hole, but it doesn’t create the .htaccess (permissions for hole directory are writable for all). and there is no redirection option also.
    I can manually create the .htaccess there, but just thinking of how would I go about doing it with drainhole itself

  32. Shantanu Goel: Don’t know about .htaccess: I don’t think it works on it but directly on permalinks of wordpress. But probably it is not correct. (Don’t have FTP access right now to check)

    However it used to work for me. After marking the no redirect check, fill the Access Error URL field. (In the hole options)

  33. @Sid: Yeah, it worked a charm…thanks man..
    but what I wanted was that the person should automatically continue onto the real download instead of finding it out from the page, well maybe I can hack an existing 404 page search highilighter plugin to work with drainhole for that…

  34. Hey, Thanks for the plugin, it’s great.

    I found a little problem though…

    It seems that IE is having some kind of problems with downloading files (especially zips and pdf) when the Header “Cache-Control: no-cache, must-revalidate” is sent.

    I was having a problem, where on my site, Firefox could download no problem, but IE 7 would not download (tried on 3 different computer, with Vista.) the files, it would bring up the download dialog, but then it would give an error.

    I commented out the line for cache control in file.php, and it seems to work fine now.

    Just as an FYI

  35. Hey,

    Thanks for implementing the MD5 hash (I’d been waiting with baited breath).

    I’ve got a quick question, however, what is the exact syntax?

    I tried [drain file X hash] and it recognizes the tag (and removes it from the markup), but simply prints blank space. Do I need to “re-import” my files?

    ~ Christopher

  36. Hi John,

    any plans to implement the Subscriber downloads post-login feature in the near future? Ive spent a number of long hours trying to implement something similar with a template ive called “Subscriber Downloads” which simply checks if user is logged in and compares user_ID to that passed in a custom field for the given page… now with your plugin i just need to know how to list all files for am specific drain hole

  37. Oops…my apologies John seems i accidentally double-posted about the subscriber downloads feature when it now exists in the new version, and i see i can simply print a list of files via [drain hole ID show] – Cheers! Keep up the good work!

  38. Hey John

    It seems tht suddenly all my zip files in drain hole are being “openend” in the browser itself instead of the user being prompted to download it. It gets fixed when I tick the “force download” option. Just wanted to know if this is a known issue?

  39. John, HELP!!!

    After struggling with 404 errors all night long and having tried every possible solution I’ve read here, I still can’t get the plug-in to work.

    I don’t have a .htaccess file in my wordpress directory. Is this the problem? If I need one, exactly what should I put in it?

  40. To be a little clearer, here is my directory structure:

    /home/user/fileaccess (directory)
    /home/user/public_html/website/wp/index.php (path to wp directory and index.php)
    url: /website/wp/downloads

    How many .htaccess files do I need, where should they go, and what should they say?

    Thanks,

    Greg

  41. i’m having the edit.php problem when i try to create a drainhole. could someone please post the solution to the problem? it seems like every time someone solves the problem they just write back with “fixed, thanks!” but it would be really helpful if they could post how they managed to fix it!

  42. so… i opted against the drain hole folder being located outside the httpdocs directory. i created a directory within httpdocs and secured it with .htaccess. once i did that and made sure all the paths for the URL and directory were correct, i was able to create a drain hole. that said, if the paths for the directory is incorrect it still prompted me to save the edit.php file. it seems to me that there should be an error prompt letting people know that that path is incorrect or doesn’t exist, instead of the edit.php file getting downloaded. a little error message goes a long way.

  43. Is it correct that drain hole will only work when WordPress is installed in the main directory of a domain? I think I remember seeing a comment to this effect. I have it installed in a subfolder of my domain, and when I click on a file in Drainhole I get a not found error.

  44. I installed on a fresh installation of wp 2.5 right now,
    but when i enter the path , i’m getting a open or download edit.php file.

    Seems like the plugin is not compatible with wp 2.5 ?

    Anyone tried it on 2.5 so he can give us directions of use?

  45. Hello,
    I have been attempting to get Drain Hole to work for me but so far have been unsuccessful. I have read many of the posts here in the support forum but haven’t found an answer yet.

    I am currently using the following data (but have used every other variation I can think of also)for the addon domain(not subdomain) mysite.com

    I am using wordpress 2.3 as the main content management program within the addon domain.

    I have created the file mysite.com/download but not within ‘mysite.com/wp-content’

    Drain Hole URL /’mysite.com’/download/’mystuff’.zip

    Drain Hole Directory /users/’mysite.com’/download

    I have placed the directory in the main root not the addon domain and uploaded ‘mystuff’.zip into the download folder.

    However, I continue to get an error page
    Not Found

    The requested URL /download/’mystuff’.zip was not found on this server.

    Can anyone suggest a solution?
    thx.

  46. first of all, very cool plugin. we made wordpress behave like a CMS thanks to this plugin and Widgetize It.

    is there a way to control the order of files displayed? it works using numbers, but it’d be really cool to change the order inside the interface.

  47. Hi!

    Is there a way to let others users than admins use this plugin? It is a great plugin and this is the only thing I’m missing. I don’t like the idea to give someone admin rights only that he or she can handle the download stuff.

    But again, great plugin!

    Regards,
    Stefan

  48. Using IE7, the delete and edit links for an existing drain-hole don’t actually do anything; just asks for confirmation (when deleting) and then doesn’t follow through. Had to flip over the Firefox to get these links working, which is fine for me but not so much for my friend who is IE-only.

  49. Hello,
    I maintain several wordpress blogs. I installed drainhole onto one of them and activated the hotlinks security and now no images are displayed on any of my wordpress blogs hosted on the same server. I have deactivated the drain hole plugin and even deleted it from the server directory, however, i still have no images displayed. What am I missing?
    Any help is appreciated.

  50. Bryan, I don’t know what you mean by addon domain, but the URL and directories you gave are not valid. To reiterate, the directory should be the full path to a directory on your server. It does not need to be anything to do with your website and can be placed anywhere that you have access to. Do not think of the directory as being part of the URL. The DH URL defines the base part of the URL and is relative to your site root. So, for example, if you want downloads to appear in http://example.com/blog/downloads/here.zip then you would put the URL as /blog/downloads/ and upload here.zip into the DH.

    Check if DH created a .htaccess file in your image directory. This will be unlikely unless you configured it to use your image directory as the download directory

    The plugin does work with WP 2.5

  51. plugin works great “except” edit- file- name – the name displayed on the website remains the actual file name instead of the new “name”

  52. John,

    I have looked for this in your FAQ’s page, file documantation and in the forums and see that it has been asked many times but I cannot find the answer…. How do I put the commands for a Drainhole in a WordPress template file, not a page or a post? I know that this [drain hole ID show] format works in a page or post, but it does not work in a WordPress template file. I am not talking about the template file used in Drainhole, but a WordPress template file.

    Thanks!

  53. Still cannot get DH to create a hole (see comments 222, 225, 226).

    The issue before was the subdirectory: mysite.com/blog.

    The URL: /blog/downloads
    The DH directory: /home/mysite/mysite.com/downloads

    Has this been addressed in the new version; and if so, how I get this plugin to work?

  54. John, I have read the documentation above and tried all combinations…none worked. example I want to display the drainfile 4 from a template. So I put in the WordPress tpl file – I also tried just ‘4’ and ‘4’,’show’ and other combinations.

  55. forget my last comment, I jsut found the correct combination. Others: take out the space before the ? and insert the DrainHole tags ‘[drain hole ID show]’ like this.

  56. John,

    Can you show some examples of how to change the output of a template? I want to display a drainhole in a page using a table format so that the files show up like four across and four down.

    Thanks!

  57. I get this error in admin:

    tinyMCE.addPlugin is not a function
    [Break on this error] tinyMCE.addPlugin (“drainhole”, TinyMCE_DrainholePlugin);

    Any idea?

  58. I have a problem I am not able to save the seetings (like avoid hot links, reestrict access to my downloads),everytime i change seetings i save it but it doesnt save it, why. Im using wordpress 2.6 btw

  59. Please add it to the bug tracker along with more details about your setup. In particular, include any javascript error messages you may have

  60. Hi,
    i’ve installed your plugin and create a drain hole directory (not accessible by http).
    I’m able to upload a new file, i saw this file in the drain hoel directory (by ftp) but, i cannot see the file in the wordpress admin.

    Where the files supposed to be managed in the drain hoel admin tool?

    thank you

    PS : I’m using firefox 3.0.1

  61. Hi,

    I created a download dir not in my public html and created the drain hole. I checked it 10 times and it is correct 😉

    But when I click the hole in WP then I dont see any files? Clicking re-scan is still not showing any?

    for testing purposes I also created a directory in my public html dir. When I upload a file (trough browse) I do get a “Your files were successfully updated” message but again no files?

    Can you please help me out?
    (php4.4/wp2.6)

  62. I experiencing the same issue as described by Henk below.

    My hole is outside /public_html/ but when scanning the hole, new files arent found. This used to work just fine. Would be nice to get a fix for this. I’ll report this in the tracker as well.

    Other then this, drainhole is a great WordPress plugin … 😉

  63. Hey John, I fixed the issue why the latest version is not able to scan new files.
    The changes have to be done in “file.php” (under models folder)
    1. Line no. 106, replace ‘NULL’ by $file
    2. Line no. 127, replace $name by ‘$name’

    These two changes will start the things working again.

  64. Windy, I added the first change because otherwise any new file was by default named as ‘NULL’. Maybe making just removing the quotes would also work as there might be some other check somewhere, but I played it safe and added the default name as file name.

  65. Is it possible to display the full download statistics graph on a page or post? Or is it exclusively for admin-eyes only?

  66. Hello all, I’m using Drain Hole to distribute my class notes to peers; however, upon testing, I realized that there’s a huge “lag time” between completing the download and actually launching the PDF file.

    I also noticed that this lag time disappears if I don’t keep track of hits by removing the .htaccess file from the hole directory. Below is the contents of my .htaccess:


    RewriteEngine On
    RewriteRule ^(.*)$ /home/users/web/b2693/d5.rishi-ku/public_html/index.php

    Is there a way to keep both the speed *and* the statistics?

  67. Rishi, enabling statistics should add only a couple of additional database requests. I’ve got statistics enabled on this site and dont appear to have any performance issues related to this so I can only assume there is another issue somewhere in your setup. For example, you might have another plugin running that has a noticeable startup delay.

    It’s not possible to show the graphs for other users.

  68. Thanks John! Eh, I couldn’t figure it out, so I’ve disabled statistics all together. However, I can’t imagine running my site without Drain Hole, so keep those fantastic revisions coming! 🙂

  69. Hey John
    I’m facing a critical issue with drain-hole and tar.gz files. They always turn out to be bad downloads however work fine if downloaded through ftp or direct link. Have added it to the issue tracker.

  70. John, I was going through the changes that you did for 2.1.7 and it seems that you have fixed the tar.gz MIME type issue (though I haven’t tried it out yet). But one question, shouldn’t line no. 554 in file.php read “application/octet-stream” instead of “application/octet-steam”? (Missing r in stream)..
    Thnx

  71. Shantanu, you have sharp eyes! That is indeed a typo. Fixed.

    José, I did make some changes to help people who were getting 404s (as I experienced on a new blog I setup). This may have had the opposite effect on your site. If you have the time you can help me locate this problem by doing the following:

    1. Edit wp-include/classes.php
    2. On line 94 (immediatley after foreach ($rewrite as $match => $query) add:
      echo "$req_uri == $match<br/>";
    3. Try to download a file (causing a 404)
    4. Send me the output on the screen (should be a list of URLs)
    5. Remove the above line and put your site back to normal!
  72. Sorry, those lines were shown BEFORE I tried to download the file. I think THESE are URLs you mentioned:

    downloads/fssa_osm/exercicio_layout_metodoelos.doc == ownloads/a_economia_da_informacao_contabil\.doc
    downloads/fssa_osm/exercicio_layout_metodoelos.doc == ownloads/automacao_servicos_contabeis\.doc
    downloads/fssa_osm/exercicio_layout_metodoelos.doc == ownloads/banco_dados\.pdf
    downloads/fssa_osm/exercicio_layout_metodoelos.doc == ownloads/code/registered_users_dofollow\.php
    downloads/fssa_osm/exercicio_layout_metodoelos.doc == ownloads/code/rename\.php
    downloads/fssa_osm/exercicio_layout_metodoelos.doc == ownloads/fssa_inf/atividade_carga_horaria\.doc
    downloads/fssa_osm/exercicio_layout_metodoelos.doc == ownloads/fssa_inf/atividade_complementar_1_gabarito\.pdf

  73. John, thanks for correcting the plugin!

    I still have a doubt, though: why didn’t you change the version number? I didn’t notice any change on my “Manage plugins” page… If I hadn’t been curious enough to come here… 😉

  74. Is there any way to make it redirect to a specific URl ones the download starts? ie..to a page with installation instructions, or other recommended downloads, etc.. Kind of like what download dot com does.

    That would be an awesome addition to an already awesome plugin.

    Thanks

Comments are closed.