summaryrefslogtreecommitdiff
path: root/buildscripts/phing/classes/phing/tasks/system/DeleteTask.php
diff options
context:
space:
mode:
Diffstat (limited to 'buildscripts/phing/classes/phing/tasks/system/DeleteTask.php')
-rwxr-xr-x[-rw-r--r--]buildscripts/phing/classes/phing/tasks/system/DeleteTask.php75
1 files changed, 37 insertions, 38 deletions
diff --git a/buildscripts/phing/classes/phing/tasks/system/DeleteTask.php b/buildscripts/phing/classes/phing/tasks/system/DeleteTask.php
index 00e1e7a7..8af8a632 100644..100755
--- a/buildscripts/phing/classes/phing/tasks/system/DeleteTask.php
+++ b/buildscripts/phing/classes/phing/tasks/system/DeleteTask.php
@@ -1,6 +1,6 @@
<?php
/*
- * $Id: DeleteTask.php 59 2006-04-28 14:49:47Z mrook $
+ * $Id: f25fc4c605ead65db9235c9fe328b2d47b7c8299 $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -24,7 +24,7 @@ require_once 'phing/Task.php';
/**
* Deletes a file or directory, or set of files defined by a fileset.
*
- * @version $Revision: 1.13 $
+ * @version $Id: f25fc4c605ead65db9235c9fe328b2d47b7c8299 $
* @package phing.tasks.system
*/
class DeleteTask extends Task {
@@ -36,11 +36,11 @@ class DeleteTask extends Task {
protected $quiet = false;
protected $failonerror = true;
- protected $verbosity = PROJECT_MSG_VERBOSE;
-
- /** Any filelists of files that should be deleted. */
+ protected $verbosity = Project::MSG_VERBOSE;
+
+ /** Any filelists of files that should be deleted. */
private $filelists = array();
-
+
/**
* Set the name of a single file to be removed.
* @param PhingFile $file
@@ -63,9 +63,9 @@ class DeleteTask extends Task {
*/
function setVerbose($verbosity) {
if ($verbosity) {
- $this->verbosity = PROJECT_MSG_INFO;
+ $this->verbosity = Project::MSG_INFO;
} else {
- $this->verbosity = PROJECT_MSG_VERBOSE;
+ $this->verbosity = Project::MSG_VERBOSE;
}
}
@@ -96,12 +96,11 @@ class DeleteTask extends Task {
}
/** Nested creator, adds a set of files (nested fileset attribute). */
- function createFileSet() {
- $num = array_push($this->filesets, new FileSet());
- return $this->filesets[$num-1];
+ function addFileSet(FileSet $fs) {
+ $this->filesets[] = $fs;
}
-
- /** Nested creator, adds a set of files (nested fileset attribute). */
+
+ /** Nested creator, adds a set of files (nested fileset attribute). */
function createFileList() {
$num = array_push($this->filelists, new FileList());
return $this->filelists[$num-1];
@@ -131,38 +130,38 @@ class DeleteTask extends Task {
if($this->failonerror) {
throw new BuildException($message);
} else {
- $this->log($message, $this->quiet ? PROJECT_MSG_VERBOSE : PROJECT_MSG_WARN);
+ $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN);
}
}
}
} else {
- $this->log("Could not find file " . $this->file->getAbsolutePath() . " to delete.",PROJECT_MSG_VERBOSE);
+ $this->log("Could not find file " . $this->file->getAbsolutePath() . " to delete.",Project::MSG_VERBOSE);
}
}
// delete the directory
if ($this->dir !== null && $this->dir->exists() && $this->dir->isDirectory()) {
- if ($this->verbosity === PROJECT_MSG_VERBOSE) {
+ if ($this->verbosity === Project::MSG_VERBOSE) {
$this->log("Deleting directory " . $this->dir->__toString());
}
$this->removeDir($this->dir);
}
-
- // delete the files in the filelists
- foreach($this->filelists as $fl) {
- try {
- $files = $fl->getFiles($this->project);
- $this->removeFiles($fl->getDir($this->project), $files, $empty=array());
- } catch (BuildException $be) {
- // directory doesn't exist or is not readable
- if ($this->failonerror) {
- throw $be;
- } else {
- $this->log($be->getMessage(), $this->quiet ? PROJECT_MSG_VERBOSE : PROJECT_MSG_WARN);
- }
- }
- }
-
+
+ // delete the files in the filelists
+ foreach($this->filelists as $fl) {
+ try {
+ $files = $fl->getFiles($this->project);
+ $this->removeFiles($fl->getDir($this->project), $files, $empty=array());
+ } catch (BuildException $be) {
+ // directory doesn't exist or is not readable
+ if ($this->failonerror) {
+ throw $be;
+ } else {
+ $this->log($be->getMessage(), $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN);
+ }
+ }
+ }
+
// delete the files in the filesets
foreach($this->filesets as $fs) {
try {
@@ -175,7 +174,7 @@ class DeleteTask extends Task {
if ($this->failonerror) {
throw $be;
} else {
- $this->log($be->getMessage(), $this->quiet ? PROJECT_MSG_VERBOSE : PROJECT_MSG_WARN);
+ $this->log($be->getMessage(), $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN);
}
}
}
@@ -204,7 +203,7 @@ class DeleteTask extends Task {
if($this->failonerror) {
throw new BuildException($message);
} else {
- $this->log($message, $this->quiet ? PROJECT_MSG_VERBOSE : PROJECT_MSG_WARN);
+ $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN);
}
}
}
@@ -217,7 +216,7 @@ class DeleteTask extends Task {
if($this->failonerror) {
throw new BuildException($message);
} else {
- $this->log($message, $this->quiet ? PROJECT_MSG_VERBOSE : PROJECT_MSG_WARN);
+ $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN);
}
}
}
@@ -242,7 +241,7 @@ class DeleteTask extends Task {
if($this->failonerror) {
throw new BuildException($message);
} else {
- $this->log($message, $this->quiet ? PROJECT_MSG_VERBOSE : PROJECT_MSG_WARN);
+ $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN);
}
}
@@ -260,11 +259,11 @@ class DeleteTask extends Task {
$dir->delete();
$dirCount++;
} catch (Exception $e) {
- $message="Unable to delete directory " + $dir;
+ $message="Unable to delete directory " . $dir->__toString();
if($this->failonerror) {
throw new BuildException($message);
} else {
- $this->log($message, $this->quiet ? PROJECT_MSG_VERBOSE : PROJECT_MSG_WARN);
+ $this->log($message, $this->quiet ? Project::MSG_VERBOSE : Project::MSG_WARN);
}
}
}