Commit 98fb236f authored by anarcat's avatar anarcat Committed by anarcat

do not attempt to chown files/ dir during verification

the rationale here is that we're not running as root, and therefore
chown is likely to fail, unless the file already has the right owner,
in which case a chown is not necessary.

To quote chown(2):

       Only a privileged process (Linux: one with the CAP_CHOWN
       capability) may change the owner of a file.  The owner of a
       file may change the group of the file to any group of which
       that owner is a member.  A privileged process (Linux: with
       CAP_CHOWN) may change the group arbitrarily.

So this was just a cause of trouble without any possible benefit
unless we run with capabilities, and we shouldn't assume this (right
now?).
parent 95239c4e
......@@ -171,37 +171,29 @@ function _provision_drupal_create_directories($url = NULL, $profile = NULL) {
"sites/$url/libraries" => 02775, # http://drupal.org/node/496240
);
$chown = array();
$chgrp = array();
// special case: platform. do not handle files dir
if ($url != 'all') {
$mkdir["sites/$url/files"] = 02770;
$chown["sites/$url/files"] = d('@server_master')->script_user;
$chgrp["sites/$url/files"] = d('@server_master')->web_group;
$mkdir["sites/$url/files/tmp"] = 02770;
$chown["sites/$url/files/tmp"] = d('@server_master')->script_user;
$chgrp["sites/$url/files/tmp"] = d('@server_master')->web_group;
$mkdir["sites/$url/files/images"] = 02770;
$chown["sites/$url/files/images"] = d('@server_master')->script_user;
$chgrp["sites/$url/files/images"] = d('@server_master')->web_group;
$mkdir["sites/$url/files/pictures"] = 02770;
$chown["sites/$url/files/pictures"] = d('@server_master')->script_user;
$chgrp["sites/$url/files/pictures"] = d('@server_master')->web_group;
// d7 support
$mkdir["sites/$url/private"] = 02770;
$chown["sites/$url/private"] = d('@server_master')->script_user;
$chgrp["sites/$url/private"] = d('@server_master')->web_group;
$mkdir["sites/$url/private/files"] = 02770;
$chown["sites/$url/private/files"] = d('@server_master')->script_user;
$chgrp["sites/$url/private/files"] = d('@server_master')->web_group;
$mkdir["sites/$url/private/temp"] = 02770;
$chown["sites/$url/private/temp"] = d('@server_master')->script_user;
$chgrp["sites/$url/private/temp"] = d('@server_master')->web_group;
}
......@@ -228,11 +220,6 @@ function _provision_drupal_create_directories($url = NULL, $profile = NULL) {
->succeed('Changed permissions of <code>@path</code> to @perm')
->fail('Could not change permissions <code>@path</code> to @perm');
}
foreach ($chown as $path => $owner) {
provision_file()->chown($path, $owner, !in_array($path, $not_recursive))
->succeed('Changed ownership of <code>@path</code> to @uid')
->fail('Could not change ownership <code>@path</code>', 'DRUSH_PERM_ERROR');
}
foreach ($chgrp as $path => $group) {
provision_file()->chgrp($path, $group, !in_array($path, $not_recursive))
->succeed('Changed group ownership of <code>@path</code> to @gid')
......
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