Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dynamic Drush aliases
<?php
$path = '/var/www';
$driver = 'mysql';
$port = '3306';
$host = '127.0.0.1';
$webroot = '';
$aliases = array();
$dir_handle = new DirectoryIterator($path);
while($dir_handle->valid()) {
if($dir_handle->isDir() && !$dir_handle->isDot()) {
$basename = $dir_handle->getBasename();
$root = $dir_handle->getPathname();
if(strlen($webroot) > 0) {
$root .= '/' . $webroot;
}
if(file_exists($root . '/sites/default/default.settings.php')) {
$aliases[$basename] = array(
'uri' => 'http://localhost/' . $basename,
'root' => $root,
'databases' => array(
'default' => array(
'default' => array(
'driver' => $driver,
'username' => $basename . '_user',
'password' => $basename . '_pass',
'port' => $port,
'host' => $host,
'database' => $basename,
),
),
),
);
}
}
$dir_handle->next();
}
core = 7.x
api = 2
; Core
projects[drupal][version] = "7.34"
projects[drupal][type] = "core"
; Modules
projects[backup_migrate][subdir] = "contrib"
projects[backup_migrate][version] = "2.8"
projects[ctools][subdir] = "contrib"
projects[ctools][version] = "1.6"
projects[devel][subdir] = "contrib"
projects[devel][version] = "1.5"
projects[pathauto][subdir] = "contrib"
projects[pathauto][version] = "1.2"
projects[token][subdir] = "contrib"
projects[token][version] = "1.5"
projects[views][subdir] = "contrib"
projects[views][version] = "3.7"
projects[views][patch][2096013] = "https://www.drupal.org/files/issues/2096013-7.patch"
projects[wysiwyg][subdir] = "contrib"
projects[wysiwyg][version] = "2.2"
; Libraries
libraries[ckeditor][download][type] = "get"
libraries[ckeditor][download][url] = "http://download.cksource.com/CKEditor/CKEditor/CKEditor%203.6.6.1/ckeditor_3.6.6.1.tar.gz"
libraries[ckeditor][directory_name] = "ckeditor"
core: 7.x
api: 2
projects:
drupal:
version: 7.33
backup_migrate:
version: 2.8
subdir: contrib
ctools:
version: 1.6
subdir: contrib
devel:
version: 1.5
subdir: contrib
pathauto:
version: 1.2
subdir: contrib
token:
version: 1.5
subdir: contrib
views:
version: 3.7
subdir: contrib
patch:
- https://www.drupal.org/files/issues/2096013-7.patch
wysiwyg:
version: 2.2
subdir: contrib
libraries:
ckeditor:
download:
type: "file"
url: "http://download.cksource.com/CKEditor/CKEditor/CKEditor%203.6.6.1/ckeditor_3.6.6.1.tar.gz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.