Skip to content

Commit

Permalink
Merge pull request #123 from jonashrem/main
Browse files Browse the repository at this point in the history
 don't use a media Fallback for static assets ( #1461 )
  • Loading branch information
shyim authored Oct 4, 2024
2 parents 777ec88 + 97b8a04 commit 86aec33
Show file tree
Hide file tree
Showing 19 changed files with 580 additions and 0 deletions.
11 changes: 11 additions & 0 deletions shopware/core/6.7/bin/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Files ~ ".*">
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
</Files>
14 changes: 14 additions & 0 deletions shopware/core/6.7/bin/build-js.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

BIN_DIR="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"

set -euo pipefail


if [[ -e "${BIN_DIR}/build-administration.sh" ]]; then
"${BIN_DIR}/build-administration.sh"
fi

if [[ -e "${BIN_DIR}/build-storefront.sh" ]]; then
"${BIN_DIR}/build-storefront.sh"
fi
55 changes: 55 additions & 0 deletions shopware/core/6.7/bin/ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env php
<?php

use Shopware\Core\Framework\Adapter\Kernel\KernelFactory;
use Shopware\Core\Framework\Plugin\KernelPluginLoader\ComposerPluginLoader;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;

if (!file_exists(__DIR__ . '/../.env') && !file_exists(__DIR__ . '/../.env.dist') && !file_exists(__DIR__ . '/../.env.local.php')) {
$_SERVER['APP_RUNTIME_OPTIONS']['disable_dotenv'] = true;
}

require_once __DIR__ . '/../vendor/autoload_runtime.php';

return static function (array &$context) {
set_time_limit(0);

$classLoader = require __DIR__ . '/../vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

if (!isset($context['PROJECT_ROOT'])) {
$context['PROJECT_ROOT'] = dirname(__DIR__);
}

$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], $context['APP_ENV'] ?? 'prod', true);
$debug = ($context['APP_DEBUG'] ?? ($env !== 'prod')) && !$input->hasParameterOption('--no-debug', true);

if ($input->getFirstArgument() === 'system:install') {
$context['INSTALL'] = true;
}

if (trim($context['DATABASE_URL'] ?? '') === '') {
// fake DATABASE_URL
$_SERVER['DATABASE_URL'] = 'mysql://_placeholder.test';
}

$kernel = KernelFactory::create(
environment: $env,
debug: $debug,
classLoader: $classLoader,
pluginLoader: new ComposerPluginLoader($classLoader, null),
);

$application = new Application($kernel);
$kernel->boot();

$application->setName('Shopware');
$application->setVersion($kernel->getContainer()->getParameter('kernel.shopware_version'));

return $application;
};
60 changes: 60 additions & 0 deletions shopware/core/6.7/bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env php
<?php

use Shopware\Core\Framework\Adapter\Kernel\KernelFactory;
use Shopware\Core\Framework\Plugin\KernelPluginLoader\DbalKernelPluginLoader;
use Shopware\Core\Framework\Plugin\KernelPluginLoader\StaticKernelPluginLoader;
use Shopware\Core\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;

$envFile = __DIR__ . '/../.env';

if (!file_exists(__DIR__ . '/../.env') && !file_exists(__DIR__ . '/../.env.dist') && !file_exists(__DIR__ . '/../.env.local.php')) {
$_SERVER['APP_RUNTIME_OPTIONS']['disable_dotenv'] = true;
}

require_once __DIR__ . '/../vendor/autoload_runtime.php';

return static function (array &$context) {
set_time_limit(0);

$classLoader = require __DIR__ . '/../vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

if (!isset($context['PROJECT_ROOT'])) {
$context['PROJECT_ROOT'] = dirname(__DIR__);
}

$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], $context['APP_ENV'] ?? 'prod', true);
$debug = ($context['APP_DEBUG'] ?? ($env !== 'prod')) && !$input->hasParameterOption('--no-debug', true);

$pluginLoader = new StaticKernelPluginLoader($classLoader, null);

if ($input->getFirstArgument() === 'system:install') {
$context['INSTALL'] = true;
}

if (trim($context['DATABASE_URL'] ?? '') !== '' && !isset($context['INSTALL'])) {
$pluginLoader = new DbalKernelPluginLoader($classLoader, null, Kernel::getConnection());
}

$kernel = KernelFactory::create(
environment: $env,
debug: $debug,
classLoader: $classLoader,
pluginLoader: $pluginLoader
);

$application = new Application($kernel);
$kernel->boot();

$application->setName('Shopware');
$application->setVersion($kernel->getContainer()->getParameter('kernel.shopware_version'));

return $application;
};
39 changes: 39 additions & 0 deletions shopware/core/6.7/bin/functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

load_dotenv() {
LOAD_DOTENV=${LOAD_DOTENV:-"1"}

if [[ "$LOAD_DOTENV" == "0" ]]; then
return
fi

CURRENT_ENV=${APP_ENV:-"dev"}
env_file="$1"

# If we have an actual .env file load it
if [[ -e "$env_file" ]]; then
# shellcheck source=/dev/null
source "$env_file"
elif [[ -e "$env_file.dist" ]]; then
# shellcheck source=/dev/null
source "$env_file.dist"
fi

# If we have an local env file load it
if [[ -e "$env_file.local" ]]; then
# shellcheck source=/dev/null
source "$env_file.local"
fi

# If we have an env file for the current env load it
if [[ -e "$env_file.$CURRENT_ENV" ]]; then
# shellcheck source=/dev/null
source "$env_file.$CURRENT_ENV"
fi

# If we have an env file for the current env load it'
if [[ -e "$env_file.$CURRENT_ENV.local" ]]; then
# shellcheck source=/dev/null
source "$env_file.$CURRENT_ENV.local"
fi
}
3 changes: 3 additions & 0 deletions shopware/core/6.7/config/jwt/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*

