Rename the preference setting `type' to `store'

refs #8234
This commit is contained in:
Johannes Meyer 2015-01-23 16:03:29 +01:00
parent 5fe5e22395
commit 2a543bb5ae
5 changed files with 10 additions and 12 deletions

View File

@ -4,10 +4,8 @@
namespace Icinga\Forms\Config\General; namespace Icinga\Forms\Config\General;
use DateTimeZone;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Data\ResourceFactory; use Icinga\Data\ResourceFactory;
use Icinga\Util\Translator;
use Icinga\Web\Form; use Icinga\Web\Form;
@ -46,7 +44,7 @@ class ApplicationConfigForm extends Form
$this->addElement( $this->addElement(
'select', 'select',
'preferences_type', 'preferences_store',
array( array(
'required' => true, 'required' => true,
'autosubmit' => true, 'autosubmit' => true,
@ -58,7 +56,7 @@ class ApplicationConfigForm extends Form
) )
) )
); );
if (isset($formData['preferences_type']) && $formData['preferences_type'] === 'db') { if (isset($formData['preferences_store']) && $formData['preferences_store'] === 'db') {
$backends = array(); $backends = array();
foreach (ResourceFactory::getResourceConfigs()->toArray() as $name => $resource) { foreach (ResourceFactory::getResourceConfigs()->toArray() as $name => $resource) {
if ($resource['type'] === 'db') { if ($resource['type'] === 'db') {

View File

@ -26,7 +26,7 @@ use Icinga\Data\Db\DbConnection;
* // Create a INI store * // Create a INI store
* $store = PreferencesStore::create( * $store = PreferencesStore::create(
* new ConfigObject( * new ConfigObject(
* 'type' => 'ini', * 'store' => 'ini',
* 'config_path' => '/path/to/preferences' * 'config_path' => '/path/to/preferences'
* ), * ),
* $user // Instance of \Icinga\User * $user // Instance of \Icinga\User
@ -117,9 +117,9 @@ abstract class PreferencesStore
*/ */
public static function create(ConfigObject $config, User $user) public static function create(ConfigObject $config, User $user)
{ {
if (($type = $config->type) === null) { if (($type = $config->store) === null) {
throw new ConfigurationError( throw new ConfigurationError(
'Preferences configuration is missing the type directive' 'Preferences configuration is missing the store directive'
); );
} }

View File

@ -70,7 +70,7 @@ class PreferencesPage extends Form
$this->addElement( $this->addElement(
'select', 'select',
'type', 'store',
array( array(
'required' => true, 'required' => true,
'label' => $this->translate('User Preference Storage Type'), 'label' => $this->translate('User Preference Storage Type'),

View File

@ -29,7 +29,7 @@ class GeneralConfigStep extends Step
$config[$section][$property] = $value; $config[$section][$property] = $value;
} }
$config['preferences']['type'] = $this->data['preferencesType']; $config['preferences']['store'] = $this->data['preferencesStore'];
if (isset($this->data['preferencesResource'])) { if (isset($this->data['preferencesResource'])) {
$config['preferences']['resource'] = $this->data['preferencesResource']; $config['preferences']['resource'] = $this->data['preferencesResource'];
} }
@ -58,11 +58,11 @@ class GeneralConfigStep extends Step
$generalHtml = '' $generalHtml = ''
. '<ul>' . '<ul>'
. '<li>' . sprintf( . '<li>' . sprintf(
$this->data['preferencesType'] === 'ini' ? sprintf( $this->data['preferencesStore'] === 'ini' ? sprintf(
t('Preferences will be stored per user account in INI files at: %s'), t('Preferences will be stored per user account in INI files at: %s'),
Config::resolvePath('preferences') Config::resolvePath('preferences')
) : ( ) : (
$this->data['preferencesType'] === 'db' ? t('Preferences will be stored using a database.') : ( $this->data['preferencesStore'] === 'db' ? t('Preferences will be stored using a database.') : (
t('Preferences will not be persisted across browser sessions.') t('Preferences will not be persisted across browser sessions.')
) )
) )

View File

@ -293,7 +293,7 @@ class WebWizard extends Wizard implements SetupWizard
$setup->addStep( $setup->addStep(
new GeneralConfigStep(array( new GeneralConfigStep(array(
'generalConfig' => $pageData['setup_general_config'], 'generalConfig' => $pageData['setup_general_config'],
'preferencesType' => $pageData['setup_preferences_type']['type'], 'preferencesStore' => $pageData['setup_preferences_type']['store'],
'preferencesResource' => isset($pageData['setup_db_resource']['name']) 'preferencesResource' => isset($pageData['setup_db_resource']['name'])
? $pageData['setup_db_resource']['name'] ? $pageData['setup_db_resource']['name']
: null : null