Skip to content

Commit a2f8804

Browse files
committedSep 8, 2017
SW-19269 - configure paths
1 parent a4570d0 commit a2f8804

33 files changed

+175
-3039
lines changed
 

‎.gitignore

+63-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,64 @@
1-
/var/*
2-
!/var/cache
3-
/var/cache/*
4-
!var/cache/.gitkeep
5-
!/var/logs
6-
/var/logs/*
7-
!var/logs/.gitkeep
8-
/vendor/
9-
/web/cache/
10-
/web/media/
11-
/web/engine/
12-
/web/themes/
1+
composer.lock
2+
133
.env
4+
5+
# PhpStorm-Project
6+
/.idea/
7+
8+
# Composer
9+
/composer.phar
10+
/vendor/*
11+
12+
# Themes
13+
/themes/*
14+
15+
# User installed plugins
16+
/Plugins/Community/Backend/*
17+
/Plugins/Community/Core/*
18+
/Plugins/Community/Frontend/*
19+
/Plugins/Local/Backend/*
20+
/Plugins/Local/Core/*
21+
/Plugins/Local/Frontend/*
22+
23+
/custom/plugins/*
24+
25+
26+
# Userconfigurations
27+
/config.php
28+
/config_*.php
29+
30+
# Caches/Proxies.php_cs
31+
.php_cs.cache
32+
/tests/Shopware/TempFiles/*
33+
/var/cache/*
34+
!/var/cache/.htaccess
35+
!/var/cache/clear_cache.sh
36+
/web/cache/*
37+
38+
# Log files
39+
/var/log/*
40+
!/var/log/.htaccess
41+
42+
43+
# User provided content
44+
/media/archive/*
45+
/media/image/*
46+
!/media/image/thumbnail
47+
/media/image/thumbnail/*
48+
/media/music/*
49+
/media/pdf/*
50+
/media/temp/*
51+
!/media/temp/.htaccess
52+
/media/unknown/*
53+
/media/video/*
54+
/media/vector/*
55+
56+
/files/documents/*
57+
!/files/documents/.htaccess
58+
/files/downloads/*
59+
60+
# Snippet exports
61+
/snippetsExport/
62+
63+
!**/.gitkeep
64+

‎web/.htaccess ‎.htaccess

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ RewriteEngine on
77
#RewriteCond %{HTTPS} !=on
88
#RewriteRule backend/(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
99

10+
RewriteRule shopware.dll shopware.php
1011
RewriteRule files/documents/.* engine [NC,L]
1112
RewriteRule backend/media/(.*) media/$1 [NC,L]
1213

14+
15+
#RewriteCond %{REQUEST_URI} (\/(engine/Shopware/Plugins/)\/)
16+
#RewriteCond %{REQUEST_FILENAME} -f
17+
#RewriteRule ^/vendor/shopware/shopware/engine/Shopware/Plugins/(.*)$ /Plugins/$1 [PT,L,QSA]
18+
1319
RewriteCond %{REQUEST_URI} !(\/(engine|files|templates|themes|web)\/)
1420
RewriteCond %{REQUEST_URI} !(\/media\/(archive|banner|image|music|pdf|unknown|video)\/)
1521
RewriteCond %{REQUEST_FILENAME} !-f
1622
RewriteCond %{REQUEST_FILENAME} !-d
17-
RewriteRule ^(.*)$ index.php [PT,L,QSA]
23+
RewriteRule ^(.*)$ shopware.php [PT,L,QSA]
1824

1925
# Fix missing authorization-header on fast_cgi installations
2026
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
@@ -103,6 +109,7 @@ DirectoryIndex shopware.php
103109
php_flag session.auto_start off
104110
php_flag suhosin.session.cryptua off
105111
php_flag zend.ze1_compatibility_mode off
112+
php_value always_populate_raw_post_data -1
106113
</IfModule>
107114

108115
# AddType x-mapp-php5 .php

‎Procfile

-1
This file was deleted.

‎README.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Composer template for Shopware projects
22

3-
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
4-
53
## Warning
64

75
This is a proof of concept and not production ready.

