Skip to content

Commit

Permalink
SW-19269 - configure paths
Browse files Browse the repository at this point in the history
  • Loading branch information
taltholtmann committed Sep 8, 2017
1 parent a4570d0 commit a2f8804
Show file tree
Hide file tree
Showing 33 changed files with 175 additions and 3,039 deletions.
75 changes: 63 additions & 12 deletions .gitignore
@@ -1,13 +1,64 @@
/var/*
!/var/cache
/var/cache/*
!var/cache/.gitkeep
!/var/logs
/var/logs/*
!var/logs/.gitkeep
/vendor/
/web/cache/
/web/media/
/web/engine/
/web/themes/
composer.lock

.env

# PhpStorm-Project
/.idea/

# Composer
/composer.phar
/vendor/*

# Themes
/themes/*

# User installed plugins
/Plugins/Community/Backend/*
/Plugins/Community/Core/*
/Plugins/Community/Frontend/*
/Plugins/Local/Backend/*
/Plugins/Local/Core/*
/Plugins/Local/Frontend/*

/custom/plugins/*


# Userconfigurations
/config.php
/config_*.php

# Caches/Proxies.php_cs
.php_cs.cache
/tests/Shopware/TempFiles/*
/var/cache/*
!/var/cache/.htaccess
!/var/cache/clear_cache.sh
/web/cache/*

# Log files
/var/log/*
!/var/log/.htaccess


# User provided content
/media/archive/*
/media/image/*
!/media/image/thumbnail
/media/image/thumbnail/*
/media/music/*
/media/pdf/*
/media/temp/*
!/media/temp/.htaccess
/media/unknown/*
/media/video/*
/media/vector/*

/files/documents/*
!/files/documents/.htaccess
/files/downloads/*

# Snippet exports
/snippetsExport/

!**/.gitkeep

9 changes: 8 additions & 1 deletion web/.htaccess → .htaccess
Expand Up @@ -7,14 +7,20 @@ RewriteEngine on
#RewriteCond %{HTTPS} !=on
#RewriteRule backend/(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

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


#RewriteCond %{REQUEST_URI} (\/(engine/Shopware/Plugins/)\/)
#RewriteCond %{REQUEST_FILENAME} -f
#RewriteRule ^/vendor/shopware/shopware/engine/Shopware/Plugins/(.*)$ /Plugins/$1 [PT,L,QSA]

RewriteCond %{REQUEST_URI} !(\/(engine|files|templates|themes|web)\/)
RewriteCond %{REQUEST_URI} !(\/media\/(archive|banner|image|music|pdf|unknown|video)\/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [PT,L,QSA]
RewriteRule ^(.*)$ shopware.php [PT,L,QSA]

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

# AddType x-mapp-php5 .php
Expand Down
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

2 changes: 0 additions & 2 deletions README.md
@@ -1,7 +1,5 @@
# Composer template for Shopware projects

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

## Warning

This is a proof of concept and not production ready.
Expand Down
2 changes: 1 addition & 1 deletion app/AppKernel.php
Expand Up @@ -30,7 +30,7 @@ public function getCacheDir()
*/
public function getLogDir()
{
return dirname(__DIR__).'/var/logs';
return dirname(__DIR__).'/var/log';
}

protected function prepareContainer(ContainerBuilder $container)
Expand Down
5 changes: 0 additions & 5 deletions app/autoload.php
Expand Up @@ -17,9 +17,4 @@
$dotenv->load();
}

define('PUBLICDIR', dirname(__DIR__).'/web/');
define('PROJECTDIR', dirname(__DIR__));
define('FRONTENDTHEMEDIR', dirname(__DIR__).'/Themes');
define('PUBLICPATH', '');

return $loader;
32 changes: 28 additions & 4 deletions app/config/config.php
Expand Up @@ -2,6 +2,8 @@

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

$projectDir = dirname(__DIR__, 2);

return array_replace_recursive($this->loadConfig($this->AppPath() . 'Configs/Default.php'), [

'db' => [
Expand All @@ -19,11 +21,33 @@
'showException' => true,
'throwExceptions' => false,
),
'template' => [
'forceCompile' => true,
'templateDir' => $projectDir . '/themes',
],

'plugin_directories' => [
'Default' => $this->AppPath('Plugins_' . 'Default'),
'Local' => PROJECTDIR . '/Plugins/Local/',
'Community' => PROJECTDIR . '/Plugins/Community/',
'Local' => $projectDir . '/Plugins/Local/',
'Community' => $projectDir . '/Plugins/Community/',
'ShopwarePlugins' => $projectDir .'/custom/plugins/',
],
]);


'cdn' => [
'liveMigration' => true,
'adapters' => [
'local' => [
'path' => $projectDir,
],
],
],
'app' => [
'rootDir' => $projectDir,
'downloadsDir' => $projectDir . '/files/downloads',
'documentsDir' => $projectDir . '/files/documents',
],
'web' => [
'webDir' => $projectDir . '/web',
'cacheDir' => $projectDir . '/web/cache',
]
]);
51 changes: 38 additions & 13 deletions app/create_symlinks.sh
Expand Up @@ -10,16 +10,41 @@ declare -r __DIR__=$(dirname $__FILE__)
cd $__DIR__/..
echo "Create symlinks in $__DIR__"

