Featured Post

What is the purpose of the php.ini file?

  The PHP configuration file,   php.ini , is the final and most immediate way to affect PHP's functionality. The php.ini file is read ea...

Drupal multi-site Drush aliases configuration

If you're running a multi-site Drupal setup, here's how to set up your Drush aliases to easily run commands for specific sites:
1.Go to drush installed directory cd /home/XXX/.drush
2. Create file aliases.drushrc.php, add the below code for multi-site aliases
$aliases[site1] = array(
'root' => '/var/www/drupal root directory',
'uri' => 'site1.myhost.com',
);
$aliases['site2'] = array(
'root' => '/var/www/drupal root directory',
'uri' => 'site2.myhost.com',
);
$aliases['site3'] = array(
'root' => '/var/www/drupal root directory',
'uri' => 'site3.myhost.com',
);
3. In short: the "root" value for all the sites is the root of your Drupalinstallation. The "uri" value of the alias should match the folder in which the site is stored. To test, you can call drush @site1 status and drush @site2 status to confirm it's accessing in the right directories.
4. Enable a module on each site : drush @site1 en moduleName -y
5. Drush has the ability to interact with each site within a multi-siteinstallation via the @sites argument. Anytime you are within the directory structure of your platform, the drush @sites command will target all sites rather than a single/no site. In this way, any drush task can be accomplished across all sites.
Some concrete examples:
Disable the Backup Migrate module on each site
drush @sites dis backup_migrate -y
Enable the Backup Migrate module on each site
drush @sites en backup_migrate -y

No comments:

Post a Comment

Popular Posts