Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduced pub/ structure for webserver home folder mapping #1210

Merged
merged 4 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dev/openmage/apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM ghcr.io/colinmollenhour/docker-openmage-dev:8.2-apache

ENV APACHE_DOCUMENT_ROOT /var/www/html/pub/default

RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
fballiano marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion dev/openmage/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.7"

services:
apache:
image: ghcr.io/colinmollenhour/docker-openmage-dev:8.2-apache
build: apache
hostname: ${HOST_NAME:-openmage-7f000001.nip.io}
ports:
- "${HOST_PORT:-80}:80"
Expand Down
6 changes: 3 additions & 3 deletions errors/processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public function __construct()
$this->_root = is_dir($this->_indexDir.'app');

$this->_prepareConfig();
if (isset($_GET['skin'])) {
$this->_setSkin($_GET['skin']);
if (isset($_SERVER['MAGE_ERRORS_SKIN']) || isset($_GET['skin'])) {
$this->_setSkin($_SERVER['MAGE_ERRORS_SKIN'] ?? $_GET['skin']);
}
}

Expand Down Expand Up @@ -208,7 +208,7 @@ public function getBaseUrl(bool $param = false): string
*/
protected function _getClientIp(): string
{
return $_SERVER['REMOTE_ADDR'] ?? 'undefined';
return $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? 'undefined';
}

protected function _getIndexDir(): string
Expand Down
1 change: 1 addition & 0 deletions pub/default/.htaccess
5 changes: 5 additions & 0 deletions pub/default/api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

chdir(dirname(__DIR__, 2));

require 'api.php';
1 change: 1 addition & 0 deletions pub/default/errors
Binary file added pub/default/favicon.ico
Binary file not shown.
5 changes: 5 additions & 0 deletions pub/default/get.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

chdir(dirname(__DIR__, 2));

require 'get.php';
25 changes: 25 additions & 0 deletions pub/default/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
//
// This file is the entrypoint for the default OpenMage store.
// Create a separate subdirectory of pub/ to add more virtual hosts for different stores
// with different root directories and assign the run code and run type variables below as appropriate.
//

chdir(dirname(__DIR__, 2));

/* Store or website code */
if (empty($_SERVER['MAGE_RUN_CODE'])) {
$_SERVER['MAGE_RUN_CODE'] = '';
}

/* Run store or run website */
if (empty($_SERVER['MAGE_RUN_TYPE'])) {
$_SERVER['MAGE_RUN_TYPE'] = 'store';
}

/* Errors pages skin */
if (empty($_SERVER['MAGE_ERRORS_SKIN'])) {
$_SERVER['MAGE_ERRORS_SKIN'] = 'default';
}

require 'index.php';
9 changes: 9 additions & 0 deletions pub/default/install.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

chdir(dirname(__DIR__, 2));

if (file_exists('app/etc/local.xml')) {
require 'errors/404.php';
} else {
require 'install.php';
}
1 change: 1 addition & 0 deletions pub/default/js
1 change: 1 addition & 0 deletions pub/default/media
1 change: 1 addition & 0 deletions pub/default/skin