‎app/AppKernel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getCacheDir()
3030
*/
3131
public function getLogDir()
3232
{
33-
return dirname(__DIR__).'/var/logs';
33+
return dirname(__DIR__).'/var/log';
3434
}
3535

3636
protected function prepareContainer(ContainerBuilder $container)

‎app/autoload.php

-5
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,4 @@
1717
$dotenv->load();
1818
}
1919

20-
define('PUBLICDIR', dirname(__DIR__).'/web/');
21-
define('PROJECTDIR', dirname(__DIR__));
22-
define('FRONTENDTHEMEDIR', dirname(__DIR__).'/Themes');
23-
define('PUBLICPATH', '');
24-
2520
return $loader;

‎app/config/config.php

+28-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
$db = array_merge(['port' => 3306], parse_url(getenv(getenv('DATABASE_URL_NAME') ?: 'DATABASE_URL')));
44

5+
$projectDir = dirname(__DIR__, 2);
6+
57
return array_replace_recursive($this->loadConfig($this->AppPath() . 'Configs/Default.php'), [
68

79
'db' => [
@@ -19,11 +21,33 @@
1921
'showException' => true,
2022
'throwExceptions' => false,
2123
),
24+
'template' => [
25+
'forceCompile' => true,
26+
'templateDir' => $projectDir . '/themes',
27+
],
2228

2329
'plugin_directories' => [
2430
'Default' => $this->AppPath('Plugins_' . 'Default'),
25-
'Local' => PROJECTDIR . '/Plugins/Local/',
26-
'Community' => PROJECTDIR . '/Plugins/Community/',
31+
'Local' => $projectDir . '/Plugins/Local/',
32+
'Community' => $projectDir . '/Plugins/Community/',
33+
'ShopwarePlugins' => $projectDir .'/custom/plugins/',
2734
],
28-
]);
29-
35+
36+
'cdn' => [
37+
'liveMigration' => true,
38+
'adapters' => [
39+
'local' => [
40+
'path' => $projectDir,
41+
],
42+
],
43+
],
44+
'app' => [
45+
'rootDir' => $projectDir,
46+
'downloadsDir' => $projectDir . '/files/downloads',
47+
'documentsDir' => $projectDir . '/files/documents',
48+
],
49+
'web' => [
50+
'webDir' => $projectDir . '/web',
51+
'cacheDir' => $projectDir . '/web/cache',
52+
]
53+
]);

‎app/create_symlinks.sh

+38-13
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,41 @@ declare -r __DIR__=$(dirname $__FILE__)
1010
cd $__DIR__/..
1111
echo "Create symlinks in $__DIR__"
1212

