Skip to content

Commit

Permalink
NEXT-14188 - Fix css in root installation error page
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Apr 8, 2021
1 parent 0dc3909 commit fceb408
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 30 deletions.
1 change: 1 addition & 0 deletions .dockerignore
@@ -1,6 +1,7 @@
/var
!/var/plugins.json
/.*
!/.htaccess
**/*.git
**/node_modules

Expand Down
17 changes: 17 additions & 0 deletions .htaccess
@@ -0,0 +1,17 @@
DirectoryIndex index.html

<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>

<IfModule mod_alias.c>
# Restrict access to VCS directories
RedirectMatch 404 /\\.(svn|git|hg|bzr|cvs)(/|$)

# Restrict access to root folder files
RedirectMatch 404 /(composer\.(json|lock|phar)|README\.md|\.gitignore|.*\.dist|\.env.*)$

# Restrict access to shop configs files
RedirectMatch 404 ^.*\/(bin|config|build|custom|files|src|var|vendor)\/(?<!public).*$
</IfModule>

60 changes: 30 additions & 30 deletions index.html
Expand Up @@ -6,15 +6,15 @@

<title>Installation | Shopware 6</title>

<link rel="icon" type="image/png" sizes="16x16" href="public/recovery/common/assets/images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="32x32" href="public/recovery/common/assets/images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="public/recovery/assets/common/images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="32x32" href="public/recovery/assets/common/images/favicon/favicon-32x32.png">
<meta name="msapplication-TileColor" content="#189eff">
<meta name="theme-color" content="#189eff">

<link rel="stylesheet" type="text/css" href="public/recovery/common/assets/styles/reset.css" media="all"/>
<link rel="stylesheet" type="text/css" href="public/recovery/common/assets/styles/fonts.css" media="all"/>
<link rel="stylesheet" type="text/css" href="public/recovery/common/assets/styles/icons.css" media="all"/>
<link rel="stylesheet" type="text/css" href="public/recovery/common/assets/styles/style.css" media="all"/>
<link rel="stylesheet" type="text/css" href="public/recovery/assets/common/styles/reset.css" media="all"/>
<link rel="stylesheet" type="text/css" href="public/recovery/assets/common/styles/fonts.css" media="all"/>
<link rel="stylesheet" type="text/css" href="public/recovery/assets/common/styles/icons.css" media="all"/>
<link rel="stylesheet" type="text/css" href="public/recovery/assets/common/styles/style.css" media="all"/>

<style>
span.code {
Expand All @@ -37,37 +37,37 @@

</head>
<body>
<div class="page--wrap">
<div class="content--wrapper">
<section class="content--main">
<div class="card__title">
<img class="card__title--logo" src="public/recovery/common/assets/images/sw-logo-blue.svg" width="148" alt="Shopware">
</div>
<div class="page--wrap">
<div class="content--wrapper">
<section class="content--main">
<div class="card__title">
<img class="card__title--logo" src="public/recovery/assets/common/images/sw-logo-blue.svg" width="148" alt="Shopware">
</div>

<div class="card__body is--align-center">
<div class="welcome-container">
<div class="card__body is--align-center">
<div class="welcome-container">

<div class="alert-hero error">
<div class="alert-hero-icon">
<i class="icon-warning"></i>
</div>
<div class="alert-hero error">
<div class="alert-hero-icon">
<i class="icon-warning"></i>
</div>
</div>

<h1 class="welcome-title">Shopware Root Directory</h1>
<h1 class="welcome-title">Shopware Root Directory</h1>

<p>
<strong>You should not be able to see this page.</strong> <br>
If yes you are missing some important server configuration. For security reasons, all accessible files are located in the <span class="code">/public</span> directory of your Shopware installation.
</p>
<p>
<strong>You should not be able to see this page.</strong> <br>
If yes you are missing some important server configuration. For security reasons, all accessible files are located in the <span class="code">/public</span> directory of your Shopware installation.
</p>

<p>
Please configure your web server to root your domain to the <span class="code">/public</span> directory of this installation.
</p>
<p>
Please configure your web server to root your domain to the <span class="code">/public</span> directory of this installation.
</p>

</div>
</div>
</section>
</div>
</div>
</section>
</div>
</div>
</body>
</html>
</html>
5 changes: 5 additions & 0 deletions src/Command/SystemUpdateFinishCommand.php
Expand Up @@ -62,6 +62,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$oldVersion = $systemConfigService->getString(UpdateController::UPDATE_PREVIOUS_VERSION_KEY);

$newVersion = $containerWithoutPlugins->getParameter('kernel.shopware_version');

if (!is_string($newVersion)) {
throw new \RuntimeException('Parameter kernel.shopware_version needs to be an string');
}

/** @var EventDispatcherInterface $eventDispatcherWithoutPlugins */
$eventDispatcherWithoutPlugins = $this->rebootKernelWithoutPlugins()->get('event_dispatcher');
$eventDispatcherWithoutPlugins->dispatch(new UpdatePreFinishEvent($context, $oldVersion, $newVersion));
Expand Down
5 changes: 5 additions & 0 deletions src/Command/SystemUpdatePrepareCommand.php
Expand Up @@ -46,6 +46,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$context = Context::createDefaultContext();
$currentVersion = $this->container->getParameter('kernel.shopware_version');

if (!is_string($currentVersion)) {
throw new \RuntimeException('Parameter kernel.shopware_version needs to be an string');
}

// TODO: get new version (from composer.lock?)
$newVersion = '';

Expand Down

4 comments on commit fceb408

@ansgarbecker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That new .htaccess breaks the update process, causing 500/server errors - if Apache is not configured with AllowOverride in the root directory. Just happened here.

@shyim
Copy link
Member Author

@shyim shyim commented on fceb408 Apr 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an excact error message? The conditionals are in IfModule statements

@ansgarbecker
Copy link

@ansgarbecker ansgarbecker commented on fceb408 Apr 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course:

/var/www/share/mydomain.de/.htaccess: <IfModule not allowed here
/var/www/share/mydomain.de/.htaccess: DirectoryIndex not allowed here 

@ansgarbecker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shyim our hoster found out this is only happening with nested symbolic links, which we had here:
docroot => linking to SW root directory, which contained a symbolic link "htdocs" => "public"
Converting the first link to a directory with one symlink pointing to public resolved the issue.

Please sign in to comment.