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;
}
$saveParam = $this->_getParam('save');
$saveParam = $this->_getParam('save', null);
$this->_config->setParam('dbuser', $options);
if ($saveParam !== null && $saveParam == 1) {
if ($saveParam == 1) {
$this->_config->setParam('general.title', 'MySQLDumper');
$this->_config->setParam('dbuser.defaultDb', $this->_getParam('defaultDb'));
$this->_config->save('mysqldumper.ini');
Msd_Registry::setConfig($this->_config);
unset($_SESSION['msd_lang']);
unset($_SESSION['msd_install']);
$this->_config->load('mysqldumper.ini');
$redirectUrl = $this->view->url(array('controller' => 'index', 'action' => 'index', null, true));
$this->_response->setRedirect($redirectUrl);
}

Datei anzeigen

@ -36,13 +36,20 @@ class Msd_Action_Helper_AssignConfigAndLanguage extends Zend_Controller_Action_H
return;
}
$view = $this->getView();
if (Msd_Registry::getConfigFilename() == 'defaultConfig.ini') {
$redirectUrl = $view->serverUrl() . $view->url(array('controller' => 'install', 'action' => 'index', null, true));
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$view = $this->getView();
$config = Msd_Registry::getConfig();
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->gotoUrl($redirectUrl);
}
$view->config = Msd_Registry::getConfig();
$view->config = $config;
$view->dynamicConfig = Msd_Registry::getDynamicConfig();
$view->lang = Msd_Language::getInstance();
}

Datei anzeigen

@ -105,14 +105,14 @@ class Msd_Config
* Saves the configuration for the next request.
* The filename is used for static storage.
*
* @param string filename The file name of the fiel to save (without path)
*
* @return bool
*/
public function save($configFilenameAndPath = null)
public function save($filename = null)
{
//$configFilename = $this->getParam('configFile');
//echo "Dateiname: ". $configFilename;
if ($configFilenameAndPath !== null) {
$this->_ioHandler->setConfigFilename(basename($configFilenameAndPath));
if ($filename !== null) {
$this->_ioHandler->setConfigFilename($filename);
}
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.
$this->_sessionNamespace = new Zend_Session_Namespace('Config');
$this->_sessionNamespace = new Zend_Session_Namespace('config');
}
/**
@ -101,7 +101,9 @@ class Msd_Config_IoHandler_Default implements Msd_Config_IoHandler_Interface
/**
* Saves the configuration to session and .ini file.
*
* @param array $config Configuration to save.
* @param array $config Configuration to save.
*
* @throws Msd_Config_Exception
*
* @return bool
*/
@ -110,18 +112,23 @@ class Msd_Config_IoHandler_Default implements Msd_Config_IoHandler_Interface
if ($this->_iniConfig === null) {
$this->_initIni($config);
}
// Save config to session
$this->_sessionNamespace->config = $config;
// Save config to .ini file
$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.
*
* @param array Configuration as array
* @param array $config Configuration as array
*
* @return void
*/
@ -130,7 +137,7 @@ class Msd_Config_IoHandler_Default implements Msd_Config_IoHandler_Interface
foreach ($this->_configDirectories as $configDir) {
$filename = rtrim($configDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $this->_configFilename;
if (file_exists($filename)) {
$this->_configFilename = $filename;
$this->_configFilename = basename($filename);
$this->_iniConfig = new Msd_Ini($filename);
return;
}

Datei anzeigen

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