Drupal tips

Current Drupal 5 Module versions


#!/bin/bash
#update all drupal modules v1.0 using the dget script
# change d5paths to the path on your system if necessary
source /etc/opt/drupal/d5paths

dget install drupal 5.16 d5paths
dget install image 5.x-2.0-alpha3 d5paths
dget install cck 5.x-1.10 d5paths
dget install views 5.x-1.6 d5paths
dget install forum_access 5.x-1.11 d5paths
dget install update_status 5.x-2.3 d5paths
dget install pathauto 5.x-2.3 d5paths
dget install persistent_login 5.x-1.4-beta4 d5paths

User login from emailed url

I need to send out emails to my users which contain a link such that when they click on it they are taken to a particular page, already logged in. The purpose of this is for tracking response to email newsletters, and for enabling users to quickly and easily verify or update their personal information.
So far in my investigation I have identified the following items that might help:

  1. The Secure Site module: http://drupal.org/project/securesite
  2. The Webserver authentication module: http://drupal.org/project/webserver_auth

Installing Acquia Drupal


#adjust according to needs:
site=/home/l1nk/demo2
version=1.0.2-ISR
build=2988
mydb=aquia
#get the code and install it
wget http://acquia.com/files/downloads/acquia-drupal-$version.$build.tar.gz
mkdir dtemp
tar -zxf acquia-drupal-$version.$build.tar.gz -C dtemp
rm -fR $site
mv dtemp/acquia-drupal-$version $site
rm -fR dtemp
chmod 777 -R $site/sites/default
chmod a+w $site/sites/default/settings.php
#create the database
echo "CREATE DATABASE $mydb CHARACTER SET utf8 COLLATE utf8_unicode_ci;" | mysql -u root -p
#now you can visit the site!

Installing Ubercart with dget

To install Ubercart for Drupal 6 with dget: http://drup.org/drupal-install-symlink
do the following:

  • back up with: dget backup [name of database]
    1. put the file d6uber (below) in the directory /etc/opt/drupal
    2. make sure the token module is installed
    3. dget install ubercart 6.x-2.x-dev d6uber
    4. dget patch /ubercart uc_product_views2.patch d6uber
    5. mkdir $mysite/sites/default/modules
    6. ln -sfn /opt/drupal/uber6 $mysite/sites/default/modules

    Drupal backup script

    First it is necessary to create a backup user on the database which has (only) read access to everything. This is because its password will be embedded in the backup script which reduces security. This can be done with:

    BKUSR=backup
    BKPW=backuppassword
    BKDIR=/var/www/dbbackup
    mkdir -p $BKDIR
    echo "GRANT SELECT, LOCK TABLES ON *.* TO '$BKUSR'@'localhost' IDENTIFIED BY '$BKPW'; FLUSH PRIVILEGES;" | mysql -u root -p

    In the backup script, first some variables are set up

    BKUSR=backup
    BKPW=backuppassword
    BKDIR=/var/www/dbbackup
    SITE=cfaw.info

    Search Engine Optimization in Drupal 6

    Drupal Modules

    • global redirect module
      • makes sure there is only one URL per page (gets rid of node/123 type URLs)
      • simply install—no configuration needed.
      • path_redirect module also needs to be used if you have old urls that you have changed but want to keep the old url address functioning
      • otherwise just make sure there are not multiple aliases for any pages using Site Building/URL aliases/list and sort on “system”

    Rolling a Drupal patch using cvs


    #cd to the root of drupal or root of modules directory
    cvsdir=pserver:anonymous:anonymous@cvs.drupal.org:/cvs/
    cvsfolder=drupal-contrib
    version=DRUPAL-6--2 #usually HEAD , so don't need this option
    version=HEAD
    cvs -d:$cvsdir$cvsfolder diff -up -r $version calendar/calendar.inc > calendar_date_comparison.patch

    To roll a patch using diff
    diff -up path/to/file path_to/new_file > ~/patchname.patch

    Instructions on: http://drupal.org/node/320

    #checkout drupal HEAD into drupal folder in current directory

    Drupal site maintenance using symbolic links

    For an introduction to dget, please look here: http://drup.org/dget

    The dget script

    Here is a script to install Drupal using symbolic links to separate directory trees that contain the Drupal core, the contrib modules and the contrib themes.

    Drupal CVS Checkout Script

    The following script will check out a contrib module or core from Drupal CVS and archive it in case you need to revert in future

    Drupal Module Update Script

    Here is a bash script for updating a Drupal module to a given version and archiving it (in case reversion is needed)

    Syndicate content