com web/rmtools: fix removal of temporary dirs containing .git folder: client/include/PickleBuildVC.php client/script/pickle.php
| From: | Anatol Belski | Date: | Thu, 07 May 2015 21:41:33 +0000 |
| Subject: | com web/rmtools: fix removal of temporary dirs containing .git folder: client/include/PickleBuildVC.php client/script/pickle.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-25988@lists.php.net to get a copy of this message | ||
Commit: eea1dea234b03596581c8d6b0c4fac87aca7c0dc
Author: Anatol Belski <ab@php.net> Thu, 7 May 2015 23:41:33 +0200
Parents: 2af555827864c13acebc203086a70e03a2cbd20d
Branches: master pecl_legacy
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=eea1dea234b03596581c8d6b0c4fac87aca7c0dc
Log:
fix removal of temporary dirs containing .git folder
Changed paths:
M client/include/PickleBuildVC.php
M client/script/pickle.php
Diff:
diff --git a/client/include/PickleBuildVC.php b/client/include/PickleBuildVC.php
index 5c840d9..00dbe8a 100644
--- a/client/include/PickleBuildVC.php
+++ b/client/include/PickleBuildVC.php
@@ -117,6 +117,18 @@ class PickleBuildVC
function clean()
{
if (is_dir($this->int_dir)) {
+ /* XXX something seems to be missing in unlink(), .git has some ACLs so then
+ PHP cannot handle the removal of the several items in it. Using the
+ system commando helps with that. */
+ $items = scandir($this->int_dir);
+ foreach ($items as $item) {
+ $dir = "{$this->int_dir}/$item";
+
+ if (is_dir("$dir/.git")) {
+ @shell_exec("del /F /S /Q /A " . realpath($dir) . DIRECTORY_SEPARATOR .
".git");
+ }
+ }
+
rmdir_rf($this->int_dir);
}
}
diff --git a/client/script/pickle.php b/client/script/pickle.php
index b13c312..f9301a1 100644
--- a/client/script/pickle.php
+++ b/client/script/pickle.php
@@ -99,7 +99,6 @@ foreach ($builds as $build_name) {
if ($ret["return_value"]) {
- /* XXX build->clean() is gonna remove all the temp files, pack the logs before */
$build->clean();
$ext->cleanup();
$was_errors = true;