Neos.Neos/Classes/Command/SiteCommandController.php
public function listCommand()
    {
        $sites = $this->siteRepository->findAll();

        if ($sites->count() === 0) {
            $this->outputLine('No sites available');
            $this->quit(0);
        }

        $longestSiteName = 4;
        $longestNodeName = 9;
        $longestSiteResource = 17;
        $availableSites = [];

        foreach ($sites as $site) {
            /** @var Site $site */
            array_push($availableSites, [
                'name' => $site->getName(),
                'nodeName' => $site->getNodeName(),
                'siteResourcesPackageKey' => $site->getSiteResourcesPackageKey(),
                'status' => ($site->getState() === SITE::STATE_ONLINE) ? 'online' : 'offline'
            ]);
            if (strlen($site->getName()) > $longestSiteName) {
                $longestSiteName = strlen($site->getName());
            }
            if (strlen($site->getNodeName()) > $longestNodeName) {
                $longestNodeName = strlen($site->getNodeName());
            }
            if (strlen($site->getSiteResourcesPackageKey()) > $longestSiteResource) {
                $longestSiteResource = strlen($site->getSiteResourcesPackageKey());
            }
        }

        $this->outputLine();
        $this->outputLine(' ' . str_pad('Name', $longestSiteName + 15) . str_pad('Node name', $longestNodeName + 15) . str_pad('Resources package', $longestSiteResource + 15) . 'Status ');
        $this->outputLine(str_repeat('-', $longestSiteName + $longestNodeName + $longestSiteResource + 7 + 15 + 15 + 15 + 2));
        foreach ($availableSites as $site) {
            $this->outputLine(' ' . str_pad($site['name'], $longestSiteName + 15) . str_pad($site['nodeName'], $longestNodeName + 15) . str_pad($site['siteResourcesPackageKey'], $longestSiteResource + 15) . $site['status']);
        }
        $this->outputLine();
    }
public function listCommand()
    {
        $sites = $this->siteRepository->findAll();

        if ($sites->count() === 0) {
            $this->outputLine('No sites available');
            $this->quit(0);
        }

        $longestSiteName = 4;
        $longestNodeName = 9;
        $longestSiteResource = 17;
        $availableSites = [];

        foreach ($sites as $site) {
            /** @var Site $site */
            array_push($availableSites, [
                'name' => $site->getName(),
                'nodeName' => $site->getNodeName(),
                'siteResourcesPackageKey' => $site->getSiteResourcesPackageKey(),
                'status' => ($site->getState() === SITE::STATE_ONLINE) ? 'online' : 'offline'
            ]);
            if (strlen($site->getName()) > $longestSiteName) {
                $longestSiteName = strlen($site->getName());
            }
            if (strlen($site->getNodeName()) > $longestNodeName) {
                $longestNodeName = strlen($site->getNodeName());
            }
            if (strlen($site->getSiteResourcesPackageKey()) > $longestSiteResource) {
                $longestSiteResource = strlen($site->getSiteResourcesPackageKey());
            }
        }

        $this->outputLine();
        $this->outputLine(' ' . str_pad('Name', $longestSiteName + 15) . str_pad('Node name', $longestNodeName + 15) . str_pad('Resources package', $longestSiteResource + 15) . 'Status ');
        $this->outputLine(str_repeat('-', $longestSiteName + $longestNodeName + $longestSiteResource + 7 + 15 + 15 + 15 + 2));
        foreach ($availableSites as $site) {
            $this->outputLine(' ' . str_pad($site['name'], $longestSiteName + 15) . str_pad($site['nodeName'], $longestNodeName + 15) . str_pad($site['siteResourcesPackageKey'], $longestSiteResource + 15) . $site['status']);
        }
        $this->outputLine();
    }
public function listCommand ( ) { $ sites = $ this -> siteRepository -> findAll ( ) ; if ( $ sites -> count ( ) === 0 ) { $ this -> outputLine ( 'No sites available' ) ; $ this -> quit ( 0 ) ; } $ longestSiteName = 4 ; $ longestNodeName = 9 ; $ longestSiteResource = 17 ; $ availableSites = [ ] ; foreach ( $ sites as $ site ) { /** @var Site $site */ array_push ( $ availableSites , [ 'name' => $ site -> getName ( ) , 'nodeName' => $ site -> getNodeName ( ) , 'siteResourcesPackageKey' => $ site -> getSiteResourcesPackageKey ( ) , 'status' => ( $ site -> getState ( ) === SITE :: STATE_ONLINE ) ? 'online' : 'offline' ] ) ; if ( strlen ( $ site -> getName ( ) ) > $ longestSiteName ) { $ longestSiteName = strlen ( $ site -> getName ( ) ) ; } if ( strlen ( $ site -> getNodeName ( ) ) > $ longestNodeName ) { $ longestNodeName = strlen ( $ site -> getNodeName ( ) ) ; } if ( strlen ( $ site -> getSiteResourcesPackageKey ( ) ) > $ longestSiteResource ) { $ longestSiteResource = strlen ( $ site -> getSiteResourcesPackageKey ( ) ) ; } } $ this -> outputLine ( ) ; $ this -> outputLine ( ' ' . str_pad ( 'Name' , $ longestSiteName + 15 ) . str_pad ( 'Node name' , $ longestNodeName + 15 ) . str_pad ( 'Resources package' , $ longestSiteResource + 15 ) . 'Status ' ) ; $ this -> outputLine ( str_repeat ( '-' , $ longestSiteName + $ longestNodeName + $ longestSiteResource + 7 + 15 + 15 + 15 + 2 ) ) ; foreach ( $ availableSites as $ site ) { $ this -> outputLine ( ' ' . str_pad ( $ site [ 'name' ] , $ longestSiteName + 15 ) . str_pad ( $ site [ 'nodeName' ] , $ longestNodeName + 15 ) . str_pad ( $ site [ 'siteResourcesPackageKey' ] , $ longestSiteResource + 15 ) . $ site [ 'status' ] ) ; } $ this -> outputLine ( ) ; }
List available sites

@return void
List available sites