partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 58398b2908c972f7a0c7c2b603eb8f82b42c1e8c
parent d48eafd2aeb5e80ca4027401bfc7f387399bb684
Author: Felicitus <felicitus@felicitus.org>
Date:   Sat, 28 Nov 2015 15:05:33 +0100

Configure the APC cache only if it exists

Diffstat:
Mapp/config/config_doctrine.yml | 3+++
Mapp/config/config_dunglas.yml | 2+-
Msrc/PartKeepr/SetupBundle/Controller/SetupController.php | 10+++++++++-
3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/app/config/config_doctrine.yml b/app/config/config_doctrine.yml @@ -18,6 +18,9 @@ doctrine: auto_generate_proxy_classes: %kernel.debug% connection: ~ auto_mapping: true + metadata_cache_driver: %cache.doctrine% + query_cache_driver: %cache.doctrine% + result_cache_driver: %cache.doctrine% mappings: gedmo_tree: type: annotation diff --git a/app/config/config_dunglas.yml b/app/config/config_dunglas.yml @@ -6,4 +6,4 @@ dunglas_api: items_per_page: client_can_change: true supported_formats: [ "jsonld", "csv", "xlsx" ] - cache: api.mapping.cache.apc + cache: %cache.dunglas% diff --git a/src/PartKeepr/SetupBundle/Controller/SetupController.php b/src/PartKeepr/SetupBundle/Controller/SetupController.php @@ -160,6 +160,7 @@ class SetupController extends Controller { $data = json_decode($request->getContent(), true); + // Parameter defaults to ensure they exist $parameters = array( "database_driver" => null, "database_host" => null, @@ -205,9 +206,16 @@ class SetupController extends Controller "partkeepr.cronjob.check" => true, "partkeepr.filesystem.quota" => false, "partkeepr.auth.max_users" => "unlimited", - "partkeepr.category.path_separator" => " ➤ " + "partkeepr.category.path_separator" => " ➤ ", + "cache.dunglas" => false, + "cache.doctrine" => "array" ); + if (function_exists("apc_fetch")) { + $parameters["cache.dunglas"] = "api.mapping.cache.apc"; + $parameters["cache.doctrine"] = "apc"; + } + $this->applyIf($parameters, $data["values"]); $parameters = array_merge($parameters, $data["values"]);