Closed (fixed)
Project:
Drush
Component:
SQL
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
6 Feb 2012 at 15:35 UTC
Updated:
24 Feb 2012 at 07:20 UTC
Jump to comment: Most recent file
I threw together a post-sync hook to enable my development modules after sql-sync -- something I've been planning on doing for 1+ years now, maybe? My plan was to put it in Drush extras, or maybe an example in drush.api.php, but then I wondered if folks might want this in Drush core, as a standard feature of core-rsync? Could be generally useful.
Usage:
$aliases['dev'] = array (
'root' => '/srv/www/drupal',
'uri' => 'site.com',
'target-command-specific' => array(
'sql-sync' => array(
'enable' => array('devel', 'hacked'),
),
),
);
Here's the hook; it could easily be moved to sync.sql.inc, if desired.
function sync_extras_drush_help_alter(&$command) {
if ($command['command'] == 'sql-sync') {
$command['options']['enable'] = "Enable the specified modules in the target database after the sync operation has completed.";
}
}
function drush_sync_extras_post_sql_sync($source = NULL, $destination = NULL) {
$modules_to_enable = drush_get_option_list('enable');
if (!empty($modules_to_enable)) {
drush_log(dt("Enable !modules post-sql-sync", array('!modules' => implode(',', $modules_to_enable))), 'ok');
drush_invoke_process($destination, 'pm-enable', $modules_to_enable, array('yes' => TRUE));
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | drush-disable-modules-after-sql-sync-1430130-5.patch | 2.92 KB | juampynr |
| #4 | drush-disable-modules-after-sql-sync-1430130-4.patch | 2.41 KB | juampynr |
Comments
Comment #1
moshe weitzman commentedPerhaps a small commandfile in /examples. And add some mentions from other docs.
I don't really want to add it into sql-sync itself as --sanitize is already a bit of an intrusion on the core functionality.
Comment #2
greg.1.anderson commentedAdded comments and committed as examples/sync_enable.drush.inc; added a drush topic to print it, and listed that topic in the 'topics' for `drush help sql-sync`.
Comment #3
mortona2k commentedWorks great, thank you!
Comment #4
juampynr commentedHere is a patch that adds an option to disable modules such as Secure Pages or Logging and Alerts.
Comment #5
juampynr commentedOops, missed to update the last doc block. Here is an updated patch.
Comment #6
moshe weitzman commentedComment #7
greg.1.anderson commentedUseful addition; thanks.