public static function createDir($dir, $mode = 0777)
{
if (!is_dir($dir) && !@mkdir($dir, $mode, TRUE) && !is_dir($dir)) {
// @ - dir may already exist
throw new Nette\IOException("Unable to create directory '{$dir}'. " . error_get_last()['message']);
}
}
/** * backup single database table to file * * @param string $table * @param string $path */ public function backupTableToFile(string $table, string $path) { $sql = $this->getHeader(); $sql .= $this->backupTable($table); FileSystem::createDir($path); $path .= '/' . $table . '_' . date('Y-m-d_H-i-s') . '.sql'; FileSystem::write($path, $sql); }