From 480085792ba69d5f96b3b9b694611f2c12e229ce Mon Sep 17 00:00:00 2001 From: Adrian Rossouw <adrian@developmentseed.org> Date: Tue, 18 Mar 2008 23:07:11 +0000 Subject: [PATCH] fixed some issues relating to creation of paths. the commands worked, but the validation was wrong. --- provision.inc | 13 ++++++++----- provision.module | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/provision.inc b/provision.inc index 79c0008a3..18bf8fff5 100644 --- a/provision.inc +++ b/provision.inc @@ -492,17 +492,20 @@ function provision_check_path($path, $type, $test = true, $succeed_message = '', break; case "is_dir" : $value = is_dir($path); break; - case "owner" : $value = fileowner($path); + case "owner" : $info = posix_getpwuid(fileowner($path)); + $value = $info['name']; break; case "group" : $value = filegroup($path); break; case "mkdir" : $value = mkdir($path, 0770, true); break; - case "chmod" : chmod($path, $test); - $value = sprintf("%o", fileperms($path)); + case "chmod" : chmod($path, $test); + $test = (int) sprintf('%o', $test); # needs to be reset to oct + $value = (int) substr(sprintf('%o', fileperms($path)), -4); break; case "chown" : chown($path, $test); - $value = fileowner($path); + $info = posix_getpwuid(fileowner($path)); + $value = $info['name']; break; case "chgrp" : chgrp($path, $test); $value = filegroup($path); @@ -527,4 +530,4 @@ function provision_check_path($path, $type, $test = true, $succeed_message = '', } } return $status; -} \ No newline at end of file +} diff --git a/provision.module b/provision.module index f82775a8e..c3b1005fd 100644 --- a/provision.module +++ b/provision.module @@ -576,8 +576,8 @@ function _provision_verify($url = '') { t("Could not change ownership <code>%path</code>", array("%path" => $path)), PROVISION_PERM_ERROR | PROVISION_FRAMEWORK_ERROR ); provision_check_path($path, "chmod", 0700, - t("Changed permissions of <code>%path</code> to %perms", array("%path" => $path, '%perms' => 0700)), - t("Could not change ownership <code>%path</code> to %perms", array("%path" => $path, '%perms' => 0700)), + t("Changed permissions of <code>%path</code> to %perms", array("%path" => $path, '%perms' => sprintf('%o', 0700))), + t("Could not change ownership <code>%path</code> to %perms", array("%path" => $path, '%perms' => sprintf('%o', 0700))), PROVISION_PERM_ERROR | PROVISION_FRAMEWORK_ERROR ); $data = array(); -- GitLab