Continued to switch the old configuration handling to the new one.
The configuration now is saved again. (Installer is still to do) QA
Dieser Commit ist enthalten in:
Ursprung
21f452a89b
Commit
0841d9a7a3
11 geänderte Dateien mit 59 neuen und 59 gelöschten Zeilen
|
@ -32,6 +32,12 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
{
|
||||
Zend_Session::setOptions(array('strict' => true));
|
||||
Zend_Session::start();
|
||||
|
||||
// check if server has magic quotes enabled and normalize params
|
||||
if ( (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() == 1)) {
|
||||
$_POST = Bootstrap::stripslashes_deep($_POST);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,22 +47,15 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
*/
|
||||
public function _initConfiguration()
|
||||
{
|
||||
$dynamicConfig = Msd_Registry::getDynamicConfig();
|
||||
if ($dynamicConfig === null) {
|
||||
$dynamicConfig = new Msd_Config_Dynamic();
|
||||
Msd_Registry::setDynamicConfig($dynamicConfig);
|
||||
}
|
||||
|
||||
$config = Msd_Registry::getConfig();
|
||||
if ($config === null) {
|
||||
$configFile = $dynamicConfig->getParam('configFile', 'defaultConfig.ini');
|
||||
$configFile = $dynamicConfig->getParam('configFile', 'mysqldumper.ini');
|
||||
$config = new Msd_Config(
|
||||
'Default',
|
||||
array('directories' => APPLICATION_PATH . '/configs')
|
||||
array('directories' => realpath(APPLICATION_PATH . '/../work/config'))
|
||||
);
|
||||
$config->load($configFile);
|
||||
}
|
||||
Msd_Registry::setConfig($config);
|
||||
Msd_Registry::setDynamicConfig($dynamicConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,5 +71,4 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
return $value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -254,10 +254,19 @@ class ConfigController extends Msd_Controller_Action
|
|||
if (!empty($ftpConfig)) {
|
||||
$index = max(array_keys($ftpConfig)) + 1;
|
||||
}
|
||||
$default = $this->view->config->load('defaultConfig');
|
||||
$default = $default->toArray();
|
||||
$ftpConfig[$index] = $default['ftp'][0];
|
||||
$this->view->config->Param('ftp', $ftpConfig);
|
||||
$default = array(
|
||||
'use' => "n",
|
||||
'timeout' => "10",
|
||||
'passiveMode' => "y",
|
||||
'ssl' => "n",
|
||||
'server' => "",
|
||||
'port' => "21",
|
||||
'user' => "",
|
||||
'pass' => "",
|
||||
'dir' => "/"
|
||||
);
|
||||
$ftpConfig[$index] = $default;
|
||||
$this->view->config->setParam('ftp', $ftpConfig);
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
||||
|
@ -436,9 +445,8 @@ class ConfigController extends Msd_Controller_Action
|
|||
} else {
|
||||
$configData = $form->getValidValues($postData);
|
||||
$configData = $this->_addNonConfigurableConfigParams($configData);
|
||||
$configValidator =
|
||||
new Application_Model_Config_FormValidator($configData);
|
||||
$configValidator->validate($this->view);
|
||||
$configValidator = new Application_Model_Config_FormValidator($configData);
|
||||
$configValidator->validateAndSaveConfig($this->view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class Application_Form_Config_Ftp extends Zend_Form_SubForm
|
|||
|
||||
$ftpConfig = $config->getParam('ftp');
|
||||
$ftpKeys = array_keys($ftpConfig);
|
||||
$nrOfFtpProfiles = count($ftpKeys, 1);
|
||||
$nrOfFtpProfiles = count($ftpKeys);
|
||||
foreach ($ftpKeys as $ftpConnectionId) {
|
||||
$this->_addRadioActivated($ftpConnectionId);
|
||||
$this->_addInputTimeout($ftpConnectionId);
|
||||
|
@ -60,9 +60,7 @@ class Application_Form_Config_Ftp extends Zend_Form_SubForm
|
|||
|
||||
$this->_addButtonsTestAndDelete($ftpConnectionId, $buttonDelete);
|
||||
|
||||
$legend = $this->_lang->getTranslator()->_('L_FTP_CONNECTION')
|
||||
. ' ' . ($ftpConnectionId + 1);
|
||||
|
||||
$legend = $this->_lang->getTranslator()->_('L_FTP_CONNECTION') . ' ' . ($ftpConnectionId + 1);
|
||||
$this->addDisplayGroup(
|
||||
array(
|
||||
'ftp_' . $ftpConnectionId . '_use',
|
||||
|
@ -342,8 +340,8 @@ class Application_Form_Config_Ftp extends Zend_Form_SubForm
|
|||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'content' =>
|
||||
$this->getView()->getIcon('delete') . ' ' .
|
||||
$this->_lang->getTranslator()->_('L_FTP_CONNECTION_DELETE'),
|
||||
$this->getView()->getIcon('delete') . ' '
|
||||
. $this->_lang->getTranslator()->_('L_FTP_CONNECTION_DELETE'),
|
||||
'decorators' => array('LineEnd'),
|
||||
'escape' => false,
|
||||
'label' => '',
|
||||
|
@ -404,8 +402,10 @@ class Application_Form_Config_Ftp extends Zend_Form_SubForm
|
|||
/**
|
||||
* Set input default value
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @param string $name Var-Name
|
||||
* @param string $value The Value to set
|
||||
*
|
||||
* @return Zend_Form
|
||||
*/
|
||||
public function setDefault($name, $value)
|
||||
{
|
||||
|
|
|
@ -41,17 +41,17 @@ class Application_Model_Config_FormValidator
|
|||
}
|
||||
|
||||
/**
|
||||
* Validate config data
|
||||
* Validate config data and save when valid
|
||||
*
|
||||
* Checks database connection params.
|
||||
* If connection is successfull the values are saved to the config file.
|
||||
*
|
||||
* @param Zend_View $view The view of the form for adding messages
|
||||
*/
|
||||
public function validate(Zend_View $view)
|
||||
public function validateAndSaveConfig(Zend_View $view)
|
||||
{
|
||||
$saveConfig = false;
|
||||
$config = $view->config;
|
||||
$config = Msd_Registry::getConfig();
|
||||
$translator = Msd_Language::getInstance()->getTranslator();
|
||||
$db = Msd_Db::getAdapter($this->_configData['dbuser']);
|
||||
try {
|
||||
|
@ -72,19 +72,21 @@ class Application_Model_Config_FormValidator
|
|||
}
|
||||
|
||||
if ($saveConfig) {
|
||||
$config->save(
|
||||
$view->dynamicConfig->getParam('configFile'),
|
||||
$this->_configData
|
||||
);
|
||||
$config->setConfig($this->_configData);
|
||||
$saved = $config->save();
|
||||
if ($saved === true) {
|
||||
$view->popUpMessage()->addMessage(
|
||||
'save-config',
|
||||
'L_NOTICE',
|
||||
array('L_SAVE_SUCCESS', $view->dynamicConfig->getParam('configFile')),
|
||||
array('L_SAVE_SUCCESS', $view->config->getParam('general.title')),
|
||||
array(
|
||||
'modal' => true,
|
||||
'dialogClass' => 'notice'
|
||||
)
|
||||
);
|
||||
} else {
|
||||
die("Fehler beim Speichern der Konfiguration!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ class Msd_View_Helper_GetIcon extends Zend_View_Helper_Abstract
|
|||
*/
|
||||
public function getIcon($name, $title='', $size='')
|
||||
{
|
||||
//return true;
|
||||
static $baseUrl = false;
|
||||
if (!$baseUrl) {
|
||||
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
|
||||
|
@ -40,11 +39,12 @@ class Msd_View_Helper_GetIcon extends Zend_View_Helper_Abstract
|
|||
);
|
||||
}
|
||||
$img = '<img src="'.$baseUrl.'/%s/%s" alt="%s" title="%s" />';
|
||||
$config = Msd_Registry::getConfig();
|
||||
if ($size>'') {
|
||||
$img = '<img src="'.$baseUrl.'/%s/%sx%s/%s" alt="%s" title="%s" />';
|
||||
$ret = sprintf(
|
||||
$img,
|
||||
$this->view->config->getParam('paths.iconPath'),
|
||||
$config->getParam('paths.iconPath'),
|
||||
$size,
|
||||
$size,
|
||||
$icons[$name],
|
||||
|
@ -53,7 +53,7 @@ class Msd_View_Helper_GetIcon extends Zend_View_Helper_Abstract
|
|||
} else {
|
||||
$ret = sprintf(
|
||||
$img,
|
||||
$this->view->config->getParam('paths.iconPath'),
|
||||
$config->getParam('paths.iconPath'),
|
||||
$icons[$name],
|
||||
$title,
|
||||
$title
|
||||
|
|
|
@ -115,6 +115,7 @@ echo $this->partial(
|
|||
array('databases' => $dbs,
|
||||
'dbActual' => $this->dynamicConfig->getParam('dbActual'),
|
||||
'parent' => $this,
|
||||
'lang' => $this->lang
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -32,7 +32,7 @@ class Msd_Config_Dynamic
|
|||
*/
|
||||
public function __construct($sessionNsName = 'Dynamic')
|
||||
{
|
||||
$this->_namespace = new Zend_Session_Namespace($sessionNsName);
|
||||
$this->_namespace = new Zend_Session_Namespace($sessionNsName, true);
|
||||
$this->getDynamicValues();
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ class Msd_Config_IoHandler_Default implements Msd_Config_IoHandler_Interface
|
|||
// Search for the config file in the given directories.
|
||||
$this->_initIni();
|
||||
$config = $this->_iniConfig->getIniData();
|
||||
|
||||
// Put configuration into session.
|
||||
$this->_sessionNamespace->config = $config;
|
||||
}
|
||||
|
|
|
@ -49,10 +49,12 @@ abstract class Msd_Form_Decorator_Abstract extends Zend_Form_Decorator_Abstract
|
|||
$element = $this->getElement();
|
||||
$helper = $element->helper;
|
||||
$value = $element->getValue();
|
||||
/*
|
||||
$translator = $element->getTranslator();
|
||||
if ($translator !== null) {
|
||||
$value = $translator->translate($value);
|
||||
}
|
||||
*/
|
||||
$ret = $element->getView()->$helper(
|
||||
$element->getName(),
|
||||
$value,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Abstract decorator for form elements of Msd_Form
|
||||
* Registry
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Registry
|
||||
|
|
|
@ -2,13 +2,9 @@
|
|||
define('WORK_PATH', realpath(dirname(__FILE__) . '/../work'));
|
||||
|
||||
// Define path to application directory
|
||||
defined('APPLICATION_PATH') || define(
|
||||
'APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')
|
||||
);
|
||||
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
|
||||
|
||||
defined('LIBRARY_PATH') || define(
|
||||
'LIBRARY_PATH', realpath(dirname(__FILE__) . '/../library')
|
||||
);
|
||||
defined('LIBRARY_PATH') || define('LIBRARY_PATH', realpath(dirname(__FILE__) . '/../library'));
|
||||
|
||||
// Define application environment
|
||||
if (!defined('APPLICATION_ENV')) {
|
||||
|
@ -28,13 +24,7 @@ if (APPLICATION_ENV == 'development' && !class_exists('Debug')) {
|
|||
include_once 'Debug.php';
|
||||
}
|
||||
|
||||
|
||||
/** Zend_Application */
|
||||
require_once 'Zend/Application.php';
|
||||
|
||||
// Create application, bootstrap, and run
|
||||
$application = new Zend_Application(
|
||||
APPLICATION_ENV,
|
||||
APPLICATION_PATH . '/configs/application.ini'
|
||||
);
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
$application->bootstrap()->run();
|
||||
|
|
Laden …
In neuem Issue referenzieren