Drupal tips

Drupal 6 to 7 upgrades

Stragegy

  • download no-core version
  • replace all modules in repo with symbolic links
  • create standard Drupal 7 site
  • link openatrium directory into profiles/openatrium
  • install site using openatrium install profile
dget install openatrium 7.x-2.19-no-core d7paths
grep memory_limit /etc/php.ini       #should be >= 256M
grep max_allowed_packet /etc/my.cnf  #should be >= 32M (add under [mysqld]}
  • Go through OA contrib modules and any we have already replace with the one in the repo
mod=/opt/dr7/contrib/modules
oa=$mod/openatrium

function repoa {
  rm -Rf $oa/modules/contrib/$1
  ln -sfn $mod/$1 $oa/modules/contrib/
  echo replaced $oa/modules/contrib/$1
}

repoa admin
repoa admin_menu
repoa ctools
repoa date
repoa devel
repoa diff
repoa entity
repoa entityreference
repoa features
repoa feeds
repoa field_group
#repoa flag #older version in repo
repoa google_analytics
repoa job_scheduler
repoa jquery_update
repoa libraries
repoa link
#repoa media #older version in repo
repoa media_vimeo
repoa media_youtube
repoa menu_block
repoa node_clone
repoa pathauto
repoa strongarm
repoa token
repoa uuid
repoa views
repoa views_bulk_operations
repoa wysiwyg
ls -al $oa/modules/contrib #check
  • Finally create the site and link in the OA profile
s=/home/andrew/atrium
dr7=/opt/dr7/core
dsite create $s -u atrium.isnew.org -C "OpenAtrium Demo"
dsite remove $s common #so as not to duplicate
rm -f $s/profiles
mkdir -p $s/profiles
ln -sfn $oa $s/profiles
ln -sfn $dr7/profiles/minimal $s/profiles
ln -sfn $dr7/profiles/standard $s/profiles
ln -sfn $dr7/profiles/testing $s/profiles
  • Now go ahead and visit the site to install it
dsite secure $s

The "Support" module on Drupal

Some notes on configuring the module

  • Follow the online instructions, but also
    • set the support content type not to be on the front page
    • set the from email address to be do-not-reply@mydomain
    • Default sort: State/ascending
    • Secondary sort: Last update/descending
    • Modify the new and updated ticket email to be something like this:

Deleting large numbers of comments from Drupal

  • You can easily delete all comments with:
DELETE FROM comments;
  • The problem comes when there are good and bad comments, and you only want to get the bad comments. -The cleanest way is to delete all the rogue users first. That will set the UID on their comments to 0, so you can delete all their comments by running:
DELETE FROM comments WHERE uid=0;

Resources for creating a new drupal module

This is my quick reference of useful links
Module developer's guide: http://drupal.org/developing/modules
Coding standards: http://drupal.org/coding-standards
Doxygen and comment formatting conventions: http://drupal.org/node/1354
Apply for contributions CVS access: http://drupal.org/cvs-application/requirements
and then: http://drupal.org/cvs-application

Themeing CCK output in Drupal

There seem to be several ways of getting CCK fields into your node-typename-node.tpl.php file:

  • First using the _rendered variable which will give both the label and the content: <?php print $field_website_rendered; ?>
  • Second using 'view' which will just give the contents of the field:<?php print $field_website[0]['view']; ?>
  • Two methods recommended by Front End Drupal. First using 'safe': <?php print $node->field_website[0]['safe']; ?> seems to fail all the time

Class 'XMLWriter' not found

In a Red Hat or CentOS server installation, XMLwriter may not be enabled by default. To enable it, follow these steps:

# If you are using the base 5.1.6 php, then
yum -y install php-xml

#if you are using php 5.2 (from the centos 5 testing repo)
yum -y --enablerepo=c5-testing install php-xml

#restart apache
service httpd restart

Drupal and PHP 5.3

There are some problems with running Drupal on php 5.3. There are five kinds of solutions:

  1. Downgrade to php 5.2.6 (not possible in many situations)
  2. modify Drupal to change the error level reporting
  3. find the latest patches to fix the problems
  4. hack Drupal core or contrib yourself to fix the errors (Drupal 6 is already compliant, but not D5)
  5. put a timezone in your php.ini to get rid of timezone errors

Drupal 6

2. Modify Drupal's error reporting --already done for Drupal 6

3. Find patches

Website Releases via Subversion (SVN)

This article was originally posted at:
http://labs.redbd.net/blog/index.cfm/2006/7/5/Website-Releases-via-Subversion-SVN
but this site now seems to be dead, so I have recovered it from archive.org and re-posted it.

If I am breaking any copyrights here, please let me know and I will remove it.

Note that Drupal now blocks any path containing "svn-base". See: http://drupal.org/node/28776


Posted At : July 5, 2006 9:54 PM By : Mark

Planet Drupal links

Useful links to posts on Planet Drupal that I want to remember for later:
How To: Create a Drupal Calendar http://gotdrupal.com/videos/drupal-calendar
33 Most Useful Domain Tools http://mogdesign.eu/blog/33-most-useful-domain-tools/
Top Notch Themes pre-releases a landmark theme called Fusion http://chrisshattuck.com/blog/top-notch-themes-pre-releases-landmark-the...
A simple Drupal internal linking strategy http://chrisshattuck.com/blog/i-can-haz-some-google-love-simple-drupal-i...

Managing Acquia Drupal with dget, dsite and dsvn

#place to put dget scripts

DGETDIR=/root/dget


#get dget suite and install it, editing settings.sh if necessary

svn co http://drupal-get.svn.sourceforge.net/svnroot/drupal-get/trunk $DGETDIR
cp $DGETDIR/rename_to_settings.sh $DGETDIR/settings.sh
$DGETDIR/setup.sh $DGETDIR

#check out drupal core, contrib

dsvn checkout

#use dsite checkout if no need to commit from this site
#and optionally, the Acquia distribution (ignore any warning at the end)

dsvn checkout x x a6paths

Syndicate content