Last active
December 24, 2015 02:39
-
-
Save jdillick/6731777 to your computer and use it in GitHub Desktop.
Revisions
-
jdillick revised this gist
Sep 27, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ // paths to search for drupal sites $paths = array( '/var/www/multisites/', '/var/www/schoolyard/', ); $new_aliases = array(); -
jdillick revised this gist
Sep 27, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ <?php // the current environment $env = $_ENV['ENVTYPE'] ? $_ENV['ENVTYPE'] : ''; // paths to search for drupal sites $paths = array( -
jdillick revised this gist
Sep 27, 2013 . 1 changed file with 16 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,7 @@ '/var/www/schoolyard/' ); $new_aliases = array(); foreach ( $paths as $path ) { $dh = opendir($path); while ( $file = readdir($dh) ) { @@ -29,7 +30,7 @@ // skip ./, ../, all/, and default/ directories if ( is_dir($sitepath) && ! in_array($site, array('default', '.', '..', 'all')) ) { // construct the site alias from the environment and domain $new_aliases[$file][$site] = array( 'root' => $fullname . ($has_webroot ? '/webroot/' : '/'), 'uri' => (strpos($fullname, 'schoolyard') ? "http://$site" : "http://$env.$site"), ); @@ -38,3 +39,17 @@ } } } foreach ( $new_aliases as $file => $sites ) { // single site drupal install if ( count($sites) == 1 ) { $aliases[$file] = reset($sites); } // multisite drupal install else { foreach ( $sites as $name => $site ) { list($prefix, $suffix) = explode('.', $name); $aliases[$file . "." . $prefix] = $site; } } } -
jdillick revised this gist
Sep 27, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ if ( is_dir($sitepath) && ! in_array($site, array('default', '.', '..', 'all')) ) { // construct the site alias from the environment and domain $aliases[$file] = array( 'root' => $fullname . ($has_webroot ? '/webroot/' : '/'), 'uri' => (strpos($fullname, 'schoolyard') ? "http://$site" : "http://$env.$site"), ); } -
jdillick revised this gist
Sep 27, 2013 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,11 +14,13 @@ $fullname = "$path$file"; // skip files, current directory, and parent directory if ( strpos($file, '.') === 0 || ! is_dir($fullname) ) continue; // look for sites or webroot/sites directories in path $has_webroot = file_exists($fullname . '/webroot/sites/'); $has_sites = file_exists($fullname . '/sites/'); if ( $has_webroot || $has_sites ) { $sites = $fullname . ($has_sites ? '/sites/' : '/webroot/sites/'); $sh = opendir($sites); // look for domain.tld directory in sites @@ -29,7 +31,7 @@ // construct the site alias from the environment and domain $aliases[$file] = array( 'root' => $fullname . "/", 'uri' => (strpos($fullname, 'schoolyard') ? "http://$site" : "http://$env.$site"), ); } } -
jdillick revised this gist
Sep 27, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ $fullname = "$path$file"; // skip files, current directory, and parent directory if ( strpos('.', $file) === 0 || ! is_dir($fullname) ) continue; // look for sites or webroot/sites directories in path if ( file_exists($fullname . '/sites/') || file_exists($fullname . '/webroot/sites/') ) { -
jdillick revised this gist
Sep 27, 2013 . 1 changed file with 8 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,18 +4,21 @@ // paths to search for drupal sites $paths = array( '/var/www/multisites/', '/var/www/schoolyard/' ); foreach ( $paths as $path ) { $dh = opendir($path); while ( $file = readdir($dh) ) { $fullname = "$path$file"; // skip files, current directory, and parent directory if ( strpos('.', $file) !== 0 || ! is_dir($fullname) ) continue; // look for sites or webroot/sites directories in path if ( file_exists($fullname . '/sites/') || file_exists($fullname . '/webroot/sites/') ) { $sites = $fullname . (file_exists($fullname . '/sites/') ? '/sites/' : '/webroot/sites/'); $sh = opendir($sites); // look for domain.tld directory in sites -
jdillick created this gist
Sep 27, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ <?php // the current environment $env = $_ENV['ENVTYPE']; // paths to search for drupal sites $paths = array( $_ENV['HOME'] . '/clones/', $_ENV['HOME'] . '/sandboxes/drupal/' ); foreach ( $paths as $path ) { $dh = opendir($path); while ( $file = readdir($dh) ) { $fullname = "$path$file"; // look for sites directories in path if ( strpos('.', $file) === FALSE && is_dir($fullname) && file_exists($fullname . '/sites/') ) { $sites = $fullname . '/sites/'; $sh = opendir($sites); // look for domain.tld directory in sites while ( $site = readdir($sh) ) { $sitepath = $sites . $site; // skip ./, ../, all/, and default/ directories if ( is_dir($sitepath) && ! in_array($site, array('default', '.', '..', 'all')) ) { // construct the site alias from the environment and domain $aliases[$file] = array( 'root' => $fullname . "/", 'uri' => "http://$env.$site", ); } } } } }