public function createSiteFolders(CNabuSite $nb_site) : bool
    {
        $vhosts_path = $this->validatePath($this->nb_server->getVirtualHostsPath());
        $vlib_path = $this->validatePath($this->nb_server->getVirtualLibrariesPath());
        $vcache_path = $this->validatePath($this->nb_server->getVirtualCachePath());

        $nb_cluster_user = $nb_site->getClusterUser();
        if ($nb_cluster_user === null) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_OBJECT_EXPECTED);
        }
        $nb_cluster_user_group = $nb_cluster_user->getGroup();
        if ($nb_cluster_user_group === null) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_OBJECT_EXPECTED);
        }
        $owner_name = $nb_cluster_user->getOSNick();
        $owner_group = $nb_cluster_user_group->getOSNick();

        $vhosts_path = $nb_site->getVirtualHostPath($this->nb_server);
        if (!is_dir($vhosts_path)) {
            if (!mkdir($vhosts_path, 0755, true)) {
                throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vhosts_path));
            } else {
                chown($vhosts_path, $owner_name);
                chgrp($vhosts_path, $owner_group);
            }
        }
        $vlib_path = $nb_site->getVirtualLibrariesPath($this->nb_server);
        if (!is_dir($vlib_path)) {
            if (!mkdir($vlib_path, 0755, true)) {
                throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vlib_path));
            } else {
                chown($vlib_path, APACHE_HTTPD_SYS_USER);
                chgrp($vlib_path, $owner_group);
            }
        }
        $vcache_path = $nb_site->getVirtualCachePath($this->nb_server);
        if (!is_dir($vcache_path)) {
            if (!mkdir($vcache_path, 0755, true)) {
                throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vcache_path));
            } else {
                chown($vcache_path, APACHE_HTTPD_SYS_USER);
                chgrp($vcache_path, $owner_group);
            }
        }

        return true;
    }
public function createSiteFolders(CNabuSite $nb_site) : bool
    {
        $vhosts_path = $this->validatePath($this->nb_server->getVirtualHostsPath());
        $vlib_path = $this->validatePath($this->nb_server->getVirtualLibrariesPath());
        $vcache_path = $this->validatePath($this->nb_server->getVirtualCachePath());

        $nb_cluster_user = $nb_site->getClusterUser();
        if ($nb_cluster_user === null) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_OBJECT_EXPECTED);
        }
        $nb_cluster_user_group = $nb_cluster_user->getGroup();
        if ($nb_cluster_user_group === null) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_OBJECT_EXPECTED);
        }
        $owner_name = $nb_cluster_user->getOSNick();
        $owner_group = $nb_cluster_user_group->getOSNick();

        $vhosts_path = $nb_site->getVirtualHostPath($this->nb_server);
        if (!is_dir($vhosts_path)) {
            if (!mkdir($vhosts_path, 0755, true)) {
                throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vhosts_path));
            } else {
                chown($vhosts_path, $owner_name);
                chgrp($vhosts_path, $owner_group);
            }
        }
        $vlib_path = $nb_site->getVirtualLibrariesPath($this->nb_server);
        if (!is_dir($vlib_path)) {
            if (!mkdir($vlib_path, 0755, true)) {
                throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vlib_path));
            } else {
                chown($vlib_path, APACHE_HTTPD_SYS_USER);
                chgrp($vlib_path, $owner_group);
            }
        }
        $vcache_path = $nb_site->getVirtualCachePath($this->nb_server);
        if (!is_dir($vcache_path)) {
            if (!mkdir($vcache_path, 0755, true)) {
                throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vcache_path));
            } else {
                chown($vcache_path, APACHE_HTTPD_SYS_USER);
                chgrp($vcache_path, $owner_group);
            }
        }

        return true;
    }
public function createSiteFolders ( CNabuSite $ nb_site ) : bool { $ vhosts_path = $ this -> validatePath ( $ this -> nb_server -> getVirtualHostsPath ( ) ) ; $ vlib_path = $ this -> validatePath ( $ this -> nb_server -> getVirtualLibrariesPath ( ) ) ; $ vcache_path = $ this -> validatePath ( $ this -> nb_server -> getVirtualCachePath ( ) ) ; $ nb_cluster_user = $ nb_site -> getClusterUser ( ) ; if ( $ nb_cluster_user === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_OBJECT_EXPECTED ) ; } $ nb_cluster_user_group = $ nb_cluster_user -> getGroup ( ) ; if ( $ nb_cluster_user_group === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_OBJECT_EXPECTED ) ; } $ owner_name = $ nb_cluster_user -> getOSNick ( ) ; $ owner_group = $ nb_cluster_user_group -> getOSNick ( ) ; $ vhosts_path = $ nb_site -> getVirtualHostPath ( $ this -> nb_server ) ; if ( ! is_dir ( $ vhosts_path ) ) { if ( ! mkdir ( $ vhosts_path , 0755 , true ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_HOST_PATH_NOT_FOUND , array ( $ vhosts_path ) ) ; } else { chown ( $ vhosts_path , $ owner_name ) ; chgrp ( $ vhosts_path , $ owner_group ) ; } } $ vlib_path = $ nb_site -> getVirtualLibrariesPath ( $ this -> nb_server ) ; if ( ! is_dir ( $ vlib_path ) ) { if ( ! mkdir ( $ vlib_path , 0755 , true ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_HOST_PATH_NOT_FOUND , array ( $ vlib_path ) ) ; } else { chown ( $ vlib_path , APACHE_HTTPD_SYS_USER ) ; chgrp ( $ vlib_path , $ owner_group ) ; } } $ vcache_path = $ nb_site -> getVirtualCachePath ( $ this -> nb_server ) ; if ( ! is_dir ( $ vcache_path ) ) { if ( ! mkdir ( $ vcache_path , 0755 , true ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_HOST_PATH_NOT_FOUND , array ( $ vcache_path ) ) ; } else { chown ( $ vcache_path , APACHE_HTTPD_SYS_USER ) ; chgrp ( $ vcache_path , $ owner_group ) ; } } return true ; }
Create Site Folders for the requested Site.
@param CNabuSite $nb_site Site instance to create folders.
@return bool Returns true if all required folders exists.
@throws ENabuCoreException Raises an exception if a folder cannot be available.
@todo Refactor this method to use CNabuHTTPFileSystem
Create Site Folders for the requested Site .