13-
rm -rf web/themes/Backend/ExtJs/backend
14-
mkdir -p web/themes/Backend/ExtJs/backend
15-
ln -s ../../../../../vendor/shopware/shopware/themes/Backend/ExtJs/backend/_resources web/themes/Backend/ExtJs/backend/_resources
16-
17-
rm -rf web/engine/Library
18-
mkdir -p web/engine/Library
19-
ln -s ../../../vendor/shopware/shopware/engine/Library/CodeMirror web/engine/Library/CodeMirror
20-
ln -s ../../../vendor/shopware/shopware/engine/Library/ExtJs web/engine/Library/ExtJs
21-
ln -s ../../../vendor/shopware/shopware/engine/Library/TinyMce web/engine/Library/TinyMce
22-
23-
rm -rf web/themes/Frontend/Responsive/frontend/
24-
mkdir -p web/themes/Frontend/Responsive/frontend/
25-
ln -s ../../../../../vendor/shopware/shopware/themes/Frontend/Responsive/frontend/_public web/themes/Frontend/Responsive/frontend/_public
13+
rm -rf engine/Library
14+
mkdir -p engine/Library
15+
ln -s ../../vendor/shopware/shopware/engine/Library/CodeMirror engine/Library/CodeMirror
16+
ln -s ../../vendor/shopware/shopware/engine/Library/ExtJs engine/Library/ExtJs
17+
ln -s ../../vendor/shopware/shopware/engine/Library/TinyMce engine/Library/TinyMce
18+
19+
rm -rf themes/Frontend/Bare
20+
rm -rf themes/Frontend/Responsive
21+
rm -rf themes/Backend/ExtJs
22+
mkdir -p themes/Frontend
23+
mkdir -p themes/Backend
24+
ln -s ../../vendor/shopware/shopware/themes/Backend/ExtJs themes/Backend/ExtJs
25+
ln -s ../../vendor/shopware/shopware/themes/Frontend/Bare themes/Frontend/Bare
26+
ln -s ../../vendor/shopware/shopware/themes/Frontend/Responsive themes/Frontend/Responsive
27+
28+
# Medien
29+
#if [ ! -d media ]; then
30+
# cp -r vendor/shopware/shopware/media ./
31+
#fi
32+
#rm -rf vendor/shopware/shopware/media
33+
#ln -s ../../../media vendor/shopware/shopware/media
34+
35+
# Files
36+
#if [ ! -d files ]; then
37+
# cp -r vendor/shopware/shopware/files ./
38+
#fi
39+
#rm -rf vendor/shopware/shopware/files
40+
#ln -s ../../../files vendor/shopware/shopware/files
41+
42+
# Web
43+
#if [ ! -d web ]; then
44+
# cp -r vendor/shopware/shopware/web ./
45+
#fi
46+
#rm -rf vendor/shopware/shopware/web
47+
#ln -s ../../../web vendor/shopware/shopware/web
48+
49+
#rm -rf Plugins/Default
50+
#ln -s ../vendor/shopware/shopware/engine/Shopware/Plugins/Default Plugins/Default

‎app/install.sh

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@ set -o pipefail
55

66
# Set magic variables for current FILE & DIR
77
declare -r __FILE__=$(readlink -f ${BASH_SOURCE[0]})
8-
declare -r __DIR__=$(dirname $__FILE__)
8+
declare -r __DIR__=$(dirname ${__FILE__})
99

1010
# Source .env file
1111
if [ -f $__DIR__/../.env ]; then
1212
echo Found .env
1313
source $__DIR__/../.env
1414
fi
1515

16-
$__DIR__/../bin/console sw:cache:clear
1716

18-
$__DIR__/../bin/console sw:database:setup --steps=drop,create,import
17+
${__DIR__}/../bin/console sw:cache:clear
18+
19+
${__DIR__}/../bin/console sw:database:setup --steps=drop,create,import
1920

2021
if [ $IMPORT_DEMODATA = true ] ; then
21-
$__DIR__/../bin/console sw:database:setup --steps=importDemodata
22+
${__DIR__}/../bin/console sw:database:setup --steps=importDemodata
2223
fi
2324

24-
$__DIR__/../bin/console sw:database:setup --steps=setupShop --shop-url="$SHOP_URL"
25-
26-
$__DIR__/../bin/console sw:snippets:to:db --include-plugins
25+
${__DIR__}/../bin/console sw:database:setup --steps=setupShop --shop-url="$SHOP_URL"
2726

28-
$__DIR__/../bin/console sw:theme:initialize
27+
${__DIR__}/create_symlinks.sh
2928

30-
$__DIR__/../bin/console sw:firstrunwizard:disable
29+
${__DIR__}/../bin/console sw:snippets:to:db --include-plugins
3130

32-
$__DIR__/../bin/console sw:admin:create --name="$ADMIN_NAME" --email="$ADMIN_EMAIL" --username="$ADMIN_USERNAME" --password="$ADMIN_PASSWORD" -n
31+
${__DIR__}/../bin/console sw:theme:initialize
3332

34-
$__DIR__/create_symlinks.sh
33+
${__DIR__}/../bin/console sw:firstrunwizard:disable
3534

35+
${__DIR__}/../bin/console sw:admin:create --name="$ADMIN_NAME" --email="$ADMIN_EMAIL" --username="$ADMIN_USERNAME" --password="$ADMIN_PASSWORD" -n

