public function editAction() { $params = array('sslCertificates' => Entity\SslCertificate::getList($this->getEnvironmentId())); if ($this->getParam('vhostId')) { $vHost = Scalr_Service_Apache_Vhost::init()->loadById($this->getParam('vhostId')); $this->user->getPermissions()->validate($vHost); $options = unserialize($vHost->templateOptions); $params['farmWidget'] = self::loadController('Farms')->getFarmWidget(array('farmId' => $vHost->farmId ? $vHost->farmId : "", 'farmRoleId' => $vHost->farmRoleId ? $vHost->farmRoleId : ""), $this->farmWidgetOptions); $params['vhost'] = array('vhostId' => $vHost->id, 'domainName' => $vHost->domainName, 'documentRoot' => $options['document_root'], 'logsDir' => $options['logs_dir'], 'serverAdmin' => $options['server_admin'], 'serverAlias' => $options['server_alias'], 'nonSslTemplate' => $vHost->httpdConf, 'isSslEnabled' => $vHost->isSslEnabled == 1 ? true : false, 'sslCertId' => $vHost->sslCertId, 'sslTemplate' => $vHost->httpdConfSsl ? $vHost->httpdConfSsl : @file_get_contents("../templates/services/apache/ssl.vhost.tpl")); } else { $params['farmWidget'] = self::loadController('Farms')->getFarmWidget(array(), $this->farmWidgetOptions); $params['vhost'] = array('documentRoot' => '/var/www', 'logsDir' => '/var/log', 'serverAdmin' => $this->user->getEmail(), 'nonSslTemplate' => @file_get_contents("../templates/services/apache/nonssl.vhost.tpl"), 'sslTemplate' => @file_get_contents("../templates/services/apache/ssl.vhost.tpl")); } $this->response->page('ui/services/apache/vhosts/create.js', $params); }