Commit 96337f5b authored by anarcat's avatar anarcat Committed by anarcat

make directory create script cleaner by splitting owner/group modifications

parent 65a4b91a
...@@ -225,21 +225,23 @@ function _provision_drupal_create_directories($url, $profile = NULL) { ...@@ -225,21 +225,23 @@ function _provision_drupal_create_directories($url, $profile = NULL) {
"sites/$url/modules" => 0775, "sites/$url/modules" => 0775,
"sites/$url/libraries" => 0775, # http://drupal.org/node/496240 "sites/$url/libraries" => 0775, # http://drupal.org/node/496240
); );
$chown = array();
$chgrp = array();
// special case: platform. do not handle files dir // special case: platform. do not handle files dir
if ($url == 'all') { if ($url != 'all') {
$chown = array();
} else {
$mkdir["sites/$url/files"] = 02770; $mkdir["sites/$url/files"] = 02770;
$mkdir["sites/$url/files/tmp"] = 02770; $mkdir["sites/$url/files/tmp"] = 02770;
$mkdir["sites/$url/files/images"] = 02770; $mkdir["sites/$url/files/images"] = 02770;
$mkdir["sites/$url/files/pictures"] = 02770; $mkdir["sites/$url/files/pictures"] = 02770;
# the owner/group of those directories will be changed # the owner/group of those directories will be changed
$chown = array( $chown["sites/$url/files"] = drush_get_option('script_user');
"sites/$url/files", $chown["sites/$url/files/tmp"] = drush_get_option('script_user');
"sites/$url/files/tmp", $chown["sites/$url/files/images"] = drush_get_option('script_user');
"sites/$url/files/images", $chown["sites/$url/files/pictures"] = drush_get_option('script_user');
"sites/$url/files/pictures", $chgrp["sites/$url/files"] = drush_get_option('web_group');
); $chgrp["sites/$url/files/tmp"] = drush_get_option('web_group');
$chgrp["sites/$url/files/images"] = drush_get_option('web_group');
$chgrp["sites/$url/files/pictures"] = drush_get_option('web_group');
} }
foreach ($mkdir as $path => $perm) { foreach ($mkdir as $path => $perm) {
...@@ -255,12 +257,14 @@ function _provision_drupal_create_directories($url, $profile = NULL) { ...@@ -255,12 +257,14 @@ function _provision_drupal_create_directories($url, $profile = NULL) {
dt("Could not change permissions <code>@path</code> to @confirm") dt("Could not change permissions <code>@path</code> to @confirm")
); );
} }
foreach ($chown as $path) { foreach ($chown as $path => $owner) {
provision_path("chown_recursive", $path, drush_get_option('script_user'), provision_path("chown_recursive", $path, $owner,
dt("Changed ownership of <code>@path</code>"), dt("Changed ownership of <code>@path</code>"),
dt("Could not change ownership <code>@path</code>"), dt("Could not change ownership <code>@path</code>"),
'DRUSH_PERM_ERROR' ); 'DRUSH_PERM_ERROR' );
provision_path("chgrp_recursive", $path, drush_get_option('web_group'), }
foreach ($chgrp as $path => $group) {
provision_path("chgrp_recursive", $path, $group,
dt("Changed group ownership of <code>@path</code>"), dt("Changed group ownership of <code>@path</code>"),
dt("Could not change group ownership <code>@path</code>")); dt("Could not change group ownership <code>@path</code>"));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment