Check directory (if not exists create it).
@return bool
@throws Oppa\Exception\InvalidConfigException
515753
public function checkDirectory(): bool
    {
        if (empty($this->directory)) {
            throw new InvalidConfigException(
                "Log directory is not defined in given configuration, ".
                "define it using 'query_log_directory' key to activate logging.");
        }

        // provide some performance escaping to call "is_dir" and "mkdir" functions
        self::$directoryChecked = self::$directoryChecked ?: is_dir($this->directory);
        if (!self::$directoryChecked) {
            self::$directoryChecked = mkdir($this->directory, 0644, true);

            // !!! notice !!!
            // set your log dir secure
            file_put_contents($this->directory .'/index.php',
                "<?php header('HTTP/1.1 403 Forbidden'); ?>");
            // this action is for only apache, see nginx configuration here:
            // http://nginx.org/en/docs/http/ngx_http_access_module.html
            file_put_contents($this->directory .'/.htaccess',
                "Order deny,allow\r\nDeny from all");
        }

        return self::$directoryChecked;
    }
1127625
protected function wipeExistingDirectory()
    {
        if ($this->wipe === true && $this->directory != '/' && is_dir($this->directory)) {
            $cmd = 'rm -Rf "%s*"';
            $success = $this->phpci->executeCommand($cmd, $this->directory);

            if (!$success) {
                throw new \Exception(Lang::get('failed_to_wipe', $this->directory));
            }
        }
    }
926899
public function isDirectory()
    {
        clearstatcache();
        $fs = FileSystem::getFileSystem();
        if ($fs->checkAccess($this) !== true) {
            throw new IOException("No read access to " . $this->path);
        }

        return @is_dir($this->path) && !@is_link($this->path);
    }
1046532
public function createHostedConfiguration() : bool
    {
        $retval = false;

        if ($this->apache_config_path) {
            $index_list = $this->nb_server->getSitesIndex();
            $index_list->iterate(
                function ($site_key, $nb_site) {
                    $this->createHostedFile($nb_site);

                    return true;
                }
            );
            $this->createHostedIndex($index_list);
            $retval = true;
        }

        return $retval;
    }
1829
public function check()
    {
        foreach ($this->target->paths as $path) {
            if (! $this->getFilesystem()->isWritable($path)) {
                return $this->makeResult(
                    false,
                    sprintf($this->target->getErrorMessage(), $path)
                );
            }
        }

        return $this->makeHealthyResult();
    }
651761
public function create()
    {
        if (! $this->adapter->fileExists($this->path, true)) {
            // ensure the parent directory exists
            new Directory(dirname($this->path), $this->adapter);

            if ($this->adapter->createFile($this->path) === false) {
                $this->throwUnableToCreate();
            }
        }

        return $this;
    }
1298791
public function getConfigDir()
    {
        if (null === $this->configDir) {
            $this->configDir = $this->getRootDir() . '/app/config/';
        }

        return($this->configDir);
    }
1168058
public function save()
    {
        $dir = dirname($this->path);

        if (!is_dir($dir)) {
            $mask = @umask(0);
            $result = @mkdir($dir, $this->dirMode, true);
            @umask($mask);

            if (!$result) {
                throw new Exception("Unable to create the directory '$dir'.");
            }
        }

        if (@file_put_contents($this->path, $this->content) === false) {
            throw new Exception("Unable to write the file '{$this->path}'.");
        }

        $mask = @umask(0);
        @chmod($this->path, $this->mode);
        @umask($mask);

        return true;
    }
1088427
public static function createWorkingDirectory()
    {
        $workdir = sys_get_temp_dir() . '/tmp-' . session_id() . '/';

        self::recursiveMkdir($workdir, 0777);
        //@chmod($workdir,0777);

        if (!is_dir($workdir)) {
            throw new Exception("cannot create directory: " . $workdir);
        }

        return $workdir;
    }
306068
protected function ensureRootDirectory()
    {
        if ($this->dirExists === true) {
            return;
        }

        $this->ensureDirectory((string)$this->filePath('foo')->pop()); // trigger errors if unconfigured

        $this->dirExists = true;
    }
779221
public function check_dir( $need_not_empty = true )
    {
	$ok = false;

	if( is_dir( $this->_dir_path ) && is_readable( $this->_dir_path ) ) 
	{
	    $ok = true;
	    if( $need_not_empty )
	    {
		$ok = ( count( scandir( $this->_dir_path ) ) > 0 ) ? true: false;
	    }
	}
	return $ok;
    }
307839
function checkAndOrCreateDir($dir, $create = false, $perm = '0777')
    {
        if(is_dir($dir) && is_writable($dir)) return true;
        elseif($create === false) return false;

        @mkdir($dir, $perm, true);
        @chmod($dir, $perm);

        if(is_writable($dir)) return true;
        return false;
    }
327122
public function validateStoragePath()
    {
        if (!$this->files->exists($this->storage)) {
            return $this->files->makeDirectory($this->storage);
        }

        return true;
    }
112673
private function checkDirWithConfig($dir_name, Config $config, $allow_non_project_files = false)
    {
        $file_extensions = $config->getFileExtensions();

        $file_paths = $this->file_provider->getFilesInDir($dir_name, $file_extensions);

        $files_to_scan = [];

        foreach ($file_paths as $file_path) {
            if ($allow_non_project_files || $config->isInProjectDirs($file_path)) {
                $files_to_scan[$file_path] = $file_path;
            }
        }

        $this->codebase->addFilesToAnalyze($files_to_scan);
    }
788480
protected function validateConfig()
    {
        $this->validateUrls();
        $this->validateRefreshInterval();
        $this->validateCacheFile();
        $this->validateFilePath();
        $this->validateParser();

        return true;
    }
193036
public function create() {
        if ($this->exist()) {
            return true;
        }
        $args = explode('/', str_replace('\\', '/', $this->fullName));
        $directory = '';
        $result = true;
        foreach ($args as $item) {
            $directory .= $item . '/';
            if (!is_dir($directory) && !empty($directory)) {
                $result = mkdir($directory);
            }
        }
        return $result;
    }
1278940
public function hasDirectory()
    {
        if (!is_dir($this->getPath()) && !mkdir($this->getPath(), 0775, true)) {
            throw new InvalidCacheDirectoryException('Unable to create cache directory ');
        } elseif (
            !is_readable($this->getPath()) ||
            !is_writable($this->getPath())
        ) {
            if (!chmod($this->getPath(), 0775)) {
                throw new InvalidCacheDirectoryException(
                    'Cache Path Error '.$this->getPath().' directory must be writable'
                );
            }
        }

        return true;
    }