Commit 12a5621f authored by Jon Pugh's avatar Jon Pugh

Adding "document_root" property for projects where "root" is not the exposed...

Adding "document_root" property for projects where "root" is not the exposed web root, and refactor templates to use that property instead.
parent becc0799
<Directory <?php print $this->root; ?>>
<Directory <?php print $document_root; ?>>
Order allow,deny
Allow from all
Satisfy any
......@@ -8,9 +8,9 @@
<?php
if (is_readable("{$this->root}/.htaccess")) {
if (is_readable("{$document_root}/.htaccess")) {
print "\n# Include the platform's htaccess file\n";
print "Include {$this->root}/.htaccess\n";
print "Include {$document_root}/.htaccess\n";
}
?>
......
......@@ -44,6 +44,14 @@ class PlatformContext extends ContextSubscriber implements ConfigurationInterfac
// Load "web_server" context.
// There is no need to validate for $this->properties['web_server'] because the config system does that.
// $this->web_server = $application->getContext($this->properties['web_server']);
// Make document root property absolute, and set to root if there is no docroot.
if ($this->getProperty('document_root')) {
$this->setProperty('document_root', $this->getProperty('root') . DIRECTORY_SEPARATOR . $this->getProperty('document_root'));
}
else {
$this->setProperty('document_root', $this->getProperty('root'));
}
}
static function option_documentation()
......
......@@ -26,7 +26,6 @@ class PlatformConfiguration extends Configuration {
function process()
{
$this->data['http_port']['root'] = 'yeahhh';
parent::process();
}
}
\ No newline at end of file
......@@ -29,10 +29,10 @@ class SiteConfiguration extends Configuration {
function process() {
parent::process();
$this->data['http_port'] = $this->context->getSubscription('http')->service->getProperty('http_port');
$this->data['root'] = $this->context->platform->getProperty('root');
$this->data['document_root'] = $this->context->platform->getProperty('document_root');
$this->data['uri'] = $this->context->getProperty('uri');
$this->data['site_path'] = $this->data['root'] . '/sites/' . $this->data['uri'];
$this->data['site_path'] = $this->data['document_root'] . '/sites/' . $this->data['uri'];
$this->data['db_type'] = $this->context->getSubscription('db')->service->getType();
......
<Directory <?php print $root; ?>>
<Directory <?php print $document_root; ?>>
Order allow,deny
Allow from all
Satisfy any
......@@ -20,7 +20,7 @@
// }
?>
# Include the platform's htaccess file
Include <?php print $root ?>/.htaccess
Include <?php print $document_root ?>/.htaccess
# Do not read any .htaccess in the platform
AllowOverride none
......
......@@ -124,19 +124,19 @@ class HttpApacheDockerService extends HttpApacheService implements DockerService
// Replace platform's stored root with server's root.
if ($this->context instanceof Context\SiteContext) {
$root_on_host = $this->context->platform->getProperty('root');
$root_on_host = $this->context->platform->getProperty('document_root');
}
elseif ($this->context instanceof Context\PlatformContext) {
$root_on_host = $this->context->getProperty('root');
$root_on_host = $this->context->getProperty('document_root');
}
else {
return;
}
$config->data['root'] = $this->mapContainerPath($root_on_host);
$config->data['document_root'] = $this->mapContainerPath($root_on_host);
if ($this->context->type == 'site' && isset($config->data['uri'])) {
$config->data['site_path'] = $config->data['root'] . '/sites/' . $config->data['uri'];
$config->data['site_path'] = $config->data['document_root'] . '/sites/' . $config->data['uri'];
}
// When running in docker, internal port is always 80.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment