File Taxonomy Server Lite
FTS Lite is a module for Drupal 6 inspired by the File Server module. It provides WebDAV access to Drupal’s files based on taxonomies. It depends only on Core Upload and the DAV module.
Once upon a time, I needed a way to upload lots of files to a Drupal web site and have each file be attached to its own node. The nodes would be created automatically at upload time, one for each file. After trying several modules, I found that the File Server module, combined with File Framework, might do what I wanted. Unfortunately, File Server had several bugs and it was not clear to me whether it was under active development or it was abandonded. Moreover, the File Framework upon which it depends was way too complex for my requirements.
After taking a look at the source code of File Server, I decided that it wouldn’t be too hard to make some small changes to remove its dependencies from File Framework and make it work with Core Upload. This is how File Taxonomy Server Lite (FTS Lite) was born. Eventually, I re-wrote nearly all the code and made it much more robust. Now it is a fully functional, yet very simple, module, whose only dependencies are Core Upload and the DAV module.
Installation and usage
Like File Server, FTS Lite provides WebDAV access to Drupal’s files based on taxonomies. Starting to use the module is a five-step process:
- Install and enable the DAV module. Go to User management > Permissions and grant the necessary permissions in the “DAV module” section.
- Install and enable FTS Lite.
- Go to Site configuration > DAV settings > File taxonomy server lite and select the node type that will be used to represent files. You can use any node type, but I strongly recommend that you create a custom node type for your files and adopt the policy “one node-one file”: although this is not mandatory, it is the best way, in my opinion, to benefit from the functionality provided by the module. Each node of the designated type should always be linked to exactly one file attachment.
- Choose the vocabularies that you want to export through WebDAV. Any kind of vocabulary is supported, including free tags vocabularies. You may select as many vocabularies as you like.
- Using your favourite WebDAV client, connect to http(s)://yoursite/dav and log in with your Drupal credentials (if you use https, you will probably need to configure your client to accept a certificate). That’s it!
You will see vocabularies as top-level DAV collections and terms as DAV sub- collections. File nodes are exported as DAV resources. In human-understandable words, you may access your taxonomies as you would access a file-system, where folders represent terms and files represent Drupal nodes.
Here is what happens when you perform some operations on the client side:
- You upload a file to a folder: this creates a new node in Drupal and associates the node with the taxonomy term represented by the folder. Of course, you cannot upload files to top-level folders, because they represent vocabularies, not terms.
- You rename a folder: this renames the corresponding term or vocabulary in Drupal.
- You move a file from one folder to another: this re-tags the node corresponding to the file.
- You copy a file from one folder to another: this adds a tag to the file node.
- You delete a file from a folder: this untags the file node. The file node itself or its attachment are not deleted at all.
And so on… You can even make complex operations like moving or copying folders onto other folders in a different hierarchy: this corresponds to move/copy a whole bunch of taxonomy terms to a different vocabulary. And node revisions are supported, too: just set up the file node type appropriately. When revisions are enabled, replacing an existing file will create a new revision of the corresponding file node. See the included README file for more details on the semantics of the various operations.
Finally, some operations may succeed or fail depending on how your vocabularies are configured. For example, free tags vocabularies will give rise to flat hierarchies: hence, trying to create a sub-folder of a given folder will raise an error. Also, if your node type is configured so that some fields are required, you may end up not being able to upload files at all.
In general, what you can or cannot do through WebDAV is exactly what you can or cannot do using the web interface. But WebDAV error messages are pretty obscure. If you get an error, go to your Drupal log and search for FTS Lite messages. It is worth stressing that, no matter how you manipulate your resources through WebDAV, FTS Lite never deletes nodes on the server. It may remove terms or even whole vocabularies, but not nodes. The main design goal of the module is data integrity: this means that much care has been taken to validate your data (with stricter rules, sometimes, compared to Drupal) and to avoid data corruption or loss (for those who know the internals of Drupal, I have used drupal_execute throughout, rather than lower level methods). That said, use FTS Lite at your own risk. I decline any responsibility, I won’t be liable for any damage, etc etc…
Finally, a consequence of my design goal is that the module is slow. But efficiency was not much of a concern for me: I can start to upload a hundred files and then go for a coffee.
Tested clients and known issues
- I have tested the module using cadaver, with no issues.
- With Mac OS X Finder, downloading a file succeeds, but uploading to the server fails with The Finder can’t complete the operation because some data in “” can’t be read or written. (Error code -36)
- Cyberduck (3.4.2) works fine, but I have not been able to use a secure connection with it (it fails with an error about the certificate, but I have tried only with self-signed certificates).
FTS Lite is not on drupal.org. Why?
FTS Lite is an unlucky module. After using it for a while without much trouble, I decided that it was pretty stable and that it might be useful to someone else. So, I submitted it for review on drupal.org. After four or five rounds in which the module was rejected because the code layout was not totally complying with Drupal standards, it was rejected again on the ground that there were (and still there are) various occurrences of the word “TODO” in the comments–that being a sign (according to the reviewer) that the module was unfinished. I withdrew my submission.