public static function write($file, $content, $mode = 0666)
{
static::createDir(dirname($file));
if (@file_put_contents($file, $content) === FALSE) {
// @ is escalated to exception
throw new Nette\IOException("Unable to write file '{$file}'.");
}
if ($mode !== NULL && !@chmod($file, $mode)) {
// @ is escalated to exception
throw new Nette\IOException("Unable to chmod file '{$file}'.");
}
}