1
0
Fork 0
InstallController:
- finished changing installation to new configuration class
Dieser Commit ist enthalten in:
DSB 2012-08-22 16:43:15 +00:00
Ursprung f0aeca93a9
Commit a2ac0b33e4
5 geänderte Dateien mit 37 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -265,14 +265,16 @@ class InstallController extends Msd_Controller_Action
return; return;
} }
$saveParam = $this->_getParam('save'); $saveParam = $this->_getParam('save', null);
$this->_config->setParam('dbuser', $options); $this->_config->setParam('dbuser', $options);
if ($saveParam !== null && $saveParam == 1) { if ($saveParam == 1) {
$this->_config->setParam('general.title', 'MySQLDumper'); $this->_config->setParam('general.title', 'MySQLDumper');
$this->_config->setParam('dbuser.defaultDb', $this->_getParam('defaultDb')); $this->_config->setParam('dbuser.defaultDb', $this->_getParam('defaultDb'));
$this->_config->save('mysqldumper.ini'); $this->_config->save('mysqldumper.ini');
Msd_Registry::setConfig($this->_config);
unset($_SESSION['msd_lang']); unset($_SESSION['msd_lang']);
unset($_SESSION['msd_install']); unset($_SESSION['msd_install']);
$this->_config->load('mysqldumper.ini');
$redirectUrl = $this->view->url(array('controller' => 'index', 'action' => 'index', null, true)); $redirectUrl = $this->view->url(array('controller' => 'index', 'action' => 'index', null, true));
$this->_response->setRedirect($redirectUrl); $this->_response->setRedirect($redirectUrl);
} }

Datei anzeigen

@ -37,12 +37,19 @@ class Msd_Action_Helper_AssignConfigAndLanguage extends Zend_Controller_Action_H
} }
$view = $this->getView(); $view = $this->getView();
if (Msd_Registry::getConfigFilename() == 'defaultConfig.ini') { $config = Msd_Registry::getConfig();
$redirectUrl = $view->serverUrl() . $view->url(array('controller' => 'install', 'action' => 'index', null, true)); if ($config->getParam('configFile', 'defaultConfig.ini') == 'defaultConfig.ini') {
$redirectUrl = $view->serverUrl() . $view->url(
array(
'controller' => 'install',
'action' => 'index',
null,
true)
);
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoUrl($redirectUrl); $redirector->gotoUrl($redirectUrl);
} }
$view->config = Msd_Registry::getConfig(); $view->config = $config;
$view->dynamicConfig = Msd_Registry::getDynamicConfig(); $view->dynamicConfig = Msd_Registry::getDynamicConfig();
$view->lang = Msd_Language::getInstance(); $view->lang = Msd_Language::getInstance();
} }

Datei anzeigen

@ -105,14 +105,14 @@ class Msd_Config
* Saves the configuration for the next request. * Saves the configuration for the next request.
* The filename is used for static storage. * The filename is used for static storage.
* *
* @param string filename The file name of the fiel to save (without path)
*
* @return bool * @return bool
*/ */
public function save($configFilenameAndPath = null) public function save($filename = null)
{ {
//$configFilename = $this->getParam('configFile'); if ($filename !== null) {
//echo "Dateiname: ". $configFilename; $this->_ioHandler->setConfigFilename($filename);
if ($configFilenameAndPath !== null) {
$this->_ioHandler->setConfigFilename(basename($configFilenameAndPath));
} }
return $this->_ioHandler->save($this->_config); return $this->_ioHandler->save($this->_config);

Datei anzeigen

@ -58,7 +58,7 @@ class Msd_Config_IoHandler_Default implements Msd_Config_IoHandler_Interface
} }
// Create new namespace for session access. // Create new namespace for session access.
$this->_sessionNamespace = new Zend_Session_Namespace('Config'); $this->_sessionNamespace = new Zend_Session_Namespace('config');
} }
/** /**
@ -103,6 +103,8 @@ class Msd_Config_IoHandler_Default implements Msd_Config_IoHandler_Interface
* *
* @param array $config Configuration to save. * @param array $config Configuration to save.
* *
* @throws Msd_Config_Exception
*
* @return bool * @return bool
*/ */
public function save($config) public function save($config)
@ -110,18 +112,23 @@ class Msd_Config_IoHandler_Default implements Msd_Config_IoHandler_Interface
if ($this->_iniConfig === null) { if ($this->_iniConfig === null) {
$this->_initIni($config); $this->_initIni($config);
} }
// Save config to session
$this->_sessionNamespace->config = $config;
// Save config to .ini file // Save config to .ini file
$this->_iniConfig->setIniData($config); $this->_iniConfig->setIniData($config);
return $this->_iniConfig->saveFile($this->_configFilename);
// Save config to session
$this->_sessionNamespace->config = $config;
if (!isset($this->_configDirectories[0])) {
throw new Msd_Config_Exception('No directory for saving the configuration set!');
}
$configDirectory = $this->_configDirectories[0];
return $this->_iniConfig->saveFile($configDirectory . '/' . $this->_configFilename);
} }
/** /**
* Initializes the .ini file handler and sets the full filename of the .ini file. * Initializes the .ini file handler and sets the full filename of the .ini file.
* *
* @param array Configuration as array * @param array $config Configuration as array
* *
* @return void * @return void
*/ */
@ -130,7 +137,7 @@ class Msd_Config_IoHandler_Default implements Msd_Config_IoHandler_Interface
foreach ($this->_configDirectories as $configDir) { foreach ($this->_configDirectories as $configDir) {
$filename = rtrim($configDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $this->_configFilename; $filename = rtrim($configDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $this->_configFilename;
if (file_exists($filename)) { if (file_exists($filename)) {
$this->_configFilename = $filename; $this->_configFilename = basename($filename);
$this->_iniConfig = new Msd_Ini($filename); $this->_iniConfig = new Msd_Ini($filename);
return; return;
} }

Datei anzeigen

@ -28,14 +28,14 @@ class Msd_Registry extends Zend_Registry
* *
* @const string * @const string
*/ */
const DYNAMIC_CONFIG_KEY = 'Dynamic'; const DYNAMIC_CONFIG_KEY = 'dynamic';
/** /**
* Key for the configuration. This is used inside the registry. * Key for the configuration. This is used inside the registry.
* *
* @const string * @const string
*/ */
const CONFIG_KEY = 'Config'; const CONFIG_KEY = 'config';
/** /**
* Returns the config instance if it has been registered, returns null otherwise. * Returns the config instance if it has been registered, returns null otherwise.