!.gitignore
9 changes: 9 additions & 0 deletions shopware/core/6.7/config/packages/shopware.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Using the webupdater will overwrite this file. Create a second file z-shopware.yaml to override the config

shopware:
auto_update:
# Disables the auto updater in the UI
# enabled: false
admin_worker:
# The Admin worker should be disabled on production server.
# enable_admin_worker: false
11 changes: 11 additions & 0 deletions shopware/core/6.7/custom/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Files ~ ".*">
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
</Files>
Empty file.
Empty file.
Empty file.
11 changes: 11 additions & 0 deletions shopware/core/6.7/files/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Files ~ ".*">
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
</Files>
96 changes: 96 additions & 0 deletions shopware/core/6.7/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"copy-from-recipe": {
"bin/": "%BIN_DIR%/",
"config/": "%CONFIG_DIR%/",
"custom/": "custom/",
"files/": "files/",
"public/": "%PUBLIC_DIR%/",
"var/": "var/",
"src/": "src/",
"root/": ""
},
"bundles": {
"Shopware\\Core\\Framework\\Framework": [
"all"
],
"Shopware\\Core\\System\\System": [
"all"
],
"Shopware\\Core\\Content\\Content": [
"all"
],
"Shopware\\Core\\Checkout\\Checkout": [
"all"
],
"Shopware\\Core\\Maintenance\\Maintenance": [
"all"
],
"Shopware\\Core\\DevOps\\DevOps": [
"e2e"
],
"Shopware\\Core\\Profiling\\Profiling": [
"all"
]
},
"container": {
"shopware.store.frw": true,
"default_cdn_strategy": "physical_filename",
"shopware.cdn.strategy": "%env(default:default_cdn_strategy:SHOPWARE_CDN_STRATEGY_DEFAULT)%"
},
"env": {
"APP_ENV": "prod",
"APP_URL": "http://127.0.0.1:8000",
"APP_SECRET": "%generate(secret)%",
"INSTANCE_ID": "%generate(secret)%",
"BLUE_GREEN_DEPLOYMENT": "0",
"DATABASE_URL": "mysql://root:root@localhost/shopware",
"#1": "With Shopware 6.4.17.0 the MAILER_DSN variable will be used in this template instead of MAILER_URL",
"MAILER_URL": "null://null"
},
"gitignore": [
".env.local",
".env.local.php",
".env.*.local",
"/public/bundles/*",
"/public/media/*",
"/public/theme/*",
"/public/thumbnail/*",
"/public/sitemap/*",
"/files/*",
"!/files/.htaccess",
"/var/*",
"!/var/.htaccess",
"/auth.json",
"/install.lock",
"public/asset-manifest.json"
],
"composer-scripts": {
"assets:install": "symfony-cmd"
},
"docker-compose": {
"docker-compose.yml": {
"services": [
"database:",
" image: mysql:${MYSQL_VERSION:-8}-oracle",
" environment:",
" MYSQL_DATABASE: ${MYSQL_DATABASE:-shopware}",
" # You should definitely change the password in production",
" MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-!ChangeMe!}",
" MYSQL_USER: ${MYSQL_USER:-shopware}",
" MYSQL_PASSWORD: ${MYSQL_PASSWORD:-!ChangeMe!}",
" volumes:",
" - db-data:/var/lib/mysql:rw",
" # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!",
" # - ./docker/db/data:/var/lib/mysql:rw"
],
"volumes": ["db-data:"]
},
"docker-compose.override.yml": {
"services": [
"database:",
" ports:",
" - \"3306\""
]
}
}
}
21 changes: 21 additions & 0 deletions shopware/core/6.7/post-install.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
* <fg=blue>Setup</> your repository:

1. Go to the project directory
2. Create your code repository with the <comment>git init</comment> command and push it to your favourite Git service

* <fg=blue>Run</> Shopware locally:

1. Adjust the <comment>.env</comment> file to your database
2. Run <comment>./bin/console system:install --basic-setup</comment>
3. Optional: If you use Symfony CLI start the webserver <comment>symfony server:start -d</comment>
3. The default credentials for administration are <comment>admin</comment> with password <comment>shopware</comment>

* <fg=blue>Run</> Shopware with Docker & Symfony CLI:

1. Start the docker containers with <comment>docker compose up -d</comment>
2. Run <comment>symfony console system:install --basic-setup</comment>
3. Start the webserver <comment>symfony server:start -d</comment>
4. The default credentials for administration are <comment>admin</comment> with password <comment>shopware</comment>
5. Optional: Open the Mail catcher with <comment>symfony open:local:webmail</comment>

* <fg=blue>Read</> the documentation at <comment>https://developer.shopware.com/</>
45 changes: 45 additions & 0 deletions shopware/core/6.7/public/.htaccess.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# BEGIN Shopware
# The directives (lines) between "# BEGIN Shopware" and "# END Shopware" are dynamically generated. Any changes to the directives between these markers will be overwritten.

DirectoryIndex index.php

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

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]

# Sets the HTTP_AUTHORIZATION header removed by Apache
RewriteCond %{HTTP:Authorization} .
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]

# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

# Rewrite all other queries to the front controller.
RewriteCond %{REQUEST_URI} !^/(theme|media|thumbnail|bundles|css|fonts|js|recovery|sitemap) [NC]
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>

<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
</IfModule>
</IfModule>

<IfModule mod_headers.c>
<FilesMatch "\.(?i:svg)$">
Header set Content-Security-Policy "script-src 'none'"
</FilesMatch>
</IfModule>

# END Shopware
Loading

0 comments on commit 86aec33

Please sign in to comment.