Changeset 242
- Timestamp:
- 09/26/07 15:39:45 (10 months ago)
- Files:
-
- branches/2.3/classes/phing/tasks/system/ChmodTask.php (modified) (6 diffs)
- trunk/classes/phing/tasks/system/ChmodTask.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/2.3/classes/phing/tasks/system/ChmodTask.php
r144 r242 43 43 private $quiet = false; 44 44 private $failonerror = true; 45 45 private $verbose = true; 46 46 47 /** 47 48 * This flag means 'note errors to the output, but keep going' … … 61 62 $this->failonerror = false; 62 63 } 64 } 65 66 /** 67 * Set verbosity, which if set to false surpresses all but an overview 68 * of what happened. 69 */ 70 function setVerbose($bool) { 71 $this->verbose = (bool)$bool; 63 72 } 64 73 … … 127 136 } 128 137 138 // counters for non-verbose output 139 $total_files = 0; 140 $total_dirs = 0; 141 129 142 // one file 130 143 if ($this->file !== null) { 144 $total_files = 1; 131 145 $this->chmodFile($this->file, $mode); 132 146 } … … 141 155 $srcDirs = $ds->getIncludedDirectories(); 142 156 143 for ($j = 0, $filecount = count($srcFiles); $j < $filecount; $j++) { 157 $filecount = count($srcFiles); 158 $total_files = $total_files + $filecount; 159 for ($j = 0; $j < $filecount; $j++) { 144 160 $this->chmodFile(new PhingFile($fromDir, $srcFiles[$j]), $mode); 145 161 } 146 162 147 for ($j = 0, $dircount = count($srcDirs); $j < $dircount; $j++) { 163 $dircount = count($srcDirs); 164 $total_dirs = $total_dirs + $dircount; 165 for ($j = 0; $j < $dircount; $j++) { 148 166 $this->chmodFile(new PhingFile($fromDir, $srcDirs[$j]), $mode); 149 167 } 168 } 169 170 if (!$this->verbose) { 171 $this->log('Total files changed to ' . vsprintf('%o', $mode) . ': ' . $total_files); 172 $this->log('Total directories changed to ' . vsprintf('%o', $mode) . ': ' . $total_dirs); 150 173 } 151 174 … … 164 187 try { 165 188 $file->setMode($mode); 166 $this->log("Changed file mode on '" . $file->__toString() ."' to " . vsprintf("%o", $mode)); 189 if ($this->verbose) { 190 $this->log("Changed file mode on '" . $file->__toString() ."' to " . vsprintf("%o", $mode)); 191 } 167 192 } catch (Exception $e) { 168 193 if($this->failonerror) { … … 176 201 } 177 202 203 trunk/classes/phing/tasks/system/ChmodTask.php
r144 r242 43 43 private $quiet = false; 44 44 private $failonerror = true; 45 45 private $verbose = true; 46 46 47 /** 47 48 * This flag means 'note errors to the output, but keep going' … … 61 62 $this->failonerror = false; 62 63 } 64 } 65 66 /** 67 * Set verbosity, which if set to false surpresses all but an overview 68 * of what happened. 69 */ 70 function setVerbose($bool) { 71 $this->verbose = (bool)$bool; 63 72 } 64 73 … … 127 136 } 128 137 138 // counters for non-verbose output 139 $total_files = 0; 140 $total_dirs = 0; 141 129 142 // one file 130 143 if ($this->file !== null) { 144 $total_files = 1; 131 145 $this->chmodFile($this->file, $mode); 132 146 } … … 141 155 $srcDirs = $ds->getIncludedDirectories(); 142 156 143 for ($j = 0, $filecount = count($srcFiles); $j < $filecount; $j++) { 157 $filecount = count($srcFiles); 158 $total_files = $total_files + $filecount; 159 for ($j = 0; $j < $filecount; $j++) { 144 160 $this->chmodFile(new PhingFile($fromDir, $srcFiles[$j]), $mode); 145 161 } 146 162 147 for ($j = 0, $dircount = count($srcDirs); $j < $dircount; $j++) { 163 $dircount = count($srcDirs); 164 $total_dirs = $total_dirs + $dircount; 165 for ($j = 0; $j < $dircount; $j++) { 148 166 $this->chmodFile(new PhingFile($fromDir, $srcDirs[$j]), $mode); 149 167 } 168 } 169 170 if (!$this->verbose) { 171 $this->log('Total files changed to ' . vsprintf('%o', $mode) . ': ' . $total_files); 172 $this->log('Total directories changed to ' . vsprintf('%o', $mode) . ': ' . $total_dirs); 150 173 } 151 174 … … 164 187 try { 165 188 $file->setMode($mode); 166 $this->log("Changed file mode on '" . $file->__toString() ."' to " . vsprintf("%o", $mode)); 189 if ($this->verbose) { 190 $this->log("Changed file mode on '" . $file->__toString() ."' to " . vsprintf("%o", $mode)); 191 } 167 192 } catch (Exception $e) { 168 193 if($this->failonerror) { … … 176 201 } 177 202 203
