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. Drain Hole sounds a wonderful idea but it is causing me some problems. I installed the plugin as directed and from the options page gave it a directory (“downloads”) which contains the files i have for download. The files are listed correctly in the options page. However when I try to download one of them I get a 404 page saying:

    The requested URL /wp-content/plugins/drain-hole/drain_plumber.php was not found on this server.

    This was when I tried to download for example:

    http://rmarshsj.f2s.com/rob/downloads/aevr.pdf

    which seems to be the right url and Filezilla confirms is present.

    My next step was to deactivate and remove Drain Hole and delete the drain hole tables. The same url to aevr.pdf still gets the same 404 message that drain_plumber is missing.

    Help!!!
    Rob

  2. Hello. I’ve got some problems using this plugin. The tables and the htaccess are well created, but no file appears in the options page. And when I click on the ‘Update’ button, I receive this error message :

    Warning: Invalid argument supplied for foreach() in drain_hole.php on line 27

    Warning: Invalid argument supplied for foreach() in drain_hole.php on line 54

    What can I try ?

  3. Any way you could add a feature to be able to add a name and description through the Drain Hole admin area? And then of course corresponding template tags?

  4. hi,
    im triying the plugin but i dont know what to do with this errors after plugin was activated:

    WordPress database error: [Table ‘wordpress.wp00_drainhole_access’ doesn’t exist]
    DELETE FROM wp00_drainhole_access WHERE DATE_SUB(CURDATE(),INTERVAL 60 DAY) > created_at

    WordPress database error: [Table ‘wordpress.wp00_drainhole_holes’ doesn’t exist]
    SELECT * FROM wp00_drainhole_holes ORDER BY url

    Could you help me?
    Regards,

  5. Hi,

    I’ve got Drain Hole installed and I have Redirection installed.

    I created a drain hole with
    URL ‘/download/project/jhdi’
    DIR ‘/home/blogpeer/Downloads/Projects/JHDI’
    AL ‘Subscriber’
    FAIL ‘/download/project/404’

    I went into the files section for the new hole and rescanned the directory, and it found and listed the file I had placed there.

    I added the code to a post ‘[drain file 1 url (download)]’ and it correctly displayed the URI link I expected. However when i click on the link it generates a 404 error.

    Any Ideas what I might be missing?

  6. Oh great. It is almost what I need. Is it compatible with WordPress 2.2?

    Is it possible to add in Download Statistics the IP address of who was downloading the file?
    And second thing. If somebody wonts to download a file has to give an email address. Possible?

  7. Yes it works in 2.2.

    The download stats already tell you the IP address.

    You can configure Drain Hole to restrict downloads to registered users. A registered user would need to have given an email address.

  8. The plugin is great but one think is missing here.
    To add a file to a post, first I have to add a file, see what ID it has and then go to the post and add.
    [drain file ID url]

    Is it possible to do it automatically?

    Let say I will put in my post [drain hole ID] and every file that is in this “hole” will be automatically added to my post and all files will be shown as a list.

    I would be really cool because I will have to only add a file to specific “hole” and it will automatically appear on my site.

    Do you think is possible?

  9. @Drain Hole: I have the same problem.
    John can you tell us what is the problem? Maybe something in .htaccess??

  10. Tino,

    That’s a great suggestion and I’ve added it to the plugin (see [drain hole ID show])

    Dane: Are there any messages in the redirection logs?

  11. Hi John,

    I’m having the same problem as Dane using WP 2.2 with the latest versions on drain hole and redirection. Both FTP’d and activated fine.

    I configured a drain hole as follows:
    URL: /robo/downloads/bee_patents
    Directory: /home/bushkill/downloads/bee_patents
    Access Level: Anybody
    error redirect: http://www.********.com/404.shtml

    rescanned the directory and all the files where found. Created a post with [drain file 1 show] and it displays the correct link, http://********.com/robo/downloads/bee_patents/US03994034 Beehive Heater.pdf
    But when you click on it I get a 404 error, but not the 404 error redirect defined in the hole.

    I checked the redirection logs as you suggested to Dane, but they are empty. Is there any configuration of redirection required other than activating to use drain hole?

    Any help would be appreciated as all other download plug-ins I’ve looked at pale in comparison to drain hole.

  12. [drain hole ID show] this is great but maybe one more thing.

    Now I can put on my page [drain hole ID show] and I will have list of all files generated autmatically:

    My files
    -file 1
    -file 2
    -file 3
    -file 4

    But, now I would like to have on this site not one category but two, for example:

    My files 1
    -file 1
    -file 2

    My files 2
    -file 3
    -file 4

    It will be possible if there will be a possibility to add two or more drain holes to one page so I will have:

    My files 1
    [drain hole ID show]

    My files 2
    [drain hole ID show]

    or think about category? Every file will have category and then we will use for example
    [drain hole ID show catID]

    Or do category by subfolders?

    What do you think John?

  13. No John, not for any of the drain hole stuff. I am using redirection itself now too, and it’s logging those, but never did log anything for drain hole except the 404 errors generated by clicking the drain hole links.

    Incidentally, I was never sure whether creating a drain hole should also create a new record in the redirection tables, but in my case it does not.

  14. Hi John,

    I finally set up Drain Hole (1.1.3) and Redirection (1.7.9) on the KC site but I also seemed to get issues with 404s. However, after manually setting up the redirection I managed to get it to work.

    I was wondering if Drain Hole is supposed to be creating the redirection automatically, or is this just a step that I missed in the installation?

    Cheers,

    Zain 🙂

  15. Perhaps I haven’t read through all of the comments quite enough, but is there a way to show the stats in, perhaps, a sidebar? Ideally I’m looking at showing a “top downloads” type statistic. I’ll poke around the code as well. Great plugins btw.

  16. tino: You can already do that – just create two drain holes and do exactly what you wrote.

    miklb: A good suggestion and added to 1.1.4. See the updated docs for details

    Dane, Rob, & Zane: Drain Hole shouldn’t create anything in Redirection. The plugins work together so that it happens transparently to you (at least, that’s the theory). I’ll look into this problem some more

  17. Well, I thought maybe I had a plugin conflict, but I installed a fresh WP install and I’m still getting the same thing. Everything works up until I click on a generated drainhole file download link. Then i get the 404.

  18. Hey John if any of my setup/config info will help let me know what you need and I’ll send it to ya. I’d really like to get this to work. It’s everything you could hope for in a download manager.

  19. Hi, John! Nice to see there’s a new version available! Great plugin! I have a doubt though: what mime type do I set for .png files? Do you intend to add ‘image/png’?

  20. Hi
    Drain-Hole, not functional in my hosting (Hostgator). I think the problem is with redirections.

    I have Drain-Hole in wp 2.2.1 in a server at HOME and the pugin work very well.
    Anyone can help me in this?
    Thanks

  21. Problem solved.
    It’s a problem in htaccess fil with permanent links.
    Confirmed, plugin work in wp 2.2.1

  22. Great set of plugins.

    One question. Are there plans to add an optional description field for each file? So if I want to give a quick note of what the file is, I can?

    Thanks.

  23. Jose: I’ll make the next version auto-detect if a file is PNG

    Graeme: A description to be display only in the admin interface, or one that would also appear on the website?

  24. I was thinking of something that would appear on the site, but optional so you could enter a description to show on the site for each file, if you wanted one, but a description wouldn’t be compulsory.

    Also, is there any way to list ALL the files in the hole? i.e. instead of:

    [drain file 7 show drainhole]
    [drain file 8 show drainhole]
    [drain file 9 show drainhole]

    something like:

    [drain file * show drainhole]

    Thanks.

  25. Never mind the 2nd request. I just realised you’ve already provided that mechanism – to display the whole hole.

    Helps to read the docs… D’oh!

  26. Hi there, i like this plugin, thanks…
    but, why do i have to use redirekt plugin? it works also wihtout Redirection plugin….
    What does not work is the download counter, when i create a List with [drain hole 1 show]
    there is always 0 (zero) ??
    any idea why?

  27. Tom, you are not getting any download counting because you are not using Redirection. I would also guess you have your files in a publically accessible directory?

    The ideal way of using Drain Hole is to store all your files in a private directory (i.e not in public_html) and then use the plugin, in collaboration with Redirection, to make the files available publically. See the ‘Usage’ section for more details.

  28. Hi, a returning visitor/user of your other plugin =P. I’m just wondering if it’s also good to have an enabled password protected directory or link? Well, this–password protected part of the post– can probably be achieved by the Post Tools plugin by Headzoo.com…Is there an interest in adding this measure John =?

  29. I’m not sure what you mean M.T? You can restrict access to files by setting the access level in Drain Hole

  30. Hi John, great plugins!
    However, i have the same problem with Rob, Dane and Zain. in comments no 21 You said that we need to get Redirection 1.7.10. Where can i find it? Now im using 1.7.11.
    Thanks

  31. Hi John, I think the problem is not in Drain Hole but in Rederection. My server still use PHP 4.4.7. Guess its not working for this version. Or maybe you have other solution?

  32. You don’t need to be using permalinks, but you need to have a .htaccess file created for you (when saving permalinks). Without this any access to a file will not go through WordPress.

  33. hello
    First thanks for the plugin.

    However I have a problem :
    whatever is access level, downloads are possible. I guess I have missed something… but what?

  34. Hi John,
    I have a .htaccess file. But its located in home/bhina/public_html/ while my blog is installed in /home/bhina/public_html/bhinablog. This is what the .htaccess looks like:

    php_flag session.use_trans_sid off
    php_value arg_separator.output ‘&’

  35. Hi, I want first thank you for the great plug in.

    Now I have a problem. I hope you can help me out.

    I accidentally deleted a database and now I am getting error massages like:

    [WordPress database error: [Table ‘database1. contentsdrainhole_access’ doesn’t exist]
    DELETE FROM contentsdrainhole_access WHERE DATE_SUB(CURDATE(),INTERVAL 60 DAY) > created_at]

    I want to start over by reinstalling this plug in.
    How can I clean re-install this?

  36. Hello,

    Using drain-hole 1.1.4, wp2.2.2 and redirect 1.7.14, I add my drain holes using:

    URL: /filevault
    DIR: /home/frank/filevault/

    My webserver is running in /home/frank/www/wordpress/ (I have copied index.php with modifications to /home/frank/www/ so I get my blog by just typing the URL address, and not needing to prefix it with wordpress/)

    I can list the files in the drain hole from the admin page, and I can create download-URLs by using [drain file 1 url Download me!] which shows up in pages/posts. But when I press this link, I just get

    "The requested URL /filevault/test.jpg was not found on this server."

    No logs in the redirect plugin either, so I’m pretty clueless right now what’s wrong. I appreciate any input on this issue, as the plugin seems to do exactly what I want from it, but right now I can’t use it.

  37. Excellent plug-in, we are using it on one of our other blogs to manage the downloads of our WP Mega Feedjit Widget, but for some strange reason, we are unable to download files in FireFox.

    We were able to see it when previewing the post, and downloaded a file from there, and then published that post, but after publishing it, we were unable to click on the icon or the file name. Is it because we have already downloaded the file? In internet Explorer, we were able to click on it, and even after that, we could click it agin (but did not do so due to not wanting to create fake statistics). If this is the case, it is a good reason to do so, but we are concerned about updates, at which point, will FireFox start working again, or is it really a bug in the plug-in itself…?

  38. Finally got it working, though it seems it does not support spaces in the filename. I’ve tried downloading the file using both [drain file foobar]. Both works when filename does not contain spaces, but none work if it contains spaces.

    The "strange" thing is that filenames with spaces are recognized and listed in the drain hole nonetheless.

  39. great plugin but,

    it would be great to have a separate caption field for each file which supports spaces in filenames.
    now every file is shown as "file_name.extension" on my site, but i would like to have it like "file name" only. Which then redirects to "file_name.extension".

    Maybe you can implement that.

    regards

    chris

  40. It don’t work for me when I press create drain hole it give me a download dialog asking me download edit.php

  41. A shiny new version has been released adding a lot of functionality. This should take care of most of the reported problems. Redirection is no longer required.

    Tomsn, it is probably because your files are stored in public_html. Files should be stored outside of your public area.

    Trish, is your site properly configured to run PHP? That kind of behaviour is usually associated with bad Apache configuration.

  42. activating the plugin gives me an fatal error.
    I used 0.1.7 prior upgrading to 2.0
    I deactivated 0.1.7, deleted the folder and uploaded 2.0. Activation of the plugin ends up in an fatal error.

    Any ideas?

    regards

    chris

  43. Hi John
    it is not possible for me to store the files outside public_html, i have webspace from a Provider, its not my own server!!

  44. I had the same problem as chris (fatal error). I’m using WP 2.2.3 and WAS using drain-hole 1.1.4…

    Another question: How do I delete a drain hole WITHOUT deleting the files?

  45. Hi John
    I get the same error as Trish (using DH 2.0.0, WP 2.2.3), the server is recently built, any detail about what you might mean by "bad Apache configuration" so I can give my sys admin a nudge? WordPress generally appears to otherwise run ok on this server…

  46. Tomsn, you can still store files outside of public_html. Every provider should give you a ‘home’ directory (something like /home/yourname/). You can create files in this directory just like any other. It’s only files in /home/yourname/public_html that are available to the world.

    Trish and YikYak, there’s a support page here which suggests a number of causes for this problem. Why it would only occur with Drain Hole I don’t know, but other people get similar effects (with WordPress in general) that seem to be caused by Google Toolbar, gzip compression, old cookies, or Apache configuration. See if anything there is helpful – it may be something as simple as clearing out cookies for your site.

    Jose, there’s now an option to enable or disable file deletions.

    Do you have any more details on the fatal error? I’ve tried installing it on a clean WP install and everything goes fine.

  47. Ah, that did the trick Colin, my new zip routine was stripping slashes. Fixed. Incidentally, it seems that WP 2.3 shows details about why a plugin failed – very useful!

  48. John, now it works fine. Actually, I didn’t even notice any of the problems Colin did (yet).

    But I noticed these messages on the bottom of Options Page:
    WordPress database error: [MySQL server has gone away]
    SELECT count(*) FROM wp_fs_visits

    WordPress database error: [MySQL server has gone away]
    SELECT time_install FROM wp_fs_data

    WordPress database error: [MySQL server has gone away]
    SELECT max_visits FROM wp_fs_data

    WordPress database error: [MySQL server has gone away]
    SELECT max_visits_time FROM wp_fs_data

  49. I upgraded from 1.1.4 to 2.0.2

    Activating works, BUT..

    i can not delete a drain hole, which i build in 1.1.4
    i can not make a new hole, trying that ends up in the following error message:

    WordPress Database Error: [Unknown column ‘hotlink’ in ‘field list’]
    INSERT INTO wp_drainhole_holes (url,directory,role,role_error_url,hotlink) VALUES (‘/download’,’/srv/www/htdocs/web72/html/sisoweb/musik’,NULL,’/download’,”)

    The Drain Hole was not created – you must supply a unique URL and directory

    and, after activating the new plugin, the downloads on my site do not work, i get an 404 error.
    So atm, downloading an old 1.1.4 drain hole does not work, building a new one does not work and deleting an old one does not work.

    AND, i can not step bacl to version 1.1.4 – that ends up in massive .php errors when i try to download a file after setting up the old version.

    maybe you can fix that asap..

    the ajax features are very nice, but we need 100% stable functions first 🙂

    regards

    chris

  50. First error when trying to create a drain hole:

    WordPress database error: [Unknown column 'hotlink' in 'field list']
    INSERT INTO wp_drainhole_holes (url,directory,role,role_error_url,hotlink) VALUES ('/filevault','/home/frank/filevault',NULL,'/filevault','')

    Fixed with:
    mysql> alter table wp_drainhole_holes add `hotlink` varchar(100) default NULL;

    Second error when trying to add a file:

    Fatal error: Call to a member function can_write() on a non-object in /home/2/l/lundvestre/www/wordpress/wp-content/plugins/drain-hole/view/admin/files.php on line 66

  51. Chris, you can’t downgrade without fully removing Drain Hole. 100% stability is not something you can realistically expect with free software. The new Ajax functions have not affected the stability of Drain Hole in anyway. They actually gave me more spare time to focus on the rest of the plugin. The missing database column has now been added.

    Frank, missing database column added to 2.0.3. You should delete the column you created before installing. The rest of the errors should disappear on their own.

    Jose, I don’t know what those database errors and the errors involved have nothing to do with Drain Hole – looks like something else!

  52. Still getting the same error with 2.0.3 when viewing a drain hole:


    Fatal error: Call to a member function can_write() on a non-object in /home/2/l/lundvestre/www/wordpress/wp-content/plugins/drain-hole/view/admin/files.php on line 66

    I used "Delete Drain Hole" option in plugin for removing SQL tables and deactivating the plugin, before activating it again.

  53. testing 2.0.4 all errors i found yesterday are fixed,

    BUT

    trying to edit options of a file ends up with data type errors in the ajax window

    Warning: in_array() [function.in-array]: Wrong datatype for second argument in /srv/www/htdocs/web72/html/sisobeta/wp-content/plugins/drain-hole/view/admin/files_edit.php on line 47
    /> Force download
    Warning: in_array() [function.in-array]: Wrong datatype for second argument in /srv/www/htdocs/web72/html/sisobeta/wp-content/plugins/drain-hole/view/admin/files_edit.php on line 50
    /> Force access level

    …keeping testing 🙂

    nevertheless, i really like your plugin and the ajax effects.

    chris

  54. Hi,

    I have a problem with the drain_hole plugin. When I embed the template code [drain file 2 show mytemplate] into my post I get a "Rendering of template mytemplate.php failed" error. I think that because the template file is missing. As far as I can see it is not included in the zip file .. Any Ideas? Thanks! 🙂

  55. I think its unneccesary "hard" to add a download URL, in fact I have yet to get it working as i want.

    Why cant I do "["drain file 13 PDF"]" for example? Why do I need an URL, and better yet what is this URL supposed to be? I can display the file size, so I guess the drain hole is working. Can you provide some kind of idiot proof example on the drain file id syntax?

  56. Totally screwed up for me.

    I have 2 holes defined (num 6 and 7). If I try (through the admin page) to go into num 7 to refresh the files, I get the details for 6, including path, directory, etc. I can’t get into 7 at all.

    I originally had them with files showing, but the files from 7 showed as missing because it was looking at the paths for 6 instead.

    I’m running 2.0.5 along with the latest Redirection.

    Help. At the moment, its useless, but I know from previous versions, its exactly what I want.

  57. John! Version 2.0.5 works great! I could find only one minor problem: in the options panel, it does not change the maximum number of days. It is allways set to 0 (zero).

    I had to set it through phpmyadmin… 😉

    Great job! Thanks!

  58. OK, one step closer – I can list information about files and create a [drain file id url] link, however when pressing the link, it just takes me back to the frontpage. No error and no statistics show up.

    I do *not* have redirection installed, since I understand its not needed in the 2.X version of Drain Hole.

  59. Hi John
    how can i explane my situtation that you understand me?
    i have webspace from my Provider, there is no public_html… my "public_html" is my root directory, i can not go out of my rootdir!! i can only make subdirs where i can store my files.. so what should i do??

    Tomsn

  60. Tomsn, Drain Hole does attempt to create a .htaccess in your download directory. This is the only way it can prevent direct access. Check if the file is being created

    Frank, you don’t need to specify a URL in the syntax, you just type the word ‘url’ so that Drain Hole knows you want to show a URL. The easiest way to show a file is just [drain file 5 show]

    Sven, ‘mytemplate’ is just an example and is not included with the plugin. The template parameter is optional and you do not have to specify it unless you have a template you wish to use (see section on templates)

    Jose, oops! Fixed.

  61. Hey John, is there an easy way to disable .htaccess creation? My folders are already protected by another piece of software and I’m thinking that this could cause trouble for me. I haven’t done alot of testing yet, but I think the other software creates a .htaccess as well(subscription software). If it’s a difficult hack just let me know and I’ll try and figure it out.

    Thanks for the rad plugins!

  62. I’m trying to use 2.0.7 with WordPress 2.3 and it’s like the new version won’t update the database so Drain Hole will work. I get this error:

    WordPress database error: [Unknown column 'wp_drainhole_files.hits' in 'field list']
    SELECT SQL_CALC_FOUND_ROWS wp_drainhole_holes.*,SUM(wp_drainhole_files.hits) AS hits,COUNT(wp_drainhole_files.id) AS files FROM wp_drainhole_holes LEFT JOIN wp_drainhole_files ON wp_drainhole_holes.id=wp_drainhole_files.hole_id GROUP BY wp_drainhole_holes.id ORDER BY name ASC LIMIT 0,25

    I really want to use the new version. I dig the fancy charts and stuff. Any ideas?

  63. Well I fixed it. Somehow the drainhole_version was being set to 4. I changed it to 1 and was able to get 2.0.7 working. Very neat stuff. Not sure what was going on. But it works now.

  64. Are you kidding me???

    I came to see if anybody saw my comment and had any ideas or hacks for me. I look at the latest file download info and see that it’s been updated……..I then read:

    Option to disable .htaccess creation

    Wow, you are the man John!! Thank you so much!!

  65. Hi,

    It would be really cool if for example:
    – when somebody downloading a file from my site I would get an e-mail
    – maybe if someone wants to download a file, he/she has to answer a question or give e-mail

    What do you think?

    Tino

  66. Tino,

    I think it would be a good idea. But, to be really useful, should be activated on the options panel or maybe offer a file-by-file flag.

    This way, people who offer a lot of files that are downloaded dozens of time a day wouldn’t be flooded with notification e-mails.

  67. José Luís, yes you are right but I was thinking that for example:

    on one page I have 10 files to download – all are in one drain hole so when someone will click first time on any of these 10 files he will need to give an e-mail to download, but if after downloading first file he wonts to download anather he will do it without hiving e-mail again. (it can works on cookies)

    Tino

  68. Hi John,
    I finally think I got around the "download of edit.php" problem. It appears to be to do with the directory permissions on the server. The files (and directories) inside my home directory, but outside my public_html were not visible to the apache server process. We did a bit of experimenting, and it seems to be quite subtle what permissions are in place. Given other people don’t generally seem to experience this issues, I am still a bit worried we aren’t quite there…but it’s hard to "debug".

    At the moment I can create a drainhole, and I can manage and upload files in that drain. I tried to set up a blog post using [drain file x show]. When I view the post, I see a nice graphic and a link to click, which seems to be based on the correct filename, which seems to suggest something is working right? But when I click, I get a 404 not found. Any ideas?

  69. hmm, I read through all the other comments and a few seem to suffer 404 errors even though they can manage the drain hole files…for the record I am on DH 2.0.8, WP 2.2.3
    I also tried on a different server, where I did not experience the "save edit.php" issue at all, but I still can’t get past the 404. I’ve tried a number of locations for the files, both inside and outside my webspace (As best I can)

  70. Hi, thank you for the great plug in.

    Now I have a problem. I hope you can help me.

    After installing your plugin i receive the following errors by manager > drain hole:

    WordPress database error: [Table ‘drainhole_access’ doesn’t exist]
    DELETE FROM drainhole_access WHERE DATE_SUB(CURDATE(),INTERVAL 60 DAY) > created_at

    WordPress database error: [Table ‘drainhole_holes’ doesn’t exist]
    SELECT SQL_CALC_FOUND_ROWS drainhole_holes.*,SUM(drainhole_files.hits) AS hits,COUNT(drainhole_files.id) AS files FROM drainhole_holes LEFT JOIN drainhole_files ON drainhole_holes.id=drainhole_files.hole_id GROUP BY drainhole_holes.id ORDER BY name ASC LIMIT 0,25

    Deactivating & activating doesn’t help 🙁

  71. YikYak, version 2.0.8 should have fixed that. The problem with the 404s is that the permalink structure on some sites is taking precedence over the files. Drain Hole thinks everything is ok, but when you click on a link, WordPress jumps in before Drain Hole has a change and thinks you are trying to view a post. As you don’t have a post of such a name it then 404s. Version 2.0.8 puts all the drain hole files at the very top of the queue. Before investigating further, it may be worth just re-saving your permalink structure and then giving it a try. I’ve just realised that while 2.0.8 should fix the problem, it requires that the permalinks be re-saved and you may not have done this

    Over, what version of WordPress are you using? What is your table prefix? From your error message it doesn’t look like you have a table prefix at all (if you’re unsure, look in /wp-config.php and the table prefix is listed there)

  72. Hi John,

    Thank you for your reply. I’m using WP 2.2.2. I’ve deleted the prefix from the error-message (security). My prefix is _cms. I really hope i could get this great plugin to work.

    Regards.

  73. bad hair day….

    somehow managed to get drain hole into a state where it would not activate, fatal error, so I deleted and re-installed my blog just to clean everything (in MySQL) out (thankfully developmental, no real content!), yeah I probably didn’t need to, but thought I would if I wanted to get drain hole working. My MySQL skills were not up to clearing out just drain hole bits of the database

    The latest is that I have tried every combo of permalinks I can, with lots of combos of file permissions inside the drain hole, everything I can vary without annoying my sysadmin.
    No joy. Just 404 from the theme.
    (I presume "options -> permalinks -> update permalinks" is what you meant me to do, I can’t see how to do anything else with them) – two of the alternative permalink structures seem to give me the same .htacces, is that correct?

    anyway, saving the options with all the standard permalink variants gives me 404 problems.

  74. Im having a weird problem. I’ve installed Drain Hole 2.0.8 on WordPress 2.3, and when Im trying to add a new Drain Hole the page turns blank and nothing happens. Any idea what causes that?

    Thanks,
    Paul.

  75. If you added this code before any hits received [drain hole 1 hits]

    Fatal error: Call to undefined function: hole_stats() in /home/thinkout/public_html/your/wp-content/plugins/drain-hole/drain-hole.php on line 576

    No big deal! If no stats, shows an error message.

    Thanks

    Roger

  76. I’m trying to set up drain hole on a local wordpress install (XAMPP) and I can’t create drain holes — As soon as I set up the two urls and hit "create drain hole", I’m getting a "server reset during page load" message from Firefox, unfortunately no error codes.

    For the local install, I want to set up a folder at "http://localhost/folder/", redirecting to "http://localhost/myblogroot/downloads/", both of which are located inside "/htdocs/" on XAMPP. (On the server, I’d probably use a folder outside the "public_html" folder, as suggested, but on the local install the blogroot and the drain hole live in the same directory).

    When I enter http://localhost/myblogroot/downloads/ for URL and http://localhost/folder for directory, I get the server reset message. Can someone help me out?

    Using: WordPress 2.3, Drain Hole 2.0.8, permalink structure /%category%/%post_name%/

  77. I installed it and everything, created the main drainhole with all my downloadable files in it and it doesn’t count the downloads. What can be wrong?

  78. Hi, was wondering would the logging of each download with drain hole cause a spike in server load?

    Because I get around 20,000 file downloads a day and I noticed after using this my server load has went up quite a bit. Not sure if its related to drain hole though. Could be something else, but just wondering if that many downloads a day would cause trouble with logging.

Comments are closed.