‎composer.json

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "bcremer/shopware-composer-project",
2+
"name": "shopware/shopware-composer",
33
"description": "Project template for Shopware projects with composer",
44
"type": "project",
55
"license": "MIT",
66
"authors": [
77
{
8-
"name": "Benjamin Cremer",
9-
"email": "bc@shopware.com"
8+
"name": "Shopware",
9+
"email": "info@shopware.com"
1010
}
1111
],
1212
"autoload": {
@@ -16,15 +16,16 @@
1616
"repositories": [
1717
{
1818
"type": "vcs",
19-
"url": "https://github.com/bcremer/shopware"
19+
"url": "ssh://git@stash.shopware.com/sw/shopware.git"
2020
}
2121
],
2222
"require": {
2323
"php": "^5.6.4||^7.0",
2424
"ext-apcu": "*",
25-
"shopware/shopware": "dev-composer-project",
25+
"shopware/shopware": "dev-sw-19269/5.4/composer-configurable-paths",
2626
"composer/installers": "^1.0",
27-
"vlucas/phpdotenv": "~2.0"
27+
"vlucas/phpdotenv": "~2.0",
28+
"shyim/shopware-profiler": "^1.0"
2829
},
2930
"extra": {
3031
"installer-paths": {
@@ -39,9 +40,6 @@
3940
"scripts": {
4041
"post-root-package-install": [
4142
"php -r \"copy('.env.example', '.env');\""
42-
],
43-
"post-install-cmd": [
44-
"app/update.sh"
4543
]
4644
}
4745
}

‎composer.lock

-2,972
This file was deleted.
File renamed without changes.

‎engine/Library/CodeMirror

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../vendor/shopware/shopware/engine/Library/CodeMirror

‎engine/Library/ExtJs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../vendor/shopware/shopware/engine/Library/ExtJs

‎engine/Library/TinyMce

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../vendor/shopware/shopware/engine/Library/TinyMce
Loading
Loading
Loading

‎files/documents/.htaccess

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Deny all requests from Apache 2.4+.
2+
<IfModule mod_authz_core.c>
3+
Require all denied
4+
</IfModule>
5+
6+
# Deny all requests from Apache 2.0-2.2.
7+
<IfModule !mod_authz_core.c>
8+
Deny from all
9+
</IfModule>

‎media/.htaccess

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<IfModule mod_rewrite.c>
2+
RewriteEngine on
3+
4+
RewriteCond %{REQUEST_FILENAME} !-f
5+
RewriteRule ^(.*)$ ../shopware.php?controller=Media&action=fallback [PT,L,QSA]
6+
</IfModule>
File renamed without changes.

‎src/.gitkeep ‎media/image/.gitkeep

File renamed without changes.
File renamed without changes.

‎media/music/.gitkeep

Whitespace-only changes.

‎media/pdf/.gitkeep

Whitespace-only changes.

‎media/temp/.gitkeep

Whitespace-only changes.

‎media/unknown/.gitkeep

Whitespace-only changes.

‎media/vector/.gitkeep

Whitespace-only changes.

‎media/video/.gitkeep

Whitespace-only changes.

‎web/index.php ‎shopware.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/**
77
* @var Composer\Autoload\ClassLoader
88
*/
9-
$loader = require __DIR__.'/../app/autoload.php';
9+
$loader = require __DIR__.'/app/autoload.php';
1010

1111
$environment = getenv('SHOPWARE_ENV');
1212
$kernel = new AppKernel($environment, $environment !== 'production');
@@ -16,10 +16,5 @@
1616

1717
$request = Request::createFromGlobals();
1818

19-
// Trust the heroku load balancer
20-
// see: https://devcenter.heroku.com/articles/getting-started-with-symfony#trusting-the-load-balancer
21-
Request::setTrustedProxies([$request->server->get('REMOTE_ADDR')]);
22-
Request::setTrustedHeaderName(Request::HEADER_FORWARDED, null);
23-
2419
$response = $kernel->handle($request);
2520
$response->send();

‎var/log/.gitkeep

Whitespace-only changes.

‎web/.user.ini

-2
This file was deleted.

‎web/cache/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)
Please sign in to comment.