10/10/2014 - SYMFONY
Bu örnekte prod, dev, stag ve test çevre birimlerini birbirlerinden ayıracağız.
Genel olarak dosya upload edilen klasörler 755 iznine sahiptirler. Ayrıca Ubuntu ve Mac için, burada belirtilen ve kendilerine özgü olan izinler uygulanmalıdır.
Aşağıdaki değişiklikten sonra composer update komutunu çalıştırmalısınız. Her zaman kesin olan paket versiyonlarını kullanın.
# football/composer.json
"minimum-stability": "stable",
"prefer-stable": true,
# football/app/AppKernel.php
in_array($this->getEnvironment(), array('test', 'dev', 'stag', 'prod'))
Mevcut olan football/web/app_dev.php dosyasının içeriğini kopyalayıp app_prod.php, app_dev.php, app_stag.php ve app_test.php dosyalarını yarattıktan sonra, sadece aşağıdaki değişiklikleri yapın.
$kernel = new AppKernel('prod', true);
$kernel = new AppKernel('stag', true);
$kernel = new AppKernel('dev', true);
$kernel = new AppKernel('test', true);
Muhtemelen elinizde football/app/config/config_stag.yml dosyası olmayacak, o nedenle onun içeriğini kopyalayıp football/app/config/config_test.yml dosyasını yaratın. Sonuçta elinizde 4 alanın dosyası olacak.
Yukarıda da belirtildiği gibi, Ubuntu ve Mac için gerekli olan izinler, test veritabanına "yazma" sorunu yaratabilir, bu nedenle "test" klasörü için sadece 755 izni yeterlidir.
# football/app/config/config_test.yml
#doctrine:
# dbal:
# driver: pdo_sqlite
# path: %kernel.cache_dir%/default.db
# charset: UTF8
doctrine:
dbal:
connections:
default:
driver: pdo_sqlite
path: %kernel.cache_dir%/default.db
charset: UTF8
Behat testlerinde kullanacağınız için, dummy klasörüne örnek bir kaç tane döküman ve resim ekleyebilirsiniz.
build
dummy
document # Dummy docs used by behat to upload
.gitkeep
image # Dummy images used by behat to upload
.gitkeep
phing
behat
report # Line by line scenario report (failed and succeeded list)
.gitkeep
screenshot # Screenshots of failed scenarios
.gitkeep
phpcpd # Copy/Paste Detector
.gitkeep
phpcs # CodeSniffer (similar to PHP-CS-Fixer)
.gitkeep
phpdoc # phpDocumentor
.gitkeep
phploc # Project size analyser
.gitkeep
phpmd # Mess Detector
.gitkeep
###
# PROJECT
###
/web/bundles/
/app/bootstrap.php.cache
/app/cache/*
/app/config/parameters.yml
/app/logs/*
!app/cache/.gitkeep
!app/logs/.gitkeep
/app/phpunit.xml
/app/upload/document/*
!/app/upload/document/.gitkeep
/web/upload/image/*
!/web/upload/image/.gitkeep
/vendor/
/bin/
/composer.phar
UPGRADE*.md
###
# BUILD
###
!/build/dummy/*
/build/phing/behat/report/*
!/build/phing/behat/report/.gitkeep
/build/phing/behat/screenshot/*
!/build/phing/behat/screenshot/.gitkeep
/build/phing/phpcpd/*
!/build/phing/phpcpd/.gitkeep
/build/phing/phpcs/*
!/build/phing/phpcs/.gitkeep
/build/phing/phpdoc/*
!/build/phing/phpdoc/.gitkeep
/build/phing/phploc/*
!/build/phing/phploc/.gitkeep
/build/phing/phpmd/*
!/build/phing/phpmd/.gitkeep
Bir tane .htaccess dosyasını web/upload/image/ klasörüne yerleştirmek, insanların sizin resimlerinize izinsiz olarak ulaşmalarını engellemeye yardımcı olur.
# football/app/config/parameters.yml.dist
parameters:
upload:
image_dir: ../web/upload/image/
document_dir: %kernel.root_dir%/upload/document/
valid_image_extensions:
- jpg
- jpeg
- gif
- png
thumbnail_settings:
height: 200
width: 200
red: 200
green: 0
blue: 0