Skip to content

Instantly share code, notes, and snippets.

@szeidler
Last active January 8, 2016 09:56
Show Gist options
  • Save szeidler/6aa3630e82b23b196a05 to your computer and use it in GitHub Desktop.
Save szeidler/6aa3630e82b23b196a05 to your computer and use it in GitHub Desktop.
drushrc.php
<?php
// Define module download destination.
$site_path = drush_site_path();
$site_path_parts = explode('/', $site_path);
$clean_site_path_parts = array_slice($site_path_parts, -2, 2);
$clean_site_path = implode('/', $clean_site_path_parts);
if (!empty($clean_site_path)) {
$command_specific['dl']['destination'] = $clean_site_path . '/modules/contrib';
}
// Get the site absolute filepath. Extracted from drush_site_path().
function drush_get_absolute_site_path($path = NULL) {
$site_path = FALSE;
$path = empty($path) ? drush_cwd() : $path;
if (file_exists($path . '/settings.php')) {
$site_path = $path;
}
else {
while (($path = _drush_shift_path_up($path)) && !drush_valid_root($path)) {
if (file_exists($path . '/settings.php')) {
$site_path = $path;
break;
}
}
}
return $site_path;
}
$patch_path = drush_get_absolute_site_path() . '/modules/patches/patches.make';
if (file_exists($patch_path)) {
$options['patch-file'] = $patch_path;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment