commit ff2b383b57ac2fc384eff398aed504d6b1741fe1
parent 9560f5ff00717ff5245f12c9436fd3b4d8cffac8
Author: Felicitus <felicitus@felicitus.org>
Date: Sun, 15 Nov 2015 17:48:46 +0100
Refactored most parameters to be set by the setup
Diffstat:
13 files changed, 56 insertions(+), 29 deletions(-)
diff --git a/app/config/config.yml b/app/config/config.yml
@@ -10,9 +10,6 @@ imports:
- { resource: config_partkeepr.yml }
- { resource: config_filesystem.yml }
-parameters:
- max_users: unlimited
-
fos_rest:
body_listener: true
format_listener: true
diff --git a/app/config/config_filesystem.yml b/app/config/config_filesystem.yml
@@ -1,36 +1,32 @@
-parameters:
- data_directory: %kernel.root_dir%/../data/
- quota: false
-
knp_gaufrette:
adapters:
iclogo:
local:
- directory: %data_directory%images/iclogo/
+ directory: %partkeepr.filesystem.data_directory%images/iclogo/
temp:
local:
- directory: %data_directory%temp/
+ directory: %partkeepr.filesystem.data_directory%temp/
tempfile:
local:
- directory: %data_directory%files/Temporary/
+ directory: %partkeepr.filesystem.data_directory%files/Temporary/
footprintattachment:
local:
- directory: %data_directory%files/FootprintAttachment/
+ directory: %partkeepr.filesystem.data_directory%files/FootprintAttachment/
footprint:
local:
- directory: %data_directory%images/footprint/
+ directory: %partkeepr.filesystem.data_directory%images/footprint/
partattachment:
local:
- directory: %data_directory%files/PartAttachment/
+ directory: %partkeepr.filesystem.data_directory%files/PartAttachment/
storagelocation:
local:
- directory: %data_directory%images/storagelocation/
+ directory: %partkeepr.filesystem.data_directory%images/storagelocation/
mimetype_icons:
local:
directory: %kernel.root_dir%/../src/PartKeepr/MimetypeIconsBundle/Resources/public/images/mimes/
projectattachment:
local:
- directory: %data_directory%files/ProjectAttachment/
+ directory: %partkeepr.filesystem.data_directory%files/ProjectAttachment/
filesystems:
iclogo:
adapter: iclogo
diff --git a/app/config/partkeepr.yml b/app/config/partkeepr.yml
@@ -1,9 +1,6 @@
-parameters:
- partkeepr.category.path_separator: " ➤ "
-
partkeepr:
image_cache_directory: %kernel.cache_dir%/imagecache/
- cronjob_check: false
+ cronjob_check: %partkeepr.cronjob.check%
authentication_provider: %authentication_provider%
directories:
iclogo: %kernel.root_dir%/../data/images/iclogo/
diff --git a/src/PartKeepr/CoreBundle/Services/SystemService.php b/src/PartKeepr/CoreBundle/Services/SystemService.php
@@ -158,7 +158,7 @@ class SystemService extends ContainerAware
*/
public function getFreeDiskSpace()
{
- if ($this->container->getParameter("quota") === false) {
+ if ($this->container->getParameter("partkeepr.filesystem.quota") === false) {
return disk_free_space($this->container->getParameter("data_directory"));
} else {
return $this->getTotalDiskSpace() - $this->getUsedDiskSpace();
@@ -167,10 +167,10 @@ class SystemService extends ContainerAware
public function getTotalDiskSpace()
{
- if ($this->container->getParameter("quota") === false) {
+ if ($this->container->getParameter("partkeepr.filesystem.quota") === false) {
return disk_total_space($this->container->getParameter("data_directory"));
} else {
- return $this->container->getParameter("quota");
+ return $this->container->getParameter("partkeepr.filesystem.quota");
}
}
@@ -183,7 +183,7 @@ class SystemService extends ContainerAware
*/
public function getUsedDiskSpace()
{
- if ($this->container->getParameter("quota") === false) {
+ if ($this->container->getParameter("partkeepr.filesystem.quota") === false) {
return $this->getTotalDiskSpace() - $this->getFreeDiskSpace();
}
diff --git a/src/PartKeepr/FrontendBundle/Controller/IndexController.php b/src/PartKeepr/FrontendBundle/Controller/IndexController.php
@@ -33,7 +33,6 @@ class IndexController extends Controller
$aParameters["availableImageFormats"] = array("JPG", "GIF", "PNG");
/* Automatic Login */
-
if ($this->getParameterWithDefault("partkeepr.frontend.auto_login.enabled", false) === true) {
$aParameters["autoLoginUsername"] = $this->getParameter("partkeepr.frontend.auto_login.username");
$aParameters["autoLoginPassword"] = $this->getParameter("partkeepr.frontend.auto_login.password");
@@ -43,7 +42,7 @@ class IndexController extends Controller
$aParameters["motd"] = $this->getParameterWithDefault("partkeepr.frontend.motd", false);
}
- $aParameters["max_users"] = $this->getParameter("max_users");
+ $aParameters["max_users"] = $this->getParameter("partkeepr.auth.max_users");
$aParameters["authentication_provider"] = $this->getParameter("partkeepr.authentication_provider");
$aParameters["tip_of_the_day_uri"] = $this->getParameter("partkeepr.tip_of_the_day_uri");
diff --git a/src/PartKeepr/SetupBundle/Controller/ExistingConfigParserController.php b/src/PartKeepr/SetupBundle/Controller/ExistingConfigParserController.php
@@ -65,6 +65,35 @@ class ExistingConfigParserController extends SetupController
}
$config["values"]["authentication_provider"] = "PartKeepr.Auth.HTTPBasicAuthenticationProvider";
+
+ if (array_key_exists("partkeepr.frontend.motd", $legacyConfig)) {
+ $config["values"]["partkeepr.frontend.motd"] = $legacyConfig["partkeepr.frontend.motd"];
+ }
+
+ if (array_key_exists("partkeepr.frontend.autologin.enabled", $legacyConfig)) {
+ $config["values"]["partkeepr.frontend.auto_login.enabled"] = $legacyConfig["partkeepr.frontend.autologin.enabled"];
+ }
+
+ if (array_key_exists("partkeepr.frontend.autologin.username", $legacyConfig)) {
+ $config["values"]["partkeepr.frontend.auto_login.username"] = $legacyConfig["partkeepr.frontend.autologin.username"];
+ }
+
+ if (array_key_exists("partkeepr.frontend.autologin.password", $legacyConfig)) {
+ $config["values"]["partkeepr.frontend.auto_login.password"] = $legacyConfig["partkeepr.frontend.autologin.password"];
+ }
+
+ if (array_key_exists("partkeepr.cronjobs.disablecheck", $legacyConfig)) {
+ $config["values"]["partkeepr.cronjob.check"] = $legacyConfig["partkeepr.cronjobs.disablecheck"];
+ }
+
+ if (array_key_exists("partkeepr.category.path_separator", $legacyConfig)) {
+ $config["values"]["partkeepr.category.path_separator"] = $legacyConfig["partkeepr.category.path_separator"];
+ }
+
+ if (array_key_exists("partkeepr.frontend.allow_password_change", $legacyConfig)) {
+ $config["values"]["partkeepr.auth.allow_password_change"] = $legacyConfig["partkeepr.frontend.allow_password_change"];
+ }
+
$response["config"] = $config;
}
diff --git a/src/PartKeepr/SetupBundle/Controller/SetupController.php b/src/PartKeepr/SetupBundle/Controller/SetupController.php
@@ -182,6 +182,12 @@ class SetupController extends Controller
"fr3d_ldap.user.attribute.username" => null,
"fr3d_ldap.user.attribute.name" => null,
"fr3d_ldap.user.attribute.email" => null,
+
+ "partkeepr.filesystem.data_directory" => "%kernel.root_dir%/../data/",
+ "partkeepr.cronjob.check" => true,
+ "partkeepr.filesystem.quota" => false,
+ "partkeepr.auth.max_users" => "unlimited",
+ "partkeepr.category.path_separator" => " ➤ "
);
$this->applyIf($parameters, $data["values"]);
diff --git a/web/setup/js/Cards/AuthKeyCard.js b/web/setup/js/Cards/AuthKeyCard.js
@@ -61,7 +61,7 @@ Ext.define('PartKeeprSetup.AuthKeyCard', {
if (this.authKey.isValid()) {
var config = PartKeeprSetup.getApplication().getSetupConfig();
- Ext.apply(config, {authKey: this.authKey.getValue()});
+ Ext.merge(config, {authKey: this.authKey.getValue()});
Ext.ComponentQuery.query('#nextBtn')[0].enable();
} else {
diff --git a/web/setup/js/Cards/DatabaseParametersCard.MySQL.js b/web/setup/js/Cards/DatabaseParametersCard.MySQL.js
@@ -214,7 +214,7 @@ Ext.define('PartKeeprSetup.DatabaseParametersCard.MySQL', {
var config = PartKeeprSetup.getApplication().getSetupConfig();
- Ext.apply(config, {
+ Ext.merge(config, {
values: {
database_driver: 'pdo_mysql',
database_host: this.hostname.getValue(),
diff --git a/web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js b/web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js
@@ -188,7 +188,7 @@ Ext.define('PartKeeprSetup.DatabaseParametersCard.PostgreSQL', {
var config = PartKeeprSetup.getApplication().getSetupConfig();
- Ext.apply(config, {
+ Ext.merge(config, {
database: {
database_driver: 'pdo_pgsql',
database_host: this.hostname.getValue(),
diff --git a/web/setup/js/PartKeeprSetup.js b/web/setup/js/PartKeeprSetup.js
@@ -36,6 +36,7 @@ Ext.application({
var win = Ext.create("Ext.window.Window", {
layout: "fit",
+ constrain: true,
title: "PartKeepr Setup",
items: Ext.create("PartKeeprSetup.SetupWizard")
});
diff --git a/web/setup/js/SetupTests/AbstractTest.js b/web/setup/js/SetupTests/AbstractTest.js
@@ -157,6 +157,7 @@ Ext.define('PartKeeprSetup.AbstractTest', {
onBeforeRunTest: function ()
{
this.params = PartKeeprSetup.getApplication().getSetupConfig();
+ console.log(this.params);
},
/**
* Gets called after test exeuction. Useful for post-processing any result
diff --git a/web/setup/js/SetupTests/ExistingConfigurationTest.js b/web/setup/js/SetupTests/ExistingConfigurationTest.js
@@ -11,7 +11,8 @@ Ext.define('PartKeeprSetup.ExistingConfigurationTest', {
if (data.config) {
var config = PartKeeprSetup.getApplication().getSetupConfig();
- Ext.apply(config, data.config);
+ Ext.merge(config, data.config);
+ console.log(config);
config.existingConfig = true;
}
}