AppserverIo\Appserver\Core\Modules\StorageProvider\SystemConfigurationStorageProvider::__construct PHP Метод

__construct() публичный Метод

Initializes the storage provider by loading the configuration values from the passed module configuration.
public __construct ( AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface $systemConfiguration, AppserverIo\Server\Interfaces\ModuleConfigurationInterface $moduleConfiguration )
$systemConfiguration AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface The system configuration
$moduleConfiguration AppserverIo\Server\Interfaces\ModuleConfigurationInterface The module configuration
    public function __construct(SystemConfigurationInterface $systemConfiguration, ModuleConfigurationInterface $moduleConfiguration)
    {
        // load the configuration values
        $defaultTtl = $moduleConfiguration->getParam(AbstractStorageProvider::DEFAULT_TTL);
        // query whether or not the default TTL is an integer
        if (!is_int($defaultTtl)) {
            throw new \Exception('Default TTL must be an integer.');
        }
        // declare the array for the DNS records
        $dnsRecords = array();
        // iterate over the system configuration and create DNS A records from the found virtual hosts
        foreach ($systemConfiguration->getContainers() as $containerNode) {
            foreach ($containerNode->getServers() as $serverNode) {
                foreach ($serverNode->getVirtualHosts() as $virtualHost) {
                    if (sizeof($dnsNames = explode(' ', $virtualHost->getName())) > 0) {
                        foreach ($dnsNames as $dnsName) {
                            // add the IPv4 + IPv6 address for localhost
                            $dnsRecords[$dnsName]['A'] = array('127.0.0.1');
                            $dnsRecords[$dnsName]['AAAA'] = array('::1');
                        }
                    }
                }
            }
        }
        // set the default TTL and the DNS records
        $this->dsTtl = $defaultTtl;
        $this->dnsRecords = $dnsRecords;
    }
SystemConfigurationStorageProvider