Nette\Bridges\CacheDI\CacheExtension::checkTempDir PHP Метод

checkTempDir() приватный Метод

private checkTempDir ( $dir )
    private function checkTempDir($dir)
    {
        @mkdir($dir);
        // @ - directory may exists
        // checks whether directory is writable
        $uniq = uniqid('_', TRUE);
        if (!@mkdir("{$dir}/{$uniq}")) {
            // @ - is escalated to exception
            throw new Nette\InvalidStateException("Unable to write to directory '{$dir}'. Make this directory writable.");
        }
        // checks whether subdirectory is writable
        $isWritable = @file_put_contents("{$dir}/{$uniq}/_", '') !== FALSE;
        // @ - error is expected
        if ($isWritable) {
            unlink("{$dir}/{$uniq}/_");
        }
        rmdir("{$dir}/{$uniq}");
        return $isWritable;
    }