
| Current Path : /var/www/html/rocksensor3/vendor/consolidation/robo/src/Task/Logfile/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor3/vendor/consolidation/robo/src/Task/Logfile/TruncateLog.php |
<?php
namespace Robo\Task\Logfile;
use Robo\Result;
/**
* Truncates a log (or any other) file
*
* ``` php
* <?php
* $this->taskTruncateLog(['logfile.log'])->run();
* // or use shortcut
* $this->_truncateLog(['logfile.log']);
*
* ?>
* ```
*/
class TruncateLog extends BaseLogfile
{
/**
* {@inheritdoc}
*/
public function run(): Result
{
foreach ($this->logfiles as $logfile) {
$this->filesystem->dumpFile($logfile, false);
if ($this->chmod) {
$this->filesystem->chmod($logfile, $this->chmod);
}
$this->printTaskInfo("Truncated {logfile}", ['logfile' => $logfile]);
}
return Result::success($this);
}
}