Subscribe to Syndicate

Drupal Developer and Systems Administrator

Support for your Drupal Website


paulbooker's picture

Managing features from the command line (Quick summary )

To revert all features ..

drush fra -y
drush cc all

To revert a specific feature..

drush fr -y feature
drush cc all

If a feature has been overridden, it can be reverted. This means that the version in the database is destroyed and the version defined in code, in your feature, is used.

If you're deploying a feature to one of you servers you would ..

git pull
drush fra -y 
drush cc all

To update your feature ..

paulbooker's picture

Write Drupal Logs to Rsyslog

Install rsyslog on your web server (should already be installed)

Enable the syslog module in Drupal
To allow Drupal to log to rsyslog, you have to enable the Drupal syslog module. Syslog is included with Drupal core.

Configure the Drupal module
In admin/config/development/logging , you can select one of the following prefixes for your website:


paulbooker's picture

Intercepting Emails Using the Devel Module.

$conf['mail_system'] = array(
'default-system' => 'DevelMailLog',

Adding the above to settings.php will tell Drupal to use the DevelMailLog class as the default mail system. Once you have fired off a few emails go to the temporary directory, and you should see a folder called devel-mails full of logged emails.

Flush the site cache after modifying settings.php.

Other potential solutions for intercepting mail might involve using the Reroute Email module or the hook_mail_alter() hook in your own module.

paulbooker's picture

How to Get Better Performance when Using .htaccess Files

To get a better website performance you can tell apache where to find your websites .htaccess files instead of letting apache search for them recursively ..

First find the location of these .htaccess files on your web server ..

@paulbooker:/var/www/vhosts/ find . -name .htaccess

.. and then add a directory block for each in your domains apache configuration file ..

paulbooker's picture

Examples of using EntityFieldQuery in Drupal 7

function artwork_page_listing_recent() {
  content = array();
  $query = new EntityFieldQuery();
    ->entityCondition('entity_type', 'artwork')
    ->propertyOrderBy('created', 'DESC')
  $result = $query->execute();
  $artworks = artwork_load_multiple(array_keys($result['artwork']));
  foreach ($artworks as $artwork) {
    $content[] = artwork_page_view($artwork, 'teaser');
paulbooker's picture

How To Recover a Deleted File From Your Git Repository

First if you're not sure of the name of the deleted file check through your Git log ..

git log --diff-filter=D --summary

Find the last commit that affected the given file

git rev-list -n 1 HEAD -- ./path/to/file/

.. I'll refer to that as REVISON_NUMBER

Now we can checkout the previous revision

git checkout REVISON_NUMBER^ -- ./path/to/file/
paulbooker's picture

How to give your Drupal site a Canonical URL

You will need to modify your .htaccess file located under your web root.

Change ..

 # To redirect all users to access the site WITH the 'www.' prefix,
  # ( will be redirected to
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} .
  # RewriteCond %{HTTP_HOST} !^www\. [NC]
  # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

to ..

paulbooker's picture

Best practices: Configuration of settings.php on a development server

$conf['file_public_path'] = '/path/to/public/files/directory';
$conf['file_private_path'] = '/path/to/private/files/directory';
$conf['file_temporary_path'] = '/path/to/tmp/directory';
$conf['securepages_enable'] = FALSE;
$conf['devel_enable'] = TRUE;
$conf['reroute_email_enable'] = TRUE;
$conf['cache'] = FALSE; //page cache
$conf['block_cache'] = FALSE; //block cache
$conf['preprocess_css'] = FALSE; //optimize css
$conf['preprocess_js'] = FALSE; //optimize javascript
$conf['less_devel'] = TRUE; //enable less
$conf['less_watch'] = TRUE; //enable less
Subscribe to RSS - drupalplanet