Temporary Securing Drupal through Basic Auth in settings.php

We needed to protect our production site from prying eyes for a while with a basic authentication. Using apache basic auth settings seemed not enough. Or actually was too much. We wanted the theme to blend in. So these files were not supposed to get protected. Only our Drupal pages should.

The solution came from http://php.net/manual/en/features.http-auth.php. Adding the following to sites/default/settings.php makes the customer happy and drush too.

Dumping all tables with drush

I want a clean database without clicking.

echo "\
SELECT concat('drop table ', table_name, ';') \
  FROM information_schema.tables \
  WHERE table_schema=schema()" \
| `drush sql-connect` \
| grep "^drop table " \
| `drush sql-connect`

This work only for single drupal / single schema installs.

nationalise your site with enlisted variables

With drupal we can enable the locale module and install the i18n module to internationalise and translate our site we can make our hands dirty by visiting the http://build2be.com/admin/build/translate/search.

Still our work is not finished yet. We have to dive into settings.php to translate more strings of our site.

Taken from http://drupal.org/node/275705#comment-1058360 and using http://drupal.org/projects/drush_sm we learn we may choose from a lot of variables.

Block the Builder presentation at Drupal Jam 2009-06-26 Utrecht

This book is about what step I took to prepare the (temporary) demo site and what my presentation is about. Bob the Builder

Relocating the files directory

Trying best practices I occasionally move the files directory from DRUPAL_ROOT/files/my-site.com to DRUPAL_ROOT/sites/my-sites/files

Doing this has some implications for the files table content. All file-path are pointing to the wrong location.

Quick solution for this is an mysql replace update query.

select replace(filepath, 'files/my-site/', 'sites/my-site/files/') from files;
# update files set filepath=replace(filepath, 'files/my-site/', 'sites/my-site/files/')"

Or through drush

My development environment so far

Intro

These are my notes when doing my first (drupal) presentation @ FrOSCon 2008 Drupal Room This method uses the concepts
  1. All drupal sites in directory www
  2. All site-config in a separate directory
  3. All site-data in a separate directory
This way an upgrade to another drupal version runs smoothly. Hmmm this was about developer environment.

Add new local domain

Why do I need this? To make sites like http://nf.test http://nf.dev or http://froscon.demo sudo su - echo 127.0.0.254 froscon.demo >> /etc/hosts

Configuring ubercart

So you want to have a shopping cart. With drush_mm it's a snap.

drush --verbose mm enable uc_cart

Using verbose output this shows

Given module names: 'uc_cart'
The following modules will be enabled: 'tapir, uc_store, token, workflow_ng, ubrowser, uc_order, uc_product, uc_cart'
Installing modules
Enabling (and mayby installing) module: tapir
Enabling (and mayby installing) module: uc_store
Enabling (and mayby installing) module: token
Enabling (and mayby installing) module: workflow_ng
Enabling (and mayby installing) module: ubrowser

Installing ubercart through drush pm and mm

It's quite neat using drush to install ubercart. Here is what I did.

Preparation

  1. Install drupal 5.x
  2. Install your site/database
  3. download and install drush
  4. download and install update_status
  5. if you want to follow along install this patch for the module manager
  6. Enable the above modules. For a list see below.

Installing

    graphviz or hypergraph

    Dependency graph
    When making these images about modules i use graphviz to render them. But just ran into http://drupal.org/project/hypergraph which looks great. So I have to study this one! Commands to render a .dot file are ie with non overlapping nodes
    neato -Goverlap=false -o my.neato.png -T png my.dot
    or for a top down graph.
    dot -T png -o my.dot.png my.dot
    The attached image is an installation with the jstools, cck, views, drush, og in order to get faster user experiences. View the full image

    Modules in err

    Installing modules with drush is easy.
    # drush pm install ubercart
    My drush patch for a module manager makes it more easier to SEE what's installed. listing# drush mm list imagary# drush mm dot | dot -T png -o ~/graph.png shows a module in error. (I deleted workflow_ng) scroll to the right for red