|
From: <gem...@li...> - 2013-03-14 11:05:30
|
Revision: 1181
http://sourceforge.net/p/gemstracker/code/1181
Author: mennodekker
Date: 2013-03-14 11:05:26 +0000 (Thu, 14 Mar 2013)
Log Message:
-----------
Made default values for project.ini settings visible in project information
Modified Paths:
--------------
trunk/library/classes/Gems/Project/ProjectSettings.php
trunk/new_project/application/configs/project.ini
Modified: trunk/library/classes/Gems/Project/ProjectSettings.php
===================================================================
--- trunk/library/classes/Gems/Project/ProjectSettings.php 2013-03-14 10:43:13 UTC (rev 1180)
+++ trunk/library/classes/Gems/Project/ProjectSettings.php 2013-03-14 11:05:26 UTC (rev 1181)
@@ -94,15 +94,49 @@
} elseif (! is_array($array)) {
$array = (array) $array;
}
+
+ // Now load default values for (new) keys and merge them with the ones provided by project.ini
+ $projectValues = $array + $this->_getDefaultValues();
+
+ parent::__construct($projectValues, ArrayObject::ARRAY_AS_PROPS);
- parent::__construct($array, ArrayObject::ARRAY_AS_PROPS);
-
if (! ($this->offsetExists('name') && $this->offsetGet('name'))) {
$this->offsetSet('name', GEMS_PROJECT_NAME);
}
$this->offsetSet('multiLocale', $this->offsetExists('locales') && (count($this->offsetGet('locales')) > 1));
}
+
+ /**
+ * Set the default values for all keys.
+ *
+ * By doing this, we make sure the settings show up in the project information
+ * with the defaults even if the settings was not present in the project.ini
+ */
+ public function _getDefaultValues()
+ {
+
+ return array(
+ '>>> defaults <<<' => '>>> Below are default settings, since they were not found in your project.ini <<<',
+
+ // What to do when user is going to or has answered a survey
+ 'askNextDelay' => -1, // No auto advance
+ 'askDelay' => -1, // No auto advance
+
+ // How to react to false token attempts
+ 'askThrottle' => array(
+ 'period' => 15 * 60, // Detection window: 15 minutes
+ 'threshold' => 15 * 20, // Threshold: 20 requests per minute
+ 'delay' => 10 // Delay: 10 seconds
+ ),
+
+ 'cache' => 'apc', // Use apc cache as default
+
+ 'organization' => array(
+ 'default' => -1 // No default organization
+ )
+ );
+ }
/**
* Add recursively the rules active for this specific set of codes.
@@ -275,8 +309,8 @@
return -1;
}
+
-
/**
* Returns the public description of this project.
*
Modified: trunk/new_project/application/configs/project.ini
===================================================================
--- trunk/new_project/application/configs/project.ini 2013-03-14 10:43:13 UTC (rev 1180)
+++ trunk/new_project/application/configs/project.ini 2013-03-14 11:05:26 UTC (rev 1181)
@@ -87,7 +87,7 @@
;
; askDelay
;
-; When no askDelay is specified the user will see
+; When no askDelay is specified or is -1 the user will see
; greeting screen were he or she will a have to click
; on a button to fill in a survey.
;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|