From 7bf701764ff5661d053244b263cfe0be423faef5 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Mon, 16 Jul 2018 11:51:01 +0200 Subject: Config : database, salt, inflections, datetime format --- app-from-scratch.sh | 8 ++++- fai_gestion/config/app.php | 70 ++-------------------------------------- fai_gestion/config/bootstrap.php | 5 ++- 3 files changed, 14 insertions(+), 69 deletions(-) diff --git a/app-from-scratch.sh b/app-from-scratch.sh index 91e5cf1..4d09168 100644 --- a/app-from-scratch.sh +++ b/app-from-scratch.sh @@ -88,12 +88,13 @@ cd ~/chd_gestion/ cat fai_gestion/.gitignore git add app-from-scratch.sh fai_gestion git commit -m "Cake 3.6.7 fresh install" - +# 4a3ec0ca3f7d0ca8776a6ee7f2a2615234395eb8 # Cake startup configuration sed --in-place -e 's#^/config/app.php#/config/app_credentials.php#' fai_gestion/.gitignore git add app-from-scratch.sh fai_gestion/.gitignore fai_gestion/config/app.php git commit -m "Config : add app.php to git without credentials" +# 8d39eb3d5ad5baee721a2c6518a8429fb0cbd1bf cat > config/app_credentials.php <<"EOT" [ - 'salt' => env('SECURITY_SALT', 'hexhexhexhexhexhexhexhexhexhexhexhexhexhexhexhexhexhexhexhexhexh'), + // See config/app_credentials.php ], /** @@ -223,7 +223,7 @@ return [ 'Email' => [ 'default' => [ 'transport' => 'default', - 'from' => 'you@localhost', + 'from' => 'question@intarnet.fr', //'charset' => 'utf-8', //'headerCharset' => 'utf-8', ], @@ -243,71 +243,7 @@ return [ * other RDBMS. */ 'Datasources' => [ - 'default' => [ - 'className' => 'Cake\Database\Connection', - 'driver' => 'Cake\Database\Driver\Mysql', - 'persistent' => false, - 'host' => 'localhost', - /* - * CakePHP will use the default DB port based on the driver selected - * MySQL on MAMP uses port 8889, MAMP users will want to uncomment - * the following line and set the port accordingly - */ - //'port' => 'non_standard_port_number', - 'username' => 'my_app', - 'password' => 'secret', - 'database' => 'my_app', - /* - * You do not need to set this flag to use full utf-8 encoding (internal default since CakePHP 3.6). - */ - //'encoding' => 'utf8mb4', - 'timezone' => 'UTC', - 'flags' => [], - 'cacheMetadata' => true, - 'log' => false, - - /** - * Set identifier quoting to true if you are using reserved words or - * special characters in your table or column names. Enabling this - * setting will result in queries built using the Query Builder having - * identifiers quoted when creating SQL. It should be noted that this - * decreases performance because each query needs to be traversed and - * manipulated before being executed. - */ - 'quoteIdentifiers' => false, - - /** - * During development, if using MySQL < 5.6, uncommenting the - * following line could boost the speed at which schema metadata is - * fetched from the database. It can also be set directly with the - * mysql configuration directive 'innodb_stats_on_metadata = 0' - * which is the recommended value in production environments - */ - //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], - - 'url' => env('DATABASE_URL', null), - ], - - /** - * The test connection is used during the test suite. - */ - 'test' => [ - 'className' => 'Cake\Database\Connection', - 'driver' => 'Cake\Database\Driver\Mysql', - 'persistent' => false, - 'host' => 'localhost', - //'port' => 'non_standard_port_number', - 'username' => 'my_app', - 'password' => 'secret', - 'database' => 'test_myapp', - //'encoding' => 'utf8mb4', - 'timezone' => 'UTC', - 'cacheMetadata' => true, - 'quoteIdentifiers' => false, - 'log' => false, - //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], - 'url' => env('DATABASE_TEST_URL', null), - ], + // See config/app_credentials.php ], /** diff --git a/fai_gestion/config/bootstrap.php b/fai_gestion/config/bootstrap.php index 1911964..b68fbc9 100644 --- a/fai_gestion/config/bootstrap.php +++ b/fai_gestion/config/bootstrap.php @@ -78,6 +78,7 @@ try { * shared configuration. */ //Configure::load('app_local', 'default'); +Configure::load('app_credentials', 'default'); /* * When debug = true the metadata cache should only last @@ -184,7 +185,7 @@ Type::build('time') Type::build('date') ->useImmutable(); Type::build('datetime') - ->useImmutable(); + ->useImmutable()->useLocaleParser()->setLocaleFormat('yyyy-MM-dd'); Type::build('timestamp') ->useImmutable(); @@ -197,3 +198,5 @@ Type::build('timestamp') //Inflector::rules('irregular', ['red' => 'redlings']); //Inflector::rules('uninflected', ['dontinflectme']); //Inflector::rules('transliteration', ['/å/' => 'aa']); +Inflector::rules('uninflected', ['relais']); +Inflector::rules('irregular', ['interesse' => 'interesses']); -- cgit v1.1