Drupal

MySQL backup script

Anyone running a MySQL database needs to make regular database dumps so that the database can be easily backed up. I have used several scripts in the past to dump MySQL databases to a file. The script I am posting here was originally based on a blog post by Sonia Hamilton. Sonia's post shows a nice basic script, but I have gradually made several revisions.

Files: 

Drupal Services

Case One Technologies provides Drupal consulting and development. Some of the services provided are:

  • Site install and configuration
  • Custom module development
  • Development of features and bug fixes for existing modules
  • Experienced with custom field modules (see this example)

Contact Case One Technologies to learn how we can help you with your Drupal project.

Javascript field modifications in Drupal

Here is a quick little code snippet that can be added to a hook_form_alter() function in Drupal. It adds a little Javascript to automatically set a field value to upper-case.

// Modify this array to show the actual field names in your form.
    $uppercase_fields = array(
      'field_textfield1',
      'field_textfield2',
      'field_textfield3',
      );
    foreach($uppercase_fields as $delta => $item) {
      $filter .= "input:text[@name^=$item],";
    }
    drupal_add_js("
      $(document).ready(function () {
        $('$filter').change(function() {

Simple Drupal core updates

If you have terminal access to your Drupal website many administration tasks become much easier with a little familiarity with the command line. Here are two commands that I use to easily update the Drupal core files on a site.

First, we want to delete all files except the "sites" directory and the ".htaccess" file. This command takes care of that (note, the .htaccess file is hidden so it isn't returned by the ls command).
rm -R `ls --hide=sites`

Then we will extract the files from the Drupal core tarball.
tar --strip 1 -xzf path/to/drupal-6.xx.tar.gz

Drupal 6 Image Handling

Images are an important part of most websites. When a lot of people successfully complete their first Drupal install, they are surprised to see that there is no image handling built-in. (BTW, this is resolved in Drupal 7.) There are many contributed modules on drupal.org related to image handling and it can be confusing and overwhelming to figure out which ones you need. The purpose of this post is to help new Drupal users to put the correct pieces together for robust and expandable image handling.

Here is the list of modules to enable image handling in Drupal 6.

Slow Menu Rebuild in Drupal

I manage a Windows server that is running Drupal and I recently had trouble with extremely slow database writes. This problem was the most pronounced when I loaded the Modules page (admin/build/modules). The Modules page load took more than 1 minute. At the same time the database was locked preventing any other page from loading. After looking at the database process list I could see numerous update queries on the menu_links and menu_router tables.

Drupal Clean URLs on Windows

This post is a follow-up to my previous blog entry Drupal Installation on Windows.

I am going to explain the steps to enable Clean URLs when using Drupal installed with Wampserver 2. I will assume that you followed the steps listed in the Drupal installation on Windows post and have Drupal running successfully with Wampserver. So let's get into it.

Drupal Installation on Windows

This post is to give a brief overview of the Drupal installation process on Windows. This setup works well as a test or development environment.

  1. Install wamp server (from wampserver.com) Edit: The latest version of wampserver doesn't work with Drupal. See the note at the end of this post.
  2. Download Drupal. You can use either Drupal core from Drupal.org or Acquia Drupal from acquia.com.
Syndicate content