rm -rf web/themes/Backend/ExtJs/backend
mkdir -p web/themes/Backend/ExtJs/backend
ln -s ../../../../../vendor/shopware/shopware/themes/Backend/ExtJs/backend/_resources web/themes/Backend/ExtJs/backend/_resources

rm -rf web/engine/Library
mkdir -p web/engine/Library
ln -s ../../../vendor/shopware/shopware/engine/Library/CodeMirror web/engine/Library/CodeMirror
ln -s ../../../vendor/shopware/shopware/engine/Library/ExtJs web/engine/Library/ExtJs
ln -s ../../../vendor/shopware/shopware/engine/Library/TinyMce web/engine/Library/TinyMce

rm -rf web/themes/Frontend/Responsive/frontend/
mkdir -p web/themes/Frontend/Responsive/frontend/
ln -s ../../../../../vendor/shopware/shopware/themes/Frontend/Responsive/frontend/_public web/themes/Frontend/Responsive/frontend/_public
rm -rf engine/Library
mkdir -p engine/Library
ln -s ../../vendor/shopware/shopware/engine/Library/CodeMirror engine/Library/CodeMirror
ln -s ../../vendor/shopware/shopware/engine/Library/ExtJs engine/Library/ExtJs
ln -s ../../vendor/shopware/shopware/engine/Library/TinyMce engine/Library/TinyMce

rm -rf themes/Frontend/Bare
rm -rf themes/Frontend/Responsive
rm -rf themes/Backend/ExtJs
mkdir -p themes/Frontend
mkdir -p themes/Backend
ln -s ../../vendor/shopware/shopware/themes/Backend/ExtJs themes/Backend/ExtJs
ln -s ../../vendor/shopware/shopware/themes/Frontend/Bare themes/Frontend/Bare
ln -s ../../vendor/shopware/shopware/themes/Frontend/Responsive themes/Frontend/Responsive

# Medien
#if [ ! -d media ]; then
# cp -r vendor/shopware/shopware/media ./
#fi
#rm -rf vendor/shopware/shopware/media
#ln -s ../../../media vendor/shopware/shopware/media

# Files
#if [ ! -d files ]; then
# cp -r vendor/shopware/shopware/files ./
#fi
#rm -rf vendor/shopware/shopware/files
#ln -s ../../../files vendor/shopware/shopware/files

# Web
#if [ ! -d web ]; then
# cp -r vendor/shopware/shopware/web ./
#fi
#rm -rf vendor/shopware/shopware/web
#ln -s ../../../web vendor/shopware/shopware/web

#rm -rf Plugins/Default
#ln -s ../vendor/shopware/shopware/engine/Shopware/Plugins/Default Plugins/Default
22 changes: 11 additions & 11 deletions app/install.sh
Expand Up @@ -5,31 +5,31 @@ set -o pipefail

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

# Source .env file
if [ -f $__DIR__/../.env ]; then
echo Found .env
source $__DIR__/../.env
fi

$__DIR__/../bin/console sw:cache:clear

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

${__DIR__}/../bin/console sw:database:setup --steps=drop,create,import

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

$__DIR__/../bin/console sw:database:setup --steps=setupShop --shop-url="$SHOP_URL"

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

$__DIR__/../bin/console sw:theme:initialize
${__DIR__}/create_symlinks.sh

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

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

$__DIR__/create_symlinks.sh
${__DIR__}/../bin/console sw:firstrunwizard:disable

${__DIR__}/../bin/console sw:admin:create --name="$ADMIN_NAME" --email="$ADMIN_EMAIL" --username="$ADMIN_USERNAME" --password="$ADMIN_PASSWORD" -n
16 changes: 7 additions & 9 deletions composer.json
@@ -1,12 +1,12 @@
{
"name": "bcremer/shopware-composer-project",
"name": "shopware/shopware-composer",
"description": "Project template for Shopware projects with composer",
"type": "project",
"license": "MIT",
"authors": [
{
"name": "Benjamin Cremer",
"email": "bc@shopware.com"
"name": "Shopware",
"email": "info@shopware.com"
}
],
"autoload": {
Expand All @@ -16,15 +16,16 @@
"repositories": [
{
"type": "vcs",
"url": "https://github.com/bcremer/shopware"
"url": "ssh://git@stash.shopware.com/sw/shopware.git"
}
],
"require": {
"php": "^5.6.4||^7.0",
"ext-apcu": "*",
"shopware/shopware": "dev-composer-project",
"shopware/shopware": "dev-sw-19269/5.4/composer-configurable-paths",
"composer/installers": "^1.0",
"vlucas/phpdotenv": "~2.0"
"vlucas/phpdotenv": "~2.0",
"shyim/shopware-profiler": "^1.0"
},
"extra": {
"installer-paths": {
Expand All @@ -39,9 +40,6 @@
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-install-cmd": [
"app/update.sh"
]
}
}

0 comments on commit a2f8804

Please sign in to comment.