public function purge()
{
if (is_dir($this->filesDir)) {
$iterator = new \RecursiveDirectoryIterator($this->filesDir, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS);
$iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST);
foreach ($iterator as $file) {
chmod($file, 0777);
if (is_dir($file)) {
rmdir($file);
} else {
unlink($file);
}
}
}
$this->connection->exec('DELETE FROM bl_run_unit');
$this->connection->exec('DELETE FROM bl_run');
}