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