The Linux Page

Advanced Topics about Drupal Development

Managing your own Drupal Download Site

The other day, I was thinking, it would be nice if I could find the way to manage my own download site so people who use my modules that I do not provide directly on https://www.drupal.org would still show as expected (i.e. Green in the update window).

I found this page about it: https://www.drupal.org/node/210984

This is done by creating a service in your Drupal environment. You should use the ready made script named:

project-release-serve-history.php

which you can find in the D6 version of the Drupal project named Project. Being very precautionous they have not been showing the 6.x-1.x-dev version on their front page (or they just did not check marked that box, but I would think that they know what they are doing.) So look here to see the Drupal 6 release:

    https://www.drupal.org/node/3281/release

In the file, look for a folder named project/release and you will see the script in there. Here we are.

The script is used to handle the update_status request from all your users websites.

As mentioned on this Drupal page, you want a .htaccess file to transform the path into a query string:

DirectoryIndex project-release-serve-history.php
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule ^(.*)$ project-release-serve-history.php?q=$1 [L,QSA]
</IfModule>

Place that in a top folder named release-history along with the .php script. The script needs to be edited for the HISTORY variable needs to indicate where to get the XML data from. The script otherwise includes more  technical documentation.

Now, for your projects to access your site instead of the Drupal site (the default), define a variable named "project status url" (yes, with the spaces) in your .info file. Set the URL for your repository such as http://www.example.com/release-history (this is the path to the project-release-serve-history.php script, not to a specific project file!)

You should be mostly set. Now you just need to create and maintain the corresponding XML files. Up to you whether you want to automate that process or not! (if you have one module, you're probably fine. If you have 100...)

Obviously, you will be in full control of the download, and that can be a link to a place where people first have to log in before they can download your module.

Creating Themes that morph depending on the content

This Drupal page describes the methods available to you to change the look of your pages depending on criterias that you choose.

For instance, the node type, comments, blocks, etc. can all change depending on different values that are accessible to the theme and quite many are accessible!

It is interesting because it includes the capability to change pretty much anything. It is in fact used by many of the Drupal modules (search on "template_preprocess" and you will see that there are quite many available.)