summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-12-29 12:11:49 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-12-29 12:11:49 -0500
commitc3da36c800ddac04b4e3bf7b80b98962b4bf6a9b (patch)
tree6db33b03baf0ee1167a9f88766449bc7eda0b060
parent2c045c494578c5f74cd448a57c135ffa782e03a7 (diff)
downloadphoronix-test-suite-upstream-c3da36c800ddac04b4e3bf7b80b98962b4bf6a9b.zip
phoronix-test-suite-upstream-c3da36c800ddac04b4e3bf7b80b98962b4bf6a9b.tar.gz
phoronix-test-suite-upstream-c3da36c800ddac04b4e3bf7b80b98962b4bf6a9b.tar.xz
pts-core: Rewrite pts_remove() function
-rw-r--r--CHANGE-LOG1
-rw-r--r--pts-core/functions/pts-functions_shell.php39
2 files changed, 19 insertions, 21 deletions
diff --git a/CHANGE-LOG b/CHANGE-LOG
index f4ce9d4..4732a24 100644
--- a/CHANGE-LOG
+++ b/CHANGE-LOG
@@ -13,6 +13,7 @@ Phoronix Test Suite (Git)
- pts-core: Archive installation output of tests in the test's directory in file install.log
- pts-core: Add install-all-dependencies option to install all available external dependencies for that distribution
- pts-core: When installing or running a test, only print to standard output if under 10KB
+- pts-core: Rewrite pts_remove() function
- pts: Add UXA acceleration check to GtkPerf test note reporting
- pts: Add 2d-test base profile that reports 2D acceleration mode using Cascading Test Profiles
- pts: Add build-mysql test profile for timed build of MySQL 5.1
diff --git a/pts-core/functions/pts-functions_shell.php b/pts-core/functions/pts-functions_shell.php
index ae54a28..7c4c715 100644
--- a/pts-core/functions/pts-functions_shell.php
+++ b/pts-core/functions/pts-functions_shell.php
@@ -77,37 +77,34 @@ function pts_download($download, $to)
}
function pts_remove($object, $ignore_files = null)
{
- if(!file_exists($object))
+ if(is_dir($object) && substr($object, -1) != "/")
{
- return false;
+ $object .= "/";
}
- if(is_file($object))
+ foreach(glob($object . "*") as $to_remove)
{
- if(is_array($ignore_files) && in_array(basename($object), $ignore_files))
+ if(is_file($to_remove))
{
- return true;
+ if(is_array($ignore_files) && in_array(basename($to_remove), $ignore_files))
+ {
+ continue; // Don't remove the file
+ }
+ else
+ {
+ @unlink($to_remove);
+ }
}
- else
+ else if(is_dir($to_remove))
{
- return @unlink($object);
- }
- }
+ pts_remove($to_remove, $ignore_files);
- if(is_dir($object))
- {
- $directory = @dir($object);
- while(($entry = $directory->read()) !== false)
- {
- if($entry != "." && $entry != "..")
- {
- pts_remove($object . "/" . $entry, $ignore_files);
- }
+ //if(count(glob($to_remove . "/*")) == 0)
+ //{
+ @rmdir($object);
+ //}
}
- $directory->close();
}
-
- return @rmdir($object);
}
function pts_copy($from, $to)
{