1
0
Fork 0

Continued to switch the old configuration handling to the new one.

Dieser Commit ist enthalten in:
DSB 2012-08-04 17:09:48 +00:00
Ursprung 025b5c339d
Commit ae87af916f
54 geänderte Dateien mit 501 neuen und 269 gelöschten Zeilen

Datei anzeigen

@ -41,16 +41,22 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
*/ */
public function _initConfiguration() public function _initConfiguration()
{ {
$dynamicConfig = new Msd_Config_Dynamic(); $dynamicConfig = Msd_Registry::getDynamicConfig();
$configFile = $dynamicConfig->getParam('configFile', 'defaultConfig.ini'); if ($dynamicConfig === null) {
$config = new Msd_Config( $dynamicConfig = new Msd_Config_Dynamic();
'Default', Msd_Registry::setDynamicConfig($dynamicConfig);
array('directories' => APPLICATION_PATH . '/configs') }
);
$config->load($configFile);
Msd_Registry::setConfig($config);
Msd_Registry::setDynamicConfig($dynamicConfig); $config = Msd_Registry::getConfig();
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);
} }
/** /**

Datei anzeigen

@ -16,7 +16,7 @@
* @package MySQLDumper * @package MySQLDumper
* @subpackage Controllers * @subpackage Controllers
*/ */
class ConfigController extends Zend_Controller_Action class ConfigController extends Msd_Controller_Action
{ {
/** /**
* Active jQuery tab Id * Active jQuery tab Id
@ -61,7 +61,7 @@ class ConfigController extends Zend_Controller_Action
$formGeneral = $this->_getSubformIni('general'); $formGeneral = $this->_getSubformIni('general');
$elementTitle = $formGeneral->getElement('title'); $elementTitle = $formGeneral->getElement('title');
$elementTitle->setValue( $elementTitle->setValue(
$this->view->config->get('config.general.title') $this->view->config->getParam('general.title')
); );
$form->addSubForm($formGeneral, 'general'); $form->addSubForm($formGeneral, 'general');
@ -184,9 +184,9 @@ class ConfigController extends Zend_Controller_Action
// set dynamic actual database if it's changed in the panel // set dynamic actual database if it's changed in the panel
if ($this->_request->isPost()) { if ($this->_request->isPost()) {
$actualDb = $this->view->config->get('dynamic.dbActual'); $actualDb = $this->view->dynamicConfig->getParam('dbActual');
if (isset($_POST['defaultDb']) && ($_POST['defaultDb'] != $actualDb)) { if (isset($_POST['defaultDb']) && ($_POST['defaultDb'] != $actualDb)) {
$this->view->config->set('dynamic.dbActual', $_POST['defaultDb']); $this->view->dynamicConfig->setParam('dbActual', $_POST['defaultDb']);
} }
} }
@ -214,7 +214,7 @@ class ConfigController extends Zend_Controller_Action
*/ */
public function addRecipientCcAction() public function addRecipientCcAction()
{ {
$recipientsCc = $this->view->config->get('config.email.RecipientCc'); $recipientsCc = $this->view->config->Param('email.RecipientCc');
if ($recipientsCc === null) { if ($recipientsCc === null) {
$recipientsCc = array(); $recipientsCc = array();
} }
@ -222,7 +222,7 @@ class ConfigController extends Zend_Controller_Action
$recipientsCc[$index]['Name'] = ''; $recipientsCc[$index]['Name'] = '';
$recipientsCc[$index]['Address'] = ''; $recipientsCc[$index]['Address'] = '';
$recipientsCc = array_values($recipientsCc); $recipientsCc = array_values($recipientsCc);
$this->view->config->set('config.email.RecipientCc', $recipientsCc); $this->view->config->setParam('email.RecipientCc', $recipientsCc);
$this->_forward('index'); $this->_forward('index');
} }
@ -234,11 +234,11 @@ class ConfigController extends Zend_Controller_Action
public function deleteRecipientCcAction() public function deleteRecipientCcAction()
{ {
$recipientToDelete = (int)$this->_request->getPost('param'); $recipientToDelete = (int)$this->_request->getPost('param');
$recipientsCc = $this->view->config->get('config.email.RecipientCc'); $recipientsCc = $this->view->config->getParam('email.RecipientCc');
if (isset($recipientsCc[$recipientToDelete])) { if (isset($recipientsCc[$recipientToDelete])) {
unset($recipientsCc[$recipientToDelete]); unset($recipientsCc[$recipientToDelete]);
} }
$this->view->config->set('config.email.RecipientCc', $recipientsCc); $this->view->config->setParam('email.RecipientCc', $recipientsCc);
$this->_forward('index'); $this->_forward('index');
} }
@ -249,18 +249,15 @@ class ConfigController extends Zend_Controller_Action
*/ */
public function addFtpConnectionAction() public function addFtpConnectionAction()
{ {
$ftpConfig = $this->view->config->get('config.ftp'); $ftpConfig = $this->view->config->getParam('ftp');
$index = 0; $index = 0;
if (!empty($ftpConfig)) { if (!empty($ftpConfig)) {
$index = max(array_keys($ftpConfig)) + 1; $index = max(array_keys($ftpConfig)) + 1;
} }
$default = $this->view->config->loadConfiguration( $default = $this->view->config->load('defaultConfig');
'defaultConfig',
false
);
$default = $default->toArray(); $default = $default->toArray();
$ftpConfig[$index] = $default['ftp'][0]; $ftpConfig[$index] = $default['ftp'][0];
$this->view->config->set('config.ftp', $ftpConfig); $this->view->config->Param('ftp', $ftpConfig);
$this->_forward('index'); $this->_forward('index');
} }
@ -272,13 +269,13 @@ class ConfigController extends Zend_Controller_Action
public function deleteFtpConnectionAction() public function deleteFtpConnectionAction()
{ {
$index = (int)$this->_request->getPost('param'); $index = (int)$this->_request->getPost('param');
$ftpConfig = $this->view->config->get('config.ftp'); $ftpConfig = $this->view->config->getParam('ftp');
if (count($ftpConfig) > 1) { if (count($ftpConfig) > 1) {
if (isset($ftpConfig[$index])) { if (isset($ftpConfig[$index])) {
unset($ftpConfig[$index]); unset($ftpConfig[$index]);
sort($ftpConfig); sort($ftpConfig);
} }
$this->view->config->set('config.ftp', $ftpConfig); $this->view->config->setParam('ftp', $ftpConfig);
} }
$this->_forward('index'); $this->_forward('index');
} }
@ -403,7 +400,7 @@ class ConfigController extends Zend_Controller_Action
foreach ($elements as $element) { foreach ($elements as $element) {
$element = str_replace($group . '_', '', $element); $element = str_replace($group . '_', '', $element);
$element = str_replace('_', '.', $element); $element = str_replace('_', '.', $element);
$value = $this->view->config->get('config.' . $group . '.' . $element); $value = $this->view->config->getParam($group . '.' . $element);
if ($value !== null) { if ($value !== null) {
$subForm->setDefault($element, $value); $subForm->setDefault($element, $value);
} }
@ -455,8 +452,7 @@ class ConfigController extends Zend_Controller_Action
*/ */
private function _addNonConfigurableConfigParams($configData) private function _addNonConfigurableConfigParams($configData)
{ {
$config = Msd_Configuration::getInstance(); $configData['systemDatabases'] = $this->view->config->getParam('systemDatabases');
$configData['systemDatabases'] = $config->get('config.systemDatabases');
return $configData; return $configData;
} }
@ -479,7 +475,7 @@ class ConfigController extends Zend_Controller_Action
$smtpConfig = $emailForm->getDisplayGroup('smtpConfig'); $smtpConfig = $emailForm->getDisplayGroup('smtpConfig');
$sendmailVisibility = false; $sendmailVisibility = false;
$smtpVisibility = false; $smtpVisibility = false;
switch ($this->view->config->get('config.email.Program')) { switch ($this->view->config->getParam('email.Program')) {
case 'sendmail': case 'sendmail':
$sendmailVisibility = true; $sendmailVisibility = true;
break; break;

Datei anzeigen

@ -16,7 +16,7 @@
* @package MySQLDumper * @package MySQLDumper
* @subpackage Controllers * @subpackage Controllers
*/ */
class DumpController extends Zend_Controller_Action class DumpController extends Msd_Controller_Action
{ {
/** /**
* Show dump page * Show dump page
@ -46,7 +46,6 @@ class DumpController extends Zend_Controller_Action
{ {
$taskList = Msd_TaskManager::getInstance('backupTasks'); $taskList = Msd_TaskManager::getInstance('backupTasks');
$tasks = $taskList->getTasks(); $tasks = $taskList->getTasks();
$this->view->config = Msd_Configuration::getInstance();
$this->view->sessionId = Zend_Session::getId(); $this->view->sessionId = Zend_Session::getId();
} }
@ -63,7 +62,7 @@ class DumpController extends Zend_Controller_Action
$tasks = $taskList->getTasks(); $tasks = $taskList->getTasks();
$ret = array( $ret = array(
'backup_in_progress' => false, 'backup_in_progress' => false,
'config_file' => $this->view->config->get('dynamic.configFile') 'config_file' => $this->view->dynamicConfig->getParam('configFile')
); );
echo json_encode($ret); echo json_encode($ret);

Datei anzeigen

@ -16,7 +16,7 @@
* @package MySQLDumper * @package MySQLDumper
* @subpackage Controllers * @subpackage Controllers
*/ */
class FilesController extends Zend_Controller_Action class FilesController extends Msd_Controller_Action
{ {
public function indexAction() public function indexAction()

Datei anzeigen

@ -16,7 +16,7 @@
* @package MySQLDumper * @package MySQLDumper
* @subpackage Controllers * @subpackage Controllers
*/ */
class IndexController extends Zend_Controller_Action class IndexController extends Msd_Controller_Action
{ {
/** /**
* Remember last controler * Remember last controler
@ -37,9 +37,9 @@ class IndexController extends Zend_Controller_Action
*/ */
public function init() public function init()
{ {
$request = $this->getRequest(); $request = $this->getRequest();
$this->_lastController = $request->getParam('lastController', 'index'); $this->_lastController = $request->getParam('lastController', 'index');
$this->_lastAction = $request->getParam('lastAction', 'index'); $this->_lastAction = $request->getParam('lastAction', 'index');
} }
/** /**
@ -60,22 +60,21 @@ class IndexController extends Zend_Controller_Action
} }
try { try {
$dbo = Msd_Db::getAdapter(); $dbo = Msd_Db::getAdapter();
$data = Msd_File::getLatestBackupInfo(); $data = Msd_File::getLatestBackupInfo();
if (!empty($data)) { if (!empty($data)) {
$statusline = Msd_File_Dump::getStatusline($data['filename']); $statusline = Msd_File_Dump::getStatusline($data['filename']);
$data['filename'] = $statusline['dbname']; $data['filename'] = $statusline['dbname'];
} else { } else {
$data['filename'] = ''; $data['filename'] = '';
} }
$data['mysqlServerVersion'] = $dbo->getServerInfo(); $data['mysqlServerVersion'] = $dbo->getServerInfo();
$data['mysqlClientVersion'] = $dbo->getClientInfo(); $data['mysqlClientVersion'] = $dbo->getClientInfo();
$data['serverMaxExecutionTime'] = $data['serverMaxExecutionTime'] = (int)@get_cfg_var('max_execution_time');
(int)@get_cfg_var('max_execution_time');
$this->view->assign($data); $this->view->assign($data);
if ($this->view->config->get('dynamic.dbActual') == '') { if ($this->view->dynamicConfig->getParam('dbActual', '') == '') {
$dbNames = $dbo->getDatabaseNames(); $dbNames = $dbo->getDatabaseNames();
$this->view->config->set('dynamic.dbActual', $dbNames[0]); $this->view->dynamicConfig->setParam('dbActual', $dbNames[0]);
} }
} catch (Exception $e) { } catch (Exception $e) {
$configNames = Msd_File::getConfigNames(); $configNames = Msd_File::getConfigNames();
@ -97,7 +96,7 @@ class IndexController extends Zend_Controller_Action
array('message' => 'L_MYSQL_VERSION_TOO_OLD') array('message' => 'L_MYSQL_VERSION_TOO_OLD')
); );
} }
$this->view->version = $version; $this->view->version = $version;
$this->view->dbAdapter = get_class($dbo); $this->view->dbAdapter = get_class($dbo);
} }
@ -112,9 +111,9 @@ class IndexController extends Zend_Controller_Action
{ {
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest(); $request = $this->getRequest();
$file = base64_decode($request->getParam('selectedConfig')); $file = base64_decode($request->getParam('selectedConfig'));
$this->view->config = Msd_Configuration::getInstance(); $this->_config->load($file);
$this->view->config->loadConfiguration($file); $this->view->config->load($file);
if ($this->_lastAction != 'switchconfig') { //prevent endless loop if ($this->_lastAction != 'switchconfig') { //prevent endless loop
$this->_forward($this->_lastAction, $this->_lastController); $this->_forward($this->_lastAction, $this->_lastController);
} }
@ -128,14 +127,14 @@ class IndexController extends Zend_Controller_Action
public function selectdbAction() public function selectdbAction()
{ {
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest(); $request = $this->getRequest();
$selectedDb = base64_decode($request->getParam('selectedDb')); $selectedDb = base64_decode($request->getParam('selectedDb'));
$this->view->config->set('dynamic.dbActual', $selectedDb); $this->view->dynamicConfig->setParam('dbActual', $selectedDb);
if ($this->_lastAction != 'selectdb') { //prevent endless loop if ($this->_lastAction != 'selectdb') { //prevent endless loop
$redirectUrl = $this->view->url( $redirectUrl = $this->view->url(
array( array(
'controller' => $this->_lastController, 'controller' => $this->_lastController,
'action' => $this->_lastAction, 'action' => $this->_lastAction,
), ),
null, null,
true true
@ -152,19 +151,19 @@ class IndexController extends Zend_Controller_Action
public function dbrefreshAction() public function dbrefreshAction()
{ {
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$dbo = Msd_Db::getAdapter(); $dbo = Msd_Db::getAdapter();
$databases = $dbo->getDatabaseNames(); $databases = $dbo->getDatabaseNames();
$this->view->config->set('dynamic.databases', $databases); $this->view->dynamicConfig->setParam('databases', $databases);
$actualDb = $this->view->config->get('dynamic.dbActual'); $actualDb = $this->view->dynamicConfig->getParam('dbActual');
if ($dbo->selectDb($actualDb) !== true) { if ($dbo->selectDb($actualDb) !== true) {
//actual db is no longer available -> switch to first one //actual db is no longer available -> switch to first one
$this->view->config->set('dynamic.dbActual', $databases[0]); $this->view->dynamicConfig->setParam('dbActual', $databases[0]);
} }
if ($this->_lastAction != 'refreshdb') { //prevent endless loop if ($this->_lastAction != 'refreshdb') { //prevent endless loop
$redirectUrl = $this->view->url( $redirectUrl = $this->view->url(
array( array(
'controller' => $this->_lastController, 'controller' => $this->_lastController,
'action' => $this->_lastAction, 'action' => $this->_lastAction,
), ),
null, null,
true true
@ -208,8 +207,8 @@ class IndexController extends Zend_Controller_Action
} }
$this->_doRedirect( $this->_doRedirect(
array( array(
'controller' => 'index', 'controller' => 'index',
'action' => 'login' 'action' => 'login'
) )
); );
} }
@ -223,11 +222,11 @@ class IndexController extends Zend_Controller_Action
{ {
$form = new Application_Form_Login(); $form = new Application_Form_Login();
if ($this->_request->isPost()) { if ($this->_request->isPost()) {
$user = new Msd_User(); $user = new Msd_User();
$postData = $this->_request->getParams(); $postData = $this->_request->getParams();
if ($form->isValid($postData)) { if ($form->isValid($postData)) {
$autoLogin = ($postData['autologin'] == 1) ? true : false; $autoLogin = ($postData['autologin'] == 1) ? true : false;
$loginResult = $user->login( $loginResult = $user->login(
$postData['user'], $postData['user'],
$postData['pass'], $postData['pass'],
$autoLogin $autoLogin
@ -239,8 +238,8 @@ class IndexController extends Zend_Controller_Action
// users.ini doesn't exist or doesn't have entries // users.ini doesn't exist or doesn't have entries
$this->_doRedirect( $this->_doRedirect(
array( array(
'controller' => 'install', 'controller' => 'install',
'action' => 'index' 'action' => 'index'
) )
); );
break; break;
@ -248,21 +247,17 @@ class IndexController extends Zend_Controller_Action
// user is not listed in users.ini // user is not listed in users.ini
break; break;
case Msd_User::SUCCESS: case Msd_User::SUCCESS:
$defaultDb = $this->view->config->get( $defaultDb = $this->view->config->getParam('dbuser.defaultDb'
'config.dbuser.defaultDb'
); );
// set actualDb to defaultDb // set actualDb to defaultDb
if ($defaultDb != '') { if ($defaultDb != '') {
$this->view->config->set( $this->view->dynamicConfig->setParam('dbActual', $defaultDb);
'dynamic.dbActual',
$defaultDb
);
} }
$this->_doRedirect( $this->_doRedirect(
array( array(
'controller' => 'index', 'controller' => 'index',
'action' => 'index' 'action' => 'index'
) )
); );
return; return;
@ -270,15 +265,15 @@ class IndexController extends Zend_Controller_Action
} }
// if we get here wrong credentials are given // if we get here wrong credentials are given
$this->view->popUpMessage() $this->view->popUpMessage()
->addMessage( ->addMessage(
'login-message', 'login-message',
'L_LOGIN', 'L_LOGIN',
$user->getAuthMessages(), $user->getAuthMessages(),
array( array(
'modal' => true, 'modal' => true,
'dialogClass' => 'error' 'dialogClass' => 'error'
) )
); );
} }
} }
$this->view->form = $form; $this->view->form = $form;

Datei anzeigen

@ -143,7 +143,7 @@ class InstallController extends Zend_Controller_Action
'config' => $config->get('paths.config'), 'config' => $config->get('paths.config'),
'log' => $config->get('paths.log'), 'log' => $config->get('paths.log'),
'backup' => $config->get('paths.backup'), 'backup' => $config->get('paths.backup'),
'iconpath' => $config->get('paths.iconpath') 'iconpath' => $config->get('paths.iconPath')
); );
foreach ($checkDirs as $checkDir) { foreach ($checkDirs as $checkDir) {

Datei anzeigen

@ -16,7 +16,7 @@
* @package MySQLDumper * @package MySQLDumper
* @subpackage Controllers * @subpackage Controllers
*/ */
class LogController extends Zend_Controller_Action class LogController extends Msd_Controller_Action
{ {
/** /**
* Delete a log file * Delete a log file
@ -78,7 +78,7 @@ class LogController extends Zend_Controller_Action
$reverse = $this->_getParam('reverse', 0); $reverse = $this->_getParam('reverse', 0);
$page = $this->_getParam('offset', 1); $page = $this->_getParam('offset', 1);
$entriesPerPage = $entriesPerPage =
$this->view->config->get('config.interface.recordsPerPage'); $this->view->config->getParam('interface.recordsPerPage');
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$logger = Msd_Log::getInstance(); $logger = Msd_Log::getInstance();
$lines = $logger->read($logType, $reverse); $lines = $logger->read($logType, $reverse);

Datei anzeigen

@ -16,7 +16,7 @@
* @package MySQLDumper * @package MySQLDumper
* @subpackage Controllers * @subpackage Controllers
*/ */
class RestoreController extends Zend_Controller_Action class RestoreController extends Msd_Controller_Action
{ {
public function indexAction() public function indexAction()
{ {

Datei anzeigen

@ -16,7 +16,7 @@
* @package MySQLDumper * @package MySQLDumper
* @subpackage Controllers * @subpackage Controllers
*/ */
class SqlController extends Zend_Controller_Action class SqlController extends Msd_Controller_Action
{ {
/** /**
* Db-handle * Db-handle
@ -54,7 +54,7 @@ class SqlController extends Zend_Controller_Action
$this->_helper->viewRenderer('databases/show-databases'); $this->_helper->viewRenderer('databases/show-databases');
$databases = $this->_db->getDatabases(true); $databases = $this->_db->getDatabases(true);
$dbNames = $this->_db->getDatabaseNames(); $dbNames = $this->_db->getDatabaseNames();
$dbActual = $this->view->config->get('dynamic.dbActual'); $dbActual = $this->view->dynamicConfig->getParam('dbActual');
//Fallback to first found db if actual db doesn't exist //Fallback to first found db if actual db doesn't exist
if (!in_array($dbActual, $dbNames)) { if (!in_array($dbActual, $dbNames)) {
$dbActual = $dbNames[0]; $dbActual = $dbNames[0];
@ -72,13 +72,11 @@ class SqlController extends Zend_Controller_Action
{ {
$this->_helper->viewRenderer('tables/show-tables'); $this->_helper->viewRenderer('tables/show-tables');
$pageNum = $this->_getParam('offset', 1); $pageNum = $this->_getParam('offset', 1);
$itemCountPerPage = $this->view->config->get( $itemCountPerPage = $this->view->config->getParam('interface.recordsPerPage');
'config.interface.recordsPerPage'
);
$dbActual = $this->_getParam( $dbActual = $this->_getParam(
'database', 'database',
$this->view->config->get('dynamic.dbActual') $this->view->dynamicConfig->getParam('dbActual')
); );
if ($this->_getParam('dbName') !== null) { if ($this->_getParam('dbName') !== null) {
$dbActual = base64_decode($this->_getParam('dbName')); $dbActual = base64_decode($this->_getParam('dbName'));
@ -106,11 +104,11 @@ class SqlController extends Zend_Controller_Action
public function showTableDataAction() public function showTableDataAction()
{ {
$this->_getDynamicParams(); $this->_getDynamicParams();
$dbName = $this->view->config->get('dynamic.dbActual'); $dbName = $this->view->dynamicConfig->getParam('dbActual');
$offset = (int)$this->_getParam('offset', 0); $offset = (int)$this->_getParam('offset', 0);
$limit = $this->view->config->get('config.interface.recordsPerPage'); $limit = $this->view->config->getParam('interface.recordsPerPage');
$this->_db->selectDb($dbName); $this->_db->selectDb($dbName);
$tableName = $this->view->config->get('dynamic.tableActual'); $tableName = $this->view->dynamicConfig->getParam('tableActual');
try { try {
$this->view->columns = $this->_db->getTableColumns($tableName); $this->view->columns = $this->_db->getTableColumns($tableName);
$tables = $this->_db->getTableStatus($tableName); $tables = $this->_db->getTableStatus($tableName);
@ -127,7 +125,7 @@ class SqlController extends Zend_Controller_Action
$tableName = ''; $tableName = '';
} }
} }
$this->view->config->set('dynamic.tableActual', $tableName); $this->view->dynamicConfig->setParam('tableActual', $tableName);
if (!empty($tables)) { if (!empty($tables)) {
$query = sprintf( $query = sprintf(
'SELECT SQL_CALC_FOUND_ROWS * FROM `%s` LIMIT %s, %s', 'SELECT SQL_CALC_FOUND_ROWS * FROM `%s` LIMIT %s, %s',
@ -253,7 +251,7 @@ class SqlController extends Zend_Controller_Action
$tables = $this->_request->getParam('tables', array()); $tables = $this->_request->getParam('tables', array());
$optimizeResults = array(); $optimizeResults = array();
$this->view->action = $this->view->lang->L_OPTIMIZE; $this->view->action = $this->view->lang->L_OPTIMIZE;
$database = $this->view->config->get('dynamic.dbActual'); $database = $this->view->dynamicConfig->getParam('dbActual');
$this->_db->selectDb($database); $this->_db->selectDb($database);
if ($this->_request->isPost() && !empty($tables)) { if ($this->_request->isPost() && !empty($tables)) {
@ -278,7 +276,7 @@ class SqlController extends Zend_Controller_Action
$tables = $this->_request->getParam('tables', array()); $tables = $this->_request->getParam('tables', array());
$analyzeResults = array(); $analyzeResults = array();
$this->view->action = $this->view->lang->L_ANALYZE; $this->view->action = $this->view->lang->L_ANALYZE;
$database = $this->view->config->get('dynamic.dbActual'); $database = $this->view->dynamicConfig->getParam('dbActual');
$this->_db->selectDb($database); $this->_db->selectDb($database);
if ($this->_request->isPost() && !empty($tables)) { if ($this->_request->isPost() && !empty($tables)) {
@ -303,7 +301,7 @@ class SqlController extends Zend_Controller_Action
$tables = $this->_request->getParam('tables', array()); $tables = $this->_request->getParam('tables', array());
$analyzeResults = array(); $analyzeResults = array();
$this->view->action = $this->view->lang->L_ANALYZE; $this->view->action = $this->view->lang->L_ANALYZE;
$database = $this->view->config->get('dynamic.dbActual'); $database = $this->view->dynamicConfig->getParam('dbActual');
$this->_db->selectDb($database); $this->_db->selectDb($database);
if ($this->_request->isPost() && !empty($tables)) { if ($this->_request->isPost() && !empty($tables)) {
@ -328,7 +326,7 @@ class SqlController extends Zend_Controller_Action
$tables = $this->_request->getParam('tables', array()); $tables = $this->_request->getParam('tables', array());
$analyzeResults = array(); $analyzeResults = array();
$this->view->action = $this->view->lang->L_ANALYZE; $this->view->action = $this->view->lang->L_ANALYZE;
$database = $this->view->config->get('dynamic.dbActual'); $database = $this->view->dynamicConfig->getParam('dbActual');
$this->_db->selectDb($database); $this->_db->selectDb($database);
if ($this->_request->isPost() && !empty($tables)) { if ($this->_request->isPost() && !empty($tables)) {
@ -353,7 +351,7 @@ class SqlController extends Zend_Controller_Action
$tables = $this->_request->getParam('tables', array()); $tables = $this->_request->getParam('tables', array());
$truncateResults = array(); $truncateResults = array();
$this->view->action = $this->view->lang->L_TRUNCATE; $this->view->action = $this->view->lang->L_TRUNCATE;
$database = $this->view->config->get('dynamic.dbActual'); $database = $this->view->dynamicConfig->getParam('dbActual');
$this->_db->selectDb($database); $this->_db->selectDb($database);
if ($this->_request->isPost() && !empty($tables)) { if ($this->_request->isPost() && !empty($tables)) {
@ -377,17 +375,17 @@ class SqlController extends Zend_Controller_Action
$sqlboxModel = new Application_Model_Sqlbox(); $sqlboxModel = new Application_Model_Sqlbox();
$this->view->tableSelectBox = $sqlboxModel->getTableSelectBox(); $this->view->tableSelectBox = $sqlboxModel->getTableSelectBox();
$request = $this->getRequest(); $request = $this->getRequest();
$config = $this->view->config; $dynamicConfig = $this->view->dynamicConfig;
$query = ''; $query = '';
if ($lastQuery = $config->get('dynamic.sqlboxQuery')) { if ($lastQuery = $dynamicConfig->getParam('sqlboxQuery')) {
$query = $lastQuery; $query = $lastQuery;
} }
if ($request->isPost()) { if ($request->isPost()) {
$query = $request->getParam('sqltextarea', ''); $query = $request->getParam('sqltextarea', '');
$config->set('dynamic.sqlboxQuery', $query); $dynamicConfig->setParam('sqlboxQuery', $query);
$query = trim($query); $query = trim($query);
if ($query > '') { if ($query > '') {
$this->_db->selectDb($config->get('dynamic.dbActual')); $this->_db->selectDb($dynamicConfig->getParam('dbActual'));
$sqlObject = new Msd_Sql_Object($query); $sqlObject = new Msd_Sql_Object($query);
$parser = new Msd_Sql_Parser($sqlObject, true); $parser = new Msd_Sql_Parser($sqlObject, true);
$parser->parse(); $parser->parse();
@ -430,7 +428,7 @@ class SqlController extends Zend_Controller_Action
private function _refreshDbList() private function _refreshDbList()
{ {
$databases = $this->_db->getDatabaseNames(); $databases = $this->_db->getDatabaseNames();
$this->view->config->set('dynamic.databases', $databases); $this->view->dynamicConfig->setParam('databases', $databases);
} }
/** /**
@ -444,10 +442,10 @@ class SqlController extends Zend_Controller_Action
private function _setDynamicParams($dbActual = false, $tableActual = '') private function _setDynamicParams($dbActual = false, $tableActual = '')
{ {
if ($dbActual === false) { if ($dbActual === false) {
$dbActual = $this->view->config->get('dynamic.dbActual'); $dbActual = $this->view->dynamicConfig->getParam('dbActual');
} }
$this->view->config->set('dynamic.dbActual', $dbActual); $this->view->dynamicConfig->setParam('dbActual', $dbActual);
$this->view->config->set('dynamic.tableActual', $tableActual); $this->view->dynamicConfig->setParam('tableActual', $tableActual);
} }
/** /**
@ -460,12 +458,12 @@ class SqlController extends Zend_Controller_Action
$params = $this->_request->getParams(); $params = $this->_request->getParams();
if (isset($params['dbName'])) { if (isset($params['dbName'])) {
$dbName = base64_decode($params['dbName']); $dbName = base64_decode($params['dbName']);
$this->view->config->set('dynamic.dbActual', $dbName); $this->view->dynamicConfig->setParam('dbActual', $dbName);
} }
if (isset($params['tableName'])) { if (isset($params['tableName'])) {
$dbName = base64_decode($params['tableName']); $dbName = base64_decode($params['tableName']);
$this->view->config->set('dynamic.tableActual', $dbName); $this->view->dynamicConfig->setParam('tableActual', $dbName);
} }
} }
} }

Datei anzeigen

@ -16,7 +16,7 @@
* @package MySQLDumper * @package MySQLDumper
* @subpackage Controllers * @subpackage Controllers
*/ */
class SqlServerController extends Zend_Controller_Action class SqlServerController extends Msd_Controller_Action
{ {
/** /**
* Init * Init

Datei anzeigen

@ -36,7 +36,7 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
*/ */
public function init() public function init()
{ {
$this->_config = Msd_Configuration::getInstance(); $this->_config = Msd_Registry::getConfig();
$this->_lang = Msd_Language::getInstance(); $this->_lang = Msd_Language::getInstance();
$this->setDisableLoadDefaultDecorators(true); $this->setDisableLoadDefaultDecorators(true);
$this->setDecorators(array('SubForm')); $this->setDecorators(array('SubForm'));
@ -58,7 +58,7 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
// add Recipients CC // add Recipients CC
$ccElements = $this->_setRecipientCc( $ccElements = $this->_setRecipientCc(
$this->_config->get('config.email.RecipientCc'), $this->_config->getParam('email.RecipientCc'),
$activateValidator $activateValidator
); );

Datei anzeigen

@ -29,7 +29,7 @@ class Application_Form_Config_Ftp extends Zend_Form_SubForm
*/ */
public function init() public function init()
{ {
$config = Msd_Configuration::getInstance(); $config = Msd_Registry::getConfig();
$this->_lang = Msd_Language::getInstance(); $this->_lang = Msd_Language::getInstance();
$this->setDisableLoadDefaultDecorators(true); $this->setDisableLoadDefaultDecorators(true);
$this->setDecorators(array('SubForm')); $this->setDecorators(array('SubForm'));
@ -40,7 +40,7 @@ class Application_Form_Config_Ftp extends Zend_Form_SubForm
$this->setDisplayGroupDecorators(array('DisplayGroup')); $this->setDisplayGroupDecorators(array('DisplayGroup'));
$this->_addButtonFtpAdd(); $this->_addButtonFtpAdd();
$ftpConfig = $config->get('config.ftp'); $ftpConfig = $config->getParam('ftp');
$ftpKeys = array_keys($ftpConfig); $ftpKeys = array_keys($ftpConfig);
$nrOfFtpProfiles = count($ftpKeys, 1); $nrOfFtpProfiles = count($ftpKeys, 1);
foreach ($ftpKeys as $ftpConnectionId) { foreach ($ftpKeys as $ftpConnectionId) {

Datei anzeigen

@ -51,7 +51,7 @@ class Application_Model_Config_FormValidator
public function validate(Zend_View $view) public function validate(Zend_View $view)
{ {
$saveConfig = false; $saveConfig = false;
$config = Msd_Configuration::getInstance(); $config = $view->config;
$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 {
@ -73,13 +73,13 @@ class Application_Model_Config_FormValidator
if ($saveConfig) { if ($saveConfig) {
$config->save( $config->save(
$config->get('dynamic.configFile'), $view->dynamicConfig->getParam('configFile'),
$this->_configData $this->_configData
); );
$view->popUpMessage()->addMessage( $view->popUpMessage()->addMessage(
'save-config', 'save-config',
'L_NOTICE', 'L_NOTICE',
array('L_SAVE_SUCCESS', $config->get('dynamic.configFile')), array('L_SAVE_SUCCESS', $view->dynamicConfig->getParam('configFile')),
array( array(
'modal' => true, 'modal' => true,
'dialogClass' => 'notice' 'dialogClass' => 'notice'

Datei anzeigen

@ -21,8 +21,8 @@ class Application_Model_Sqlbox
public function getTableSelectBox() public function getTableSelectBox()
{ {
$this->_db = Msd_Db::getAdapter(); $this->_db = Msd_Db::getAdapter();
$config = Msd_Configuration::getInstance(); $dynamicConfig = Msd_Registry::getDynamicConfig();
$db = $config->get('dynamic.dbActual'); $db = $dynamicConfig->getParam('dbActual');
$tableNames = $this->_db->getTables($db); $tableNames = $this->_db->getTables($db);
$options = array(); $options = array();
foreach ($tableNames as $table) { foreach ($tableNames as $table) {

Datei anzeigen

@ -19,8 +19,6 @@ class Msd_View_Helper_GetConfigTitle extends Zend_View_Helper_Abstract
{ {
public function getConfigTitle($configName) public function getConfigTitle($configName)
{ {
$config = Msd_Configuration::getInstance(); return $this->view->config->getConfigTitle($configName);
$configData = $config->loadConfiguration($configName, false);
return $configData->general->title;
} }
} }

Datei anzeigen

@ -28,6 +28,7 @@ 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();
@ -38,13 +39,12 @@ class Msd_View_Helper_GetIcon extends Zend_View_Helper_Abstract
'GetIcon: unknown icon \''.$name .'\' requested' 'GetIcon: unknown icon \''.$name .'\' requested'
); );
} }
$config = Msd_Configuration::getInstance();
$img = '<img src="'.$baseUrl.'/%s/%s" alt="%s" title="%s" />'; $img = '<img src="'.$baseUrl.'/%s/%s" alt="%s" title="%s" />';
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,
$config->get('paths.iconpath'), $this->view->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,
$config->get('paths.iconpath'), $this->view->config->getParam('paths.iconPath'),
$icons[$name], $icons[$name],
$title, $title,
$title $title
@ -71,10 +71,10 @@ class Msd_View_Helper_GetIcon extends Zend_View_Helper_Abstract
{ {
static $icons = false; static $icons = false;
if (!$icons) { if (!$icons) {
$config = Msd_Configuration::getInstance(); $config = $this->view->config;
$file = realpath( $file = realpath(
APPLICATION_PATH . '/../public/' APPLICATION_PATH . '/../public/'
. $config->get('paths.iconpath') . '/icon.ini' . $config->getParam('paths.iconPath') . '/icon.ini'
); );
$iconsIni = new Zend_Config_Ini($file, 'icons'); $iconsIni = new Zend_Config_Ini($file, 'icons');
$icons = $iconsIni->toArray(); $icons = $iconsIni->toArray();

Datei anzeigen

@ -37,20 +37,20 @@ class Msd_View_Helper_GetIconSrc extends Zend_View_Helper_Abstract
'GetIconSrc: unknown icon \''.$name . '\' requested' 'GetIconSrc: unknown icon \''.$name . '\' requested'
); );
} }
$config = Msd_Configuration::getInstance(); $config = Msd_Registry::getConfig();
$img = $baseUrl.'/%s/%s'; $img = $baseUrl.'/%s/%s';
if ($size>'') { if ($size>'') {
$img = $baseUrl.'/%s/%sx%s/%s'; $img = $baseUrl.'/%s/%sx%s/%s';
$ret = sprintf( $ret = sprintf(
$img, $img,
$config->get('paths.iconpath'), $config->getParam('paths.iconPath'),
$size, $size,
$size, $size,
$icons[$name] $icons[$name]
); );
} else { } else {
$ret = sprintf( $ret = sprintf(
$img, $config->get('paths.iconpath'), $icons[$name] $img, $config->getParam('paths.iconPath'), $icons[$name]
); );
} }
return $ret; return $ret;
@ -65,10 +65,10 @@ class Msd_View_Helper_GetIconSrc extends Zend_View_Helper_Abstract
{ {
static $icons = false; static $icons = false;
if (!$icons) { if (!$icons) {
$config = Msd_Configuration::getInstance(); $config = Msd_Registry::getConfig();
$file = realpath( $file = realpath(
APPLICATION_PATH . '/../public/' APPLICATION_PATH . '/../public/'
. $config->get('paths.iconpath') . '/icon.ini' . $config->getParam('paths.iconPath') . '/icon.ini'
); );
$iconsIni = new Zend_Config_Ini($file, 'icons'); $iconsIni = new Zend_Config_Ini($file, 'icons');
$icons = $iconsIni->toArray(); $icons = $iconsIni->toArray();

Datei anzeigen

@ -53,15 +53,15 @@ class Msd_View_Helper_Menu extends Zend_View_Helper_Abstract
*/ */
private function _getDatabases() private function _getDatabases()
{ {
$actualDb = $this->view->config->get('dynamic.dbActual'); $actualDb = $this->view->dynamicConfig->getParam('dbActual');
$databases = $this->view->config->get('dynamic.databases'); $databases = $this->view->dynamicConfig->getParam('databases', array());
$dbo = Msd_Db::getAdapter(); $dbo = Msd_Db::getAdapter();
if (empty($databases) || $dbo->selectDb($actualDb) !== true) { if (empty($databases) || $dbo->selectDb($actualDb) !== true) {
// couldn't connect to db - refresh db-list // couldn't connect to db - refresh db-list
$databases = $dbo->getDatabaseNames(); $databases = $dbo->getDatabaseNames();
// if database was deleted or is not accessible by user // if database was deleted or is not accessible by user
// fallback to default db // fallback to default db
$defaultDb = $this->view->config->get('config.dbuser.defaultDb'); $defaultDb = $this->view->config->getParam('dbuser.defaultDb');
if ($defaultDb != '') { if ($defaultDb != '') {
$actualDb = $defaultDb; $actualDb = $defaultDb;
if ($dbo->selectDb($actualDb) !== true) { if ($dbo->selectDb($actualDb) !== true) {
@ -70,8 +70,8 @@ class Msd_View_Helper_Menu extends Zend_View_Helper_Abstract
$dbo->selectDb($actualDb); $dbo->selectDb($actualDb);
} }
} }
$this->view->config->set('dynamic.dbActual', $actualDb); $this->view->dynamicConfig->setParam('dbActual', $actualDb);
$this->view->config->set('dynamic.databases', $databases); $this->view->dynamicConfig->setParam('databases', $databases);
} }
return $databases; return $databases;
} }

Datei anzeigen

@ -167,8 +167,7 @@ class Msd_View_Helper_PopUpMessage extends Zend_View_Helper_Abstract
*/ */
private function _getDefaultPosition() private function _getDefaultPosition()
{ {
$config = Msd_Configuration::getInstance(); $position = $this->view->config->getParam('interface.notificationWindowPosition');
$position = $config->get('config.interface.notificationWindowPosition');
if (isset($this->_positions[$position])) { if (isset($this->_positions[$position])) {
$position = $this->_positions[$position]; $position = $this->_positions[$position];
} }

Datei anzeigen

@ -1,9 +1,9 @@
<?php <?php
$version = new Msd_Version(); $version = new Msd_Version();
$config = Msd_Configuration::getInstance(); $config = Msd_Registry::getConfig();
$lang = Msd_Language::getInstance(); $lang = Msd_Language::getInstance();
$theme = $config->get('config.interface.theme'); $theme = $config->getParam('interface.theme');
$language = $config->get('config.interface.language'); $language = $config->getParam('interface.language');
$this->headMeta()->appendHttpEquiv('content-language', $language); $this->headMeta()->appendHttpEquiv('content-language', $language);
$this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8') $this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8')
->appendHttpEquiv('expires', 'Wed, 26 Feb 1997 08:21:57 GMT') ->appendHttpEquiv('expires', 'Wed, 26 Feb 1997 08:21:57 GMT')

Datei anzeigen

@ -1,10 +1,9 @@
<?php <?php
$version = new Msd_Version(); $version = new Msd_Version();
$config = Msd_Configuration::getInstance(); $config = Msd_Registry::getConfig();
$lang = Msd_Language::getInstance(); $lang = Msd_Language::getInstance();
$theme = $config->get('config.interface.theme'); //@todo why theme? $theme = $config->getParam('interface.theme'); //@todo why theme?
$language = $config->get('config.interface.language'); $language = $config->getParam('interface.language');
$this->headMeta()->appendHttpEquiv('content-language', $language); $this->headMeta()->appendHttpEquiv('content-language', $language);
$this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8') $this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8')
->appendHttpEquiv('expires', 'Wed, 26 Feb 1997 08:21:57 GMT') ->appendHttpEquiv('expires', 'Wed, 26 Feb 1997 08:21:57 GMT')
@ -47,4 +46,4 @@ $messages = (string) $this->popUpMessage();
echo $this->layout()->content; echo $this->layout()->content;
?> ?>
</body> </body>
</html> </html>

Datei anzeigen

@ -146,7 +146,7 @@ $t = Msd_Language::getInstance()->getTranslator();
<?php <?php
foreach ($this->databases as $db) { foreach ($this->databases as $db) {
echo '<option value="'.base64_encode($db).'"'; echo '<option value="'.base64_encode($db).'"';
if ($db == $this->config->get('dynamic.dbActual')) { if ($db == $this->dynamicConfig->getParam('dbActual')) {
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo '>'.$db.'</option>'; echo '>'.$db.'</option>';
@ -173,7 +173,7 @@ $t = Msd_Language::getInstance()->getTranslator();
$this->configFiles = Msd_File::getConfigNames(); $this->configFiles = Msd_File::getConfigNames();
foreach ($this->configFiles as $file) { foreach ($this->configFiles as $file) {
echo "\n" . '<option value="' . base64_encode($file) . '"'; echo "\n" . '<option value="' . base64_encode($file) . '"';
if ($this->config->get('dynamic.configFile') == $file) { if ($this->dynamicConfig->getParam('configFile') == $file) {
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo '>'.$this->getConfigTitle($file).'</option>'; echo '>'.$this->getConfigTitle($file).'</option>';

Datei anzeigen

@ -109,11 +109,11 @@
</td> </td>
</tr> </tr>
<?php <?php
$dbs = $this->config->get('config.databases'); $dbs = $this->config->getParam('databases');
echo $this->partial( echo $this->partial(
'config/databases/listDbs.phtml', 'config/databases/listDbs.phtml',
array('databases' => $dbs, array('databases' => $dbs,
'dbActual' => $this->config->get('dynamic.dbActual'), 'dbActual' => $this->dynamicConfig->getParam('dbActual'),
'parent' => $this, 'parent' => $this,
) )
); );

Datei anzeigen

@ -189,8 +189,8 @@ $testFtpConnectionUrl = $this->url(
</script> </script>
<div id="content"> <div id="content">
<h2><?php echo $this->lang->L_CONFIG_HEADLINE;?>: <?php echo $this->config->get('dynamic.configFile');?> <h2><?php echo $this->lang->L_CONFIG_HEADLINE;?>: <?php echo $this->dynamicConfig->getParam('configFile');?>
<span class="small">(<?php echo $this->lang->L_MSD_MODE;?>: <?php echo $this->config->get('config.general.mode');?>)</span></h2> <span class="small">(<?php echo $this->lang->L_MSD_MODE;?>: <?php echo $this->config->getParam('general.mode');?>)</span></h2>
<form method="post" action="<?php <form method="post" action="<?php
echo $this->url( echo $this->url(
array( array(
@ -254,7 +254,7 @@ echo $this->url(
<script type="text/javascript"> <script type="text/javascript">
/* <![CDATA[ */ /* <![CDATA[ */
<?php if (count((array) $this->config->get('dynamic.databases')) == 0): ?> <?php if (count((array) $this->dynamicConfig->getParam('databases')) == 0): ?>
mySlideDown('connection-params'); mySlideDown('connection-params');
<?php endif; ?> <?php endif; ?>
/*]]>*/ /*]]>*/

Datei anzeigen

@ -6,7 +6,7 @@ $this->lang = $this->parent->lang;
<td class="small"><?php echo $this->lang->L_SEND_MAIL_FORM?>:</td> <td class="small"><?php echo $this->lang->L_SEND_MAIL_FORM?>:</td>
<td class="small right"> <td class="small right">
<?php <?php
if ($this->config->get('config.email.sendMail') == 0) { if ($this->config->getParam('email.sendMail') == 0) {
echo $this->lang->L_NO; echo $this->lang->L_NO;
} else { } else {
echo $this->lang->L_YES; echo $this->lang->L_YES;

Datei anzeigen

@ -2,9 +2,10 @@
$this->config = $this->parent->config; $this->config = $this->parent->config;
$this->lang = $this->parent->lang; $this->lang = $this->parent->lang;
if (count($this->config->get('config.ftp'))>0) { $ftpConfigurations = $this->config->getParam('ftp');
if (count($ftpConfigurations) > 0) {
$ftpNr = 1; $ftpNr = 1;
foreach ($this->config->get('config.ftp') as $ftp) { foreach ($ftpConfigurations as $ftp) {
if ($ftp['use'] == 'y') { if ($ftp['use'] == 'y') {
?> ?>
<tr class="row-even"> <tr class="row-even">

Datei anzeigen

@ -54,7 +54,7 @@ $d = $this->dumpData;
</td> </td>
</tr> </tr>
<?php if ($this->config->get('config.mode') > 0) { ?> <?php if ($this->config->getParam('mode', 0) > 0) { ?>
<tr class="row-odd"> <tr class="row-odd">
<td><label for="backup_using_updates">Update (REPLACE Command):</label></td> <td><label for="backup_using_updates">Update (REPLACE Command):</label></td>
<td><input type="checkbox" class="checkbox noleftmargin" name="backup_using_updates" id="backup_using_updates" value="1" /></td> <td><input type="checkbox" class="checkbox noleftmargin" name="backup_using_updates" id="backup_using_updates" value="1" /></td>
@ -76,10 +76,14 @@ $d = $this->dumpData;
</div> </div>
<br /> <br />
<?php <?php
echo $this->partial('dump/settings.phtml',array('parent' => $this)); echo $this->partial('dump/settings.phtml', array(
'parent' => $this,
'config' => $this->config,
'dynamicConfig' => $this->dynamicConfig)
);
?> ?>
<div id="panel_perl" class="panel" style="display:none"> <div id="panel_perl" class="panel" style="display:none">
<h3><?php echo $this->lang->L_DUMP?> PERL (<?php echo $this->lang->L_CONFIG_HEADLINE;?>: <?php echo $this->config->get('dynamic.configFile')?>)</h3> <h3><?php echo $this->lang->L_DUMP?> PERL (<?php echo $this->lang->L_CONFIG_HEADLINE;?>: <?php echo $this->dynamicConfig->getParam('configFile');?>)</h3>
<button class="Formbutton" name="DoCronscript" onclick="show_perl_output('<?php echo $d->PERL_HTTP_CALL?>')"><?php echo $this->lang->L_DOCRONBUTTON?></button> <button class="Formbutton" name="DoCronscript" onclick="show_perl_output('<?php echo $d->PERL_HTTP_CALL?>')"><?php echo $this->lang->L_DOCRONBUTTON?></button>
<button class="Formbutton" name="DoSimpleTest" onclick="show_perl_output('<?php echo $d->PERL_TEST?>')"><?php echo $this->lang->L_DOSIMPLETEST?></button> <button class="Formbutton" name="DoSimpleTest" onclick="show_perl_output('<?php echo $d->PERL_TEST?>')"><?php echo $this->lang->L_DOSIMPLETEST?></button>
<button class="Formbutton" name="DoPerlTest" onclick="show_perl_output('<?php echo PERL_MODULTEST?>')"><?php echo $this->lang->L_DOPERLTEST?></button> <button class="Formbutton" name="DoPerlTest" onclick="show_perl_output('<?php echo PERL_MODULTEST?>')"><?php echo $this->lang->L_DOPERLTEST?></button>

Datei anzeigen

@ -2,7 +2,7 @@
$this->config = $this->parent->config; $this->config = $this->parent->config;
$this->lang = $this->parent->lang; $this->lang = $this->parent->lang;
$d = $this->parent->dumpData; $d = $this->parent->dumpData;
if ($this->config->get('config.general.multiPart') == 0) { ?> if ($this->config->getParam('general.multiPart') == 0) { ?>
<tr class="row-odd"> <tr class="row-odd">
<td class="small"><?php echo $this->lang->L_MULTI_PART?>:</td> <td class="small"><?php echo $this->lang->L_MULTI_PART?>:</td>
<td class="small right" colspan="2"><?php echo $this->lang->L_NO?></td> <td class="small right" colspan="2"><?php echo $this->lang->L_NO?></td>
@ -16,4 +16,4 @@ if ($this->config->get('config.general.multiPart') == 0) { ?>
<td class="small">&nbsp;&nbsp;<?php echo $this->lang->L_MULTIPART_SIZE?>:</td> <td class="small">&nbsp;&nbsp;<?php echo $this->lang->L_MULTIPART_SIZE?>:</td>
<td class="small right"><?php echo$this->byteOutput($this->config->multipartGroesse);?></td> <td class="small right"><?php echo$this->byteOutput($this->config->multipartGroesse);?></td>
</tr> </tr>
<?php } <?php }

Datei anzeigen

@ -9,7 +9,7 @@ $this->config = $this->parent->config;
<table class="bdr floatLeft" summary="Dump settings"> <table class="bdr floatLeft" summary="Dump settings">
<tr class="row-even"> <tr class="row-even">
<td class="small"><?php echo $this->lang->L_CONFIG_HEADLINE?></td> <td class="small"><?php echo $this->lang->L_CONFIG_HEADLINE?></td>
<td class="small right"><?php echo $this->config->get('dynamic.configFile')?></td> <td class="small right"><?php echo $this->dynamicConfig->getParam('configFile')?></td>
</tr> </tr>
<tr class="dbrow"> <tr class="dbrow">
<td class="small"><?php echo $this->lang->L_DBS?>:</td> <td class="small"><?php echo $this->lang->L_DBS?>:</td>
@ -38,7 +38,7 @@ $this->config = $this->parent->config;
<tr class="dbrow"> <tr class="dbrow">
<td class="small nowrap"><?php echo $this->lang->L_GZIP?>:</td> <td class="small nowrap"><?php echo $this->lang->L_GZIP?>:</td>
<td class="small right"><?php echo $this->config->get('dynamic.compression') ? $this->lang->L_YES: $this->lang->L_NO; ?></td> <td class="small right"><?php echo $this->dynamicConfig->getParam('compression') ? $this->lang->L_YES: $this->lang->L_NO; ?></td>
</tr> </tr>
<?php <?php
@ -110,4 +110,4 @@ if (!empty($sumTotal['tables'])) {
</tr> </tr>
</table> </table>
<?php } ?> <?php } ?>
</div> </div>

Datei anzeigen

@ -102,7 +102,7 @@ $(document).ready( function () {
<td class="small"><?php echo $this->lang->L_CONFIG;?>:</td> <td class="small"><?php echo $this->lang->L_CONFIG;?>:</td>
<td class="small right"> <td class="small right">
<span id="config_file"> <span id="config_file">
<?php echo $this->config->get('dynamic.configFile')?> <?php echo $this->dynamicConfig->getParam('configFile')?>
</span> </span>
</td> </td>
</tr> </tr>
@ -274,4 +274,4 @@ $(document).ready( function () {
<h3><?php echo $this->lang->L_LOG;?>:</h3> <h3><?php echo $this->lang->L_LOG;?>:</h3>
<div id="log" class="bdr small" style="height:100px;overflow:auto;" onmouseover="scroll_log=false" onmouseout="scroll_log=true"></div> <div id="log" class="bdr small" style="height:100px;overflow:auto;" onmouseover="scroll_log=false" onmouseout="scroll_log=true"></div>
</div> </div>
<br /><br /> <br /><br />

Datei anzeigen

@ -12,7 +12,7 @@ $version = new Msd_Version();
</head> </head>
<body> <body>
<?php <?php
if ($this->displayErrors == 1) { //if ($this->displayErrors == 1) {
?> ?>
<h1>An error occurred</h1> <h1>An error occurred</h1>
<h2><?php echo $this->message ?></h2> <h2><?php echo $this->message ?></h2>
@ -47,7 +47,7 @@ if ($this->displayErrors == 1) {
<pre><?php echo var_export($this->request->getParams(), true) ?> <pre><?php echo var_export($this->request->getParams(), true) ?>
</pre> </pre>
<?php endif; <?php endif;
} //}
?> ?>
</body> </body>
</html> </html>

Datei anzeigen

@ -5,7 +5,7 @@
</a> </a>
<br /> <br />
<h3><?php echo $this->lang->L_VERSIONSINFORMATIONEN;?></h3> <h3><?php echo $this->lang->L_VERSIONSINFORMATIONEN;?></h3>
<img src="<?php echo $this->baseUrl();?>/css/<?php echo $this->config->get('config.interface.theme');?>/pics/loveyourdata.gif" <img src="<?php echo $this->baseUrl();?>/css/<?php echo $this->config->getParam('interface.theme');?>/pics/loveyourdata.gif"
style="float:right;padding-left:10px;" alt="love your data" title="love your data" /> style="float:right;padding-left:10px;" alt="love your data" title="love your data" />
<table class="bdr" summary="Version information"> <table class="bdr" summary="Version information">
<tr class="row-even"> <tr class="row-even">
@ -28,7 +28,7 @@
<td><?php echo $this->lang->L_MEMORY;?>:</td> <td><?php echo $this->lang->L_MEMORY;?>:</td>
<td> <td>
<strong> <strong>
<?php echo $this->byteOutput($this->config->get('dynamic.phpRam')*1024*1024, 0);?> <?php echo $this->byteOutput($this->dynamicConfig->getParam('phpRam')*1024*1024, 0);?>
</strong> </strong>
</td> </td>
</tr> </tr>
@ -37,7 +37,7 @@
<td> <td>
<strong><?php echo $this->serverMaxExecutionTime;?> <strong><?php echo $this->serverMaxExecutionTime;?>
<?php echo $this->lang->L_SECONDS;?> <?php echo $this->lang->L_SECONDS;?>
(<?php echo $this->config->get('dynamic.maxExecutionTime');?> (<?php echo $this->dynamicConfig->getParam('maxExecutionTime');?>
<?php echo $this->lang->L_SECONDS;?>) <?php echo $this->lang->L_SECONDS;?>)
</strong> </strong>
</td> </td>
@ -49,9 +49,9 @@
<tr class="row-odd"> <tr class="row-odd">
<td><?php echo $this->lang->L_PHP_EXTENSIONS;?>:</td> <td><?php echo $this->lang->L_PHP_EXTENSIONS;?>:</td>
<td class="small"><?php echo $this->config->get('dynamic.phpextensions');?> <td class="small"><?php echo $this->dynamicConfig->getParam('phpExtensions');?>
<?php <?php
if (!$this->config->get('dynamic.compression')) { ?> if (!$this->dynamicConfig->getParam('compression')) { ?>
<br /><span class="error"><?php echo $this->lang->L_NOGZPOSSIBLE;?></span> <br /><span class="error"><?php echo $this->lang->L_NOGZPOSSIBLE;?></span>
<?php } <?php }
if (!extension_loaded('ftp')) { ?> if (!extension_loaded('ftp')) { ?>
@ -59,10 +59,10 @@
<?php } ?> <?php } ?>
</td> </td>
</tr> </tr>
<?php if ($this->config->get('dynamic.disabledPhpFunctions') > '') { ?> <?php if ($this->dynamicConfig->getParam('disabledPhpFunctions') > '') { ?>
<tr class="row-even nowrap"> <tr class="row-even nowrap">
<td><?php echo $this->lang->L_DISABLEDFUNCTIONS;?>:</td> <td><?php echo $this->lang->L_DISABLEDFUNCTIONS;?>:</td>
<td class="small"><?php echo $this->config->get('dynamic.disabledPhpFunctions');?></td> <td class="small"><?php echo $this->dynamicConfig->getParam('disabledPhpFunctions');?></td>
</tr> </tr>
<?php } ?> <?php } ?>
</table> </table>
@ -83,7 +83,7 @@
</tr> </tr>
<tr class="row-odd"> <tr class="row-odd">
<td><?php echo $this->lang->L_INFO_ACTDB;?>:</td> <td><?php echo $this->lang->L_INFO_ACTDB;?>:</td>
<td><strong><?php echo $this->config->get('dynamic.dbActual');?></strong></td> <td><strong><?php echo $this->dynamicConfig->getParam('dbActual');?></strong></td>
</tr> </tr>
<tr class="row-even"> <tr class="row-even">
<td><?php echo $this->lang->L_FM_FREESPACE;?>:</td> <td><?php echo $this->lang->L_FM_FREESPACE;?>:</td>

Datei anzeigen

@ -1,5 +1,5 @@
<?php <?php
$theme = $this->config->get('config.interface.theme'); $theme = $this->config->getParam('interface.theme', 'msd');
$request = Zend_Controller_Front::getInstance()->getRequest(); $request = Zend_Controller_Front::getInstance()->getRequest();
$this->controller = $request->getControllerName(); $this->controller = $request->getControllerName();
$this->action = $request->getActionName(); $this->action = $request->getActionName();
@ -41,7 +41,7 @@ $('#fadeMenuIn').click(function() {
return false; return false;
}); });
<?php <?php
if ($this->config->get('config.interface.showTooltips') == 'y') { ?> if ($this->config->getParam('interface.showTooltips') == 'y') { ?>
SetupTooltips(); SetupTooltips();
<?php } <?php }
$this->jQuery()->onLoadCaptureEnd(); $this->jQuery()->onLoadCaptureEnd();
@ -58,11 +58,11 @@ $this->jQuery()->onLoadCaptureEnd();
<div id="version"> <div id="version">
<div id="fadeMenuOut" title="blend out menu"> <div id="fadeMenuOut" title="blend out menu">
<img style="margin-left:6px;" src="<?php echo $this->baseUrl(); ?>/css/<?php echo$theme?>/icons/handLeft.png" <img style="margin-left:6px;" src="<?php echo $this->baseUrl(); ?>/css/<?php echo $theme?>/icons/handLeft.png"
alt="<?php echo $this->lang->L_MENU_HIDE;?>" title="<?php echo $this->lang->L_MENU_HIDE;?>" /> alt="<?php echo $this->lang->L_MENU_HIDE;?>" title="<?php echo $this->lang->L_MENU_HIDE;?>" />
</div> </div>
<span class="version-line">Version <?php echo $this->msdVersion;?></span> <span class="version-line">Version <?php echo $this->msdVersion;?></span>
<?php if ($this->config->get('config.general.mode') == 'easy') {?> <?php if ($this->config->getParam('general.mode') == 'easy') {?>
<img src="<?php echo $this->baseUrl(); ?>/css/<?php echo$theme?>/pics/navi_bg.jpg" alt="" /> <img src="<?php echo $this->baseUrl(); ?>/css/<?php echo$theme?>/pics/navi_bg.jpg" alt="" />
<?php } else { ?> <?php } else { ?>
<img src="<?php echo $this->baseUrl(); ?>/css/<?php echo$theme?>/pics/navi_bg_expert.jpg" alt="" /> <img src="<?php echo $this->baseUrl(); ?>/css/<?php echo$theme?>/pics/navi_bg_expert.jpg" alt="" />
@ -143,7 +143,7 @@ $this->jQuery()->onLoadCaptureEnd();
$this->databases = $dbAdapter->getDatabaseNames(); $this->databases = $dbAdapter->getDatabaseNames();
foreach ($this->databases as $db) { foreach ($this->databases as $db) {
echo '<option value="'.base64_encode($db).'"'; echo '<option value="'.base64_encode($db).'"';
if ($db == $this->config->get('dynamic.dbActual')) { if ($db == $this->dynamicConfig->getParam('dbActual')) {
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo '>'.$db.'</option>'; echo '>'.$db.'</option>';
@ -165,16 +165,16 @@ $this->jQuery()->onLoadCaptureEnd();
$this->configFiles = Msd_File::getConfigNames(); $this->configFiles = Msd_File::getConfigNames();
foreach ($this->configFiles as $file) { foreach ($this->configFiles as $file) {
echo "\n" . '<option value="' . base64_encode($file) . '"'; echo "\n" . '<option value="' . base64_encode($file) . '"';
if ($this->config->get('dynamic.configFile') == $file) { if ($this->dynamicConfig->getParam('configFile') == $file) {
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo '>'.$this->getConfigTitle($file).'</option>'; echo '>'. $this->config->getConfigTitle($file) . '</option>';
} }
?> ?>
</select> </select>
</fieldset> </fieldset>
</form> </form>
<?php if (in_array($this->config->get('config.interface.language'), array('de', 'ch'))) {; ?> <?php if (in_array($this->config->getParam('interface.language'), array('de', 'ch'))) {; ?>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<p style="text-align:center"> <p style="text-align:center">
<input type="image" src="<?php echo $this->baseUrl();?>/images/paypal-de.gif" name="submit" alt="Spende an MySQLDumper" /> <input type="image" src="<?php echo $this->baseUrl();?>/images/paypal-de.gif" name="submit" alt="Spende an MySQLDumper" />
@ -198,7 +198,7 @@ $this->jQuery()->onLoadCaptureEnd();
</div> </div>
<?php <?php
if ($this->config->get('config.interface.showServerCaption') == "y") { if ($this->config->getParam('interface.showServerCaption') == "y") {
?> ?>
<div id="server0"> <div id="server0">
<?php echo$this->lang->L_SERVER;?>: <?php echo$this->lang->L_SERVER;?>:

Datei anzeigen

@ -1,10 +1,10 @@
<?php <?php
$systemDatabases = $this->config->get('config.systemDatabases'); $systemDatabases = $this->config->getParam('systemDatabases');
$formUrl = $this->url(array('controller'=>'sql','action'=>'index')); $formUrl = $this->url(array('controller'=>'sql','action'=>'index'));
$cycleHelper = $this->getHelper('cycle')->cycle(array('row-even', 'row-odd')); $cycleHelper = $this->getHelper('cycle')->cycle(array('row-even', 'row-odd'));
?> ?>
<div id="content"> <div id="content">
<h2><?php echo $this->lang->L_DATABASES_OF_USER;?> '<?php echo $this->config->get('config.dbuser.user').'\'@\''.$this->config->get('config.dbuser.host');?>'</h2> <h2><?php echo $this->lang->L_DATABASES_OF_USER;?> '<?php echo $this->config->getParam('dbuser.user').'\'@\''.$this->config->getParam('dbuser.host');?>'</h2>
<?php echo $this->sqlHeadNavi(); ?> <?php echo $this->sqlHeadNavi(); ?>
<?php <?php
if (isset($this->actionResults)) { if (isset($this->actionResults)) {
@ -100,7 +100,7 @@ if (isset($this->actionResults)) {
?> ?>
<tr class="nowrap <tr class="nowrap
<?php <?php
if ($dbName == $this->config->get('dynamic.dbActual')) { if ($dbName == $this->dynamicConfig->getParam('dbActual')) {
echo 'row-highlight'; echo 'row-highlight';
} else { } else {
echo $this->cycle(array('row-even', 'row-odd'))->next(); echo $this->cycle(array('row-even', 'row-odd'))->next();

Datei anzeigen

@ -22,9 +22,9 @@ $this->jQuery()->javascriptCaptureStart(); ?>
<a href="#"> <a href="#">
<?php <?php
echo $this->getIcon('Server', '', 16) echo $this->getIcon('Server', '', 16)
. $this->config->get('config.dbuser.user') .'@' . $this->config->getParam('dbuser.user') .'@'
. $this->config->get('config.dbuser.host'); . $this->config->getParam('dbuser.host');
$port = $this->config->get('config.dbuser.port'); $port = $this->config->getParam('dbuser.port');
if ($port > 0) { if ($port > 0) {
echo ':' . $port; echo ':' . $port;
} }
@ -34,11 +34,11 @@ $this->jQuery()->javascriptCaptureStart(); ?>
<li> <li>
<a href="<?php echo $showDatabasesUrl;?>"> <a href="<?php echo $showDatabasesUrl;?>">
<?php echo$this->getIcon('Database', '', 16);?> <?php echo$this->getIcon('Database', '', 16);?>
<?php echo $this->out($this->config->get('dynamic.dbActual'));?> <?php echo $this->out($this->dynamicConfig->getParam('dbActual'));?>
</a> </a>
</li> </li>
<?php <?php
$actualTable = $this->config->get('dynamic.tableActual'); $actualTable = $this->dynamicConfig->getParam('tableActual');
if ($actualTable > '') { if ($actualTable > '') {
?> ?>
<li> <li>

Datei anzeigen

@ -25,7 +25,7 @@ $('#sqltextarea').bind('keyup', function(e){
<br class="clear" /> <br class="clear" />
</div> </div>
<div> <div>
<textarea style="height:<?php echo $this->config->get('config.interface.sqlboxHeight');?>px;" name="sqltextarea" id="sqltextarea" rows="4" cols="10"><?php echo $this->boxcontent;?></textarea> <textarea style="height:<?php echo $this->config->getParam('interface.sqlboxHeight');?>px;" name="sqltextarea" id="sqltextarea" rows="4" cols="10"><?php echo $this->boxcontent;?></textarea>
<div class="sqlbox-warning small center"><?php echo $this->lang->L_SQL_WARNING;?></div> <div class="sqlbox-warning small center"><?php echo $this->lang->L_SQL_WARNING;?></div>
</div> </div>
</form> </form>
@ -130,4 +130,4 @@ if (isset($this->resultSummary)) {
</table> </table>
<?php <?php
} ?> } ?>
</div> </div>

Datei anzeigen

@ -1,5 +1,5 @@
<div id="content"> <div id="content">
<h2><?php echo $this->lang->L_SQL_TABLESOFDB;?> `<?php echo $this->config->get('dynamic.dbActual');?>` <h2><?php echo $this->lang->L_SQL_TABLESOFDB;?> `<?php echo $this->dynamicConfig->getParam('dbActual');?>`
</h2> </h2>
<?php <?php
echo $this->sqlHeadNavi(); echo $this->sqlHeadNavi();

Datei anzeigen

@ -16,8 +16,7 @@
* @package MySQLDumper * @package MySQLDumper
* @subpackage Action_Helper * @subpackage Action_Helper
*/ */
class Msd_Action_Helper_AssignConfigAndLanguage class Msd_Action_Helper_AssignConfigAndLanguage extends Zend_Controller_Action_Helper_Abstract
extends Zend_Controller_Action_Helper_Abstract
{ {
/** /**
* Actual Zend_View instance * Actual Zend_View instance
@ -36,9 +35,10 @@ class Msd_Action_Helper_AssignConfigAndLanguage
if ($controllerName == 'install') { if ($controllerName == 'install') {
return; return;
} }
$view = $this->getView(); $view = $this->getView();
$view->config = Msd_Configuration::getInstance(); $view->config = Msd_Registry::getConfig();
$view->lang = Msd_Language::getInstance(); $view->dynamicConfig = Msd_Registry::getDynamicConfig();
$view->lang = Msd_Language::getInstance();
} }
/** /**
@ -51,7 +51,7 @@ class Msd_Action_Helper_AssignConfigAndLanguage
if (null !== $this->_view) { if (null !== $this->_view) {
return $this->_view; return $this->_view;
} else { } else {
$controller = $this->getActionController(); $controller = $this->getActionController();
$this->_view = $controller->view; $this->_view = $controller->view;
return $this->_view; return $this->_view;
} }

Datei anzeigen

@ -52,7 +52,7 @@ class Msd_Config
if (is_string($ioHandler)) { if (is_string($ioHandler)) {
$pluginLoader = new Zend_Loader_PluginLoader( $pluginLoader = new Zend_Loader_PluginLoader(
array( array(
'Msd_Config_IoHandler_' => APPLICATION_PATH . '/../library/Msd/Config/IoHandler/', 'Msd_Config_IoHandler_' => APPLICATION_PATH . '/../library/Msd/Config/IoHandler/',
'Module_Config_IoHandler_' => APPLICATION_PATH . '/../modules/library/Config/IoHandler/', 'Module_Config_IoHandler_' => APPLICATION_PATH . '/../modules/library/Config/IoHandler/',
) )
); );
@ -79,6 +79,25 @@ class Msd_Config
public function load($configFilename) public function load($configFilename)
{ {
$this->_config = $this->_ioHandler->load($configFilename); $this->_config = $this->_ioHandler->load($configFilename);
$this->_setPaths();
}
/**
* Add paths to config
*
* @return void
*/
private function _setPaths()
{
$workRoot = realpath(APPLICATION_PATH . '/..') . '/work/';
$directories = array(
'work' => $workRoot,
'log' => $workRoot . 'log',
'backup' => $workRoot . 'backup',
'config' => $workRoot . 'config',
'iconPath' => 'css/' . $this->getParam('interface.theme', 'msd') . '/icons'
);
$this->setParam('paths', $directories);
} }
/** /**
@ -95,13 +114,23 @@ class Msd_Config
/** /**
* Retrieves the value of a configuration parameter. * Retrieves the value of a configuration parameter.
* *
* @param string $paramName Name of the configuration parameter. * @param string $paramName Name of the configuration parameter. May be prefixed with section.
* @param mixed $defaultValue Default value to return, if param isn't set. * @param mixed $defaultValue Default value to return, if param isn't set.
* *
* @return mixed * @return mixed
*/ */
public function getParam($paramName, $defaultValue = null) public function getParam($paramName, $defaultValue = null)
{ {
// check for section e.g. interface.theme
if (strpos($paramName, '.') !== false) {
list($section, $paramName) = explode('.', $paramName);
if (isset($this->_config[$section][$paramName])) {
return $this->_config[$section][$paramName];
} else {
return $defaultValue;
}
}
if (isset($this->_config[$paramName])) { if (isset($this->_config[$paramName])) {
return $this->_config[$paramName]; return $this->_config[$paramName];
} }
@ -120,7 +149,14 @@ class Msd_Config
*/ */
public function setParam($paramName, $paramValue) public function setParam($paramName, $paramValue)
{ {
$this->_config[$paramName] = $paramValue; if (strpos('paramName', '.') !== false) {
list($section, $paramName) = explode('.', $paramName);
$this->_config[$section][$paramName] = $paramValue;
} else {
$this->_config[$paramName] = $paramValue;
}
if ($this->_autosave) { if ($this->_autosave) {
$this->save(); $this->save();
} }
@ -145,7 +181,7 @@ class Msd_Config
*/ */
public function setConfig($config) public function setConfig($config)
{ {
$this->_config = (array) $config; $this->_config = (array)$config;
if ($this->_autosave) { if ($this->_autosave) {
$this->save(); $this->save();
} }
@ -190,4 +226,18 @@ class Msd_Config
{ {
return $this->_autosave; return $this->_autosave;
} }
/**
* Get the title from a configuration file without aplying it.
*
* @param string $fileName The file name of the configuration
*
* @return string
*/
public function getConfigTitle($fileName)
{
$configData = parse_ini_file($this->getParam('paths.config') . '/' . $fileName . '.ini', true);
return $configData['general']['title'];
}
} }

Datei anzeigen

@ -33,6 +33,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);
$this->getDynamicValues();
} }
/** /**
@ -64,4 +65,118 @@ class Msd_Config_Dynamic
{ {
$this->_namespace->$name = $value; $this->_namespace->$name = $value;
} }
/**
* Read dynamic PHP config values
*
* @return Zend_Config
*/
public function getDynamicValues ()
{
$this->setParam('compression', self::_hasZlib());
$this->setParam('phpExtensions', str_replace(',', ', ', implode(', ', get_loaded_extensions())));
$phpRam = $this->_getPhpRam();
$this->setParam('phpRam', $phpRam);
$this->setParam('memoryLimit', round($phpRam * 1024 * 1024 * 0.9, 0));
$this->setParam('sendmailCall', $this->_getConfigSetting('sendmail_path'));
$this->setParam('safeMode', $this->_getConfigSetting('safe_mode', true));
$this->setParam('magicQuotesGpc', get_magic_quotes_gpc());
$disabledPhpFunctions = $this->_getConfigSetting('disable_functions');
$this->setParam('disabledPhpFunctions', str_replace(',', ', ', $disabledPhpFunctions));
$this->setParam('maxExecutionTime', $this->_getMaxExecutionTime());
$this->setParam('uploadMaxFilesize', $this->_getUploadMaxFilesize());
}
/**
* Read PHP's max_execution_time
*
* @return int
*/
private function _getMaxExecutionTime()
{
$maxExecutionTime =
$this->_getConfigSetting('max_execution_time', true);
if ($maxExecutionTime <= 5) {
// we didn't get the real value from the server - some deliver "-1"
$maxExecutionTime = 30;
} elseif ($maxExecutionTime > 30) {
// we don't use more than 30 seconds to avoid brower timeouts
$maxExecutionTime = 30;
}
return $maxExecutionTime;
}
/**
* Get PHP's upload_max_filesize
*
* @return int
*/
private function _getUploadMaxFilesize()
{
$uploadMaxFilesize = $this->_getConfigSetting('upload_max_filesize');
// Is value in Megabytes? If yes create output
if (strpos($uploadMaxFilesize, 'M')) {
$uploadMaxFilesize = str_replace('M', '', $uploadMaxFilesize);
$uploadMaxFilesize = trim($uploadMaxFilesize);
// re-calculate to Bytes
$uploadMaxFilesize *= 1024 * 1024;
}
return (int) $uploadMaxFilesize;;
}
/**
* Get PHP's ram size
*
* @return integer The memory limit in MB
*/
private function _getPhpRam()
{
$ram = $this->_getConfigSetting('memory_limit');
// we don't trust the value delivered by server config if < 16
if ($ram < 16) {
$ram = 16;
}
return $ram;
}
/**
* Detect if zlib is installed
*
* @return boolean
*/
private function _hasZlib()
{
$zlib = false;
$extensions = get_loaded_extensions();
if (in_array('zlib', $extensions)) {
$zlib = true;
};
return (boolean) $zlib;
}
/**
* Returns a PHP-Setting from ini
*
* First try to read via ini_get(), then fall back to get_cfg_var()
*
* @param string $varName The name of the setting to read
* @param bool $returnAsInt Whether to return value as integer
*
* @return mixed
*/
private function _getConfigSetting($varName, $returnAsInt = false)
{
$value = @ini_get($varName);
// fallback if ini_get doesn't work
if ($value == '' || $value === null) {
$value = @get_cfg_var($varName);
}
if ($returnAsInt) {
$value = (int) $value;
}
return $value;
}
} }

Datei anzeigen

@ -117,7 +117,9 @@ class Msd_ConfigurationPhpValues
* First try to read via ini_get(), then fall back to get_cfg_var() * First try to read via ini_get(), then fall back to get_cfg_var()
* *
* @param string $varName The name of the setting to read * @param string $varName The name of the setting to read
* @param boolean $returnAsInt Whether to return value as integer * @param bool $returnAsInt Whether to return value as integer
*
* @return mixed
*/ */
private function _getConfigSetting($varName, $returnAsInt = false) private function _getConfigSetting($varName, $returnAsInt = false)
{ {

Datei anzeigen

@ -0,0 +1,66 @@
<?php
/**
* This file is part of MySQLDumper released under the GNU/GPL 2 license
* http://www.mysqldumper.net
*
* @package MySQLDumper
* @subpackage Controller
* @version SVN: $Rev$
* @author $Author$
*/
/**
* General Controller Action class
*
* @package MySQLDumper
* @subpackage Controller
*/
class Msd_Controller_Action extends Zend_Controller_Action
{
/**
* @var Msd_Config
*/
protected $_config;
/**
* @var Msd_Config_Dynamic
*/
protected $_dynamicConfig;
/**
* Class constructor
*
* The request and response objects should be registered with the
* controller, as should be any additional optional arguments; these will be
* available via {@link getRequest()}, {@link getResponse()}, and
* {@link getInvokeArgs()}, respectively.
*
* When overriding the constructor, please consider this usage as a best
* practice and ensure that each is registered appropriately; the easiest
* way to do so is to simply call parent::__construct($request, $response,
* $invokeArgs).
*
* After the request, response, and invokeArgs are set, the
* {@link $_helper helper broker} is initialized.
*
* Finally, {@link init()} is called as the final action of
* instantiation, and may be safely overridden to perform initialization
* tasks; as a general rule, override {@link init()} instead of the
* constructor to customize an action controller's instantiation.
*
* @param Zend_Controller_Request_Abstract $request
* @param Zend_Controller_Response_Abstract $response
* @param array $invokeArgs Any additional invocation arguments
*
* @return Msd_Controller_Action
*/
public function __construct(
Zend_Controller_Request_Abstract $request,
Zend_Controller_Response_Abstract $response,
array $invokeArgs = array()
)
{
$this->_config = Msd_Registry::getConfig();
$this->_dynamicConfig = Msd_Registry::getDynamicConfig();
parent::__construct($request, $response, $invokeArgs);
}
}

Datei anzeigen

@ -124,13 +124,13 @@ abstract class Msd_Db
public static function getAdapter($options = null, $forceMysql = false) public static function getAdapter($options = null, $forceMysql = false)
{ {
if ($options === null) { if ($options === null) {
$config = Msd_Configuration::getInstance(); $config = Msd_Registry::getConfig();
$options = array( $options = array(
'host' => $config->get('config.dbuser.host'), 'host' => $config->getParam('dbuser.host'),
'user' => $config->get('config.dbuser.user'), 'user' => $config->getParam('dbuser.user'),
'pass' => $config->get('config.dbuser.pass'), 'pass' => $config->getParam('dbuser.pass'),
'port' => (int) $config->get('config.dbuser.port'), 'port' => (int) $config->getParam('dbuser.port'),
'socket' => $config->get('config.dbuser.socket'), 'socket' => $config->getParam('dbuser.socket'),
); );
} }
if (function_exists('mysqli_connect') && !$forceMysql) { if (function_exists('mysqli_connect') && !$forceMysql) {

Datei anzeigen

@ -62,8 +62,8 @@ class Msd_Dump
*/ */
private function _getDbsToBackup() private function _getDbsToBackup()
{ {
$config = Msd_Configuration::getInstance(); $dynamicConfig = Msd_Registry::getDynamicConfig();
$databases = $config->get('dynamic.databases'); $databases = $dynamicConfig->getParam('dynamic.databases');
// first check if any db is marked to be dumped // first check if any db is marked to be dumped
$dbToDumpExists = false; $dbToDumpExists = false;
if (!empty($databases)) { if (!empty($databases)) {
@ -77,7 +77,7 @@ class Msd_Dump
} }
if (!$dbToDumpExists) { if (!$dbToDumpExists) {
// no db selected for dump -> set actual db to be dumped // no db selected for dump -> set actual db to be dumped
$index = $config->get('dynamic.dbActual'); $index = $dynamicConfig->getParam('dbActual');
$this->dbsToBackup[$index] = array(); $this->dbsToBackup[$index] = array();
$this->dbsToBackup[$index]['dump'] = 1; $this->dbsToBackup[$index]['dump'] = 1;
} }
@ -203,4 +203,4 @@ class Msd_Dump
); );
} }
} }
} }

Datei anzeigen

@ -58,9 +58,9 @@ class Msd_File
*/ */
public static function getLatestBackupInfo() public static function getLatestBackupInfo()
{ {
$config = Msd_Configuration::getInstance(); $config = Msd_Registry::getConfig();
$latestBackup = array(); $latestBackup = array();
$dir = new DirectoryIterator($config->get('paths.backup')); $dir = new DirectoryIterator($config->getParam('paths.backup'));
foreach ($dir as $file) { foreach ($dir as $file) {
if ($file->isFile()) { if ($file->isFile()) {
$fileMtime = $file->getMTime(); $fileMtime = $file->getMTime();
@ -84,11 +84,12 @@ class Msd_File
*/ */
public static function getConfigNames() public static function getConfigNames()
{ {
$config = Msd_Configuration::getInstance(); $config = Msd_Registry::getConfig();
$configPath = $config->get('paths.config'); $configPath = $config->getParam('paths.config');
if (!is_readable($configPath)) { if (!is_readable($configPath)) {
return array(); return array();
} }
$dir = new DirectoryIterator($configPath); $dir = new DirectoryIterator($configPath);
$files = array(); $files = array();
foreach ($dir as $file) { foreach ($dir as $file) {

Datei anzeigen

@ -28,8 +28,8 @@ class Msd_File_Dump extends Msd_File
*/ */
public static function getStatusline($filename) public static function getStatusline($filename)
{ {
$config = Msd_Configuration::getInstance(); $config = Msd_Registry::getConfig();
$path = $config->get('paths.backup'). DS; $path = $config->getParam('paths.backup'). '/';
if (strtolower(substr($filename, -3)) == '.gz') { if (strtolower(substr($filename, -3)) == '.gz') {
$fileHandle = gzopen($path . $filename, "r"); $fileHandle = gzopen($path . $filename, "r");
if ($fileHandle === false) { if ($fileHandle === false) {

Datei anzeigen

@ -21,7 +21,7 @@ class Msd_Language
/** /**
* Instance * Instance
* *
* @var Msd_Configuration * @var Msd_Language
*/ */
private static $_instance = NULL; private static $_instance = NULL;
@ -42,12 +42,12 @@ class Msd_Language
/** /**
* Constructor gets the configuration params * Constructor gets the configuration params
* *
* @return array * @return Msd_Language
*/ */
private function __construct () private function __construct()
{ {
$config = Msd_Configuration::getInstance(); $config = Msd_Registry::getConfig();
$language = $config->get('config.interface.language'); $language = $config->getParam('interface.language', 'en');
$this->loadLanguage($language); $this->loadLanguage($language);
} }
@ -61,8 +61,8 @@ class Msd_Language
public function loadLanguage($language) public function loadLanguage($language)
{ {
$this->_baseLanguageDir = APPLICATION_PATH . '/language/'; $this->_baseLanguageDir = APPLICATION_PATH . '/language/';
$file = $this->_baseLanguageDir . $language . '/lang.php'; $file = $this->_baseLanguageDir . $language . '/lang.php';
$translator = $this->getTranslator(); $translator = $this->getTranslator();
if ($translator === null) { if ($translator === null) {
$translator = new Zend_Translate('array', $file, $language); $translator = new Zend_Translate('array', $file, $language);
} else { } else {
@ -70,16 +70,19 @@ class Msd_Language
array( array(
'adapter' => 'array', 'adapter' => 'array',
'content' => $file, 'content' => $file,
'locale' => $language 'locale' => $language
) )
); );
} }
$this->setTranslator($translator); $this->setTranslator($translator);
Zend_Registry::set('Zend_Translate', $translator); Zend_Registry::set('Zend_Translate', $translator);
} }
/** /**
* No cloning for singleton * No cloning for singleton
* *
* @throws Msd_Exception
*
* @return void * @return void
*/ */
public function __clone() public function __clone()
@ -90,25 +93,26 @@ class Msd_Language
/** /**
* Magic getter to keep syntax in rest of script short * Magic getter to keep syntax in rest of script short
* *
* @param mixed $var * @param mixed $name Name of language var to translate
* *
* @return mixed * @return mixed
*/ */
public function __get ($property) public function __get($name)
{ {
$translated = $this->getTranslator()->_($property); $translated = $this->getTranslator()->_($name);
if ($translated == $property && substr($property, 0, 2) == 'L_') { if ($translated == $name && substr($name, 0, 2) == 'L_') {
// no translation found -> remove prefix L_ // no translation found -> remove prefix L_
return substr($property, 2); return substr($name, 2);
} }
return $translated; return $translated;
} }
/** /**
* Returns the single instance * Returns the single instance
* *
* @return Msd_Language * @return Msd_Language
*/ */
public static function getInstance () public static function getInstance()
{ {
if (NULL == self::$_instance) { if (NULL == self::$_instance) {
self::$_instance = new self; self::$_instance = new self;
@ -126,7 +130,7 @@ class Msd_Language
*/ */
public function translateZendId($zendMessageId, $messageText = '') public function translateZendId($zendMessageId, $messageText = '')
{ {
if (substr($zendMessageId, 0, 6) =='access' && $messageText > '') { if (substr($zendMessageId, 0, 6) == 'access' && $messageText > '') {
// message is already translated by validator access // message is already translated by validator access
return $messageText; return $messageText;
} }

Datei anzeigen

@ -29,7 +29,7 @@ class Msd_Log
/** /**
* Init file handles * Init file handles
* *
* @return void * @return Msd_Log
*/ */
public function __construct() public function __construct()
{ {
@ -41,8 +41,8 @@ class Msd_Log
$this->handle[self::ERROR] = false; $this->handle[self::ERROR] = false;
// get config // get config
$config = Msd_Configuration::getInstance(); $config = Msd_Registry::getConfig();
$this->_paths = (object)$config->get('paths'); $this->_paths = (object) $config->getParam('paths');
} }
/** /**

Datei anzeigen

@ -31,7 +31,7 @@ class Msd_TaskManager
/** /**
* Instance * Instance
* *
* @var Msd_Configuration * @var Msd_TaskManager
*/ */
private static $_instance = NULL; private static $_instance = NULL;
@ -48,12 +48,10 @@ class Msd_TaskManager
* *
* Get task list from session or init an empty list. * Get task list from session or init an empty list.
* *
* @param string $taskType Task type to get or create. * @param string $taskType The name of the task type
* Defaults to "backupTasks". * @param boolean $clear Whether to clear all tasks
* @param boolean Whether to create a new task list and delete all entries
* or to get it from the session
* *
* @return void * @return Msd_TaskManager
*/ */
private function __construct($taskType, $clear = false) private function __construct($taskType, $clear = false)
{ {
@ -69,15 +67,12 @@ class Msd_TaskManager
/** /**
* Returns the task manager instance * Returns the task manager instance
* *
* @param string $configname The name of the configuration file to load. * @param string $taskType The name of the task type
* If not set we will load the config from * @param boolean $clear Whether to clear all tasks
* session if present.
* @param boolean $forceLoading If set the config will be read from file.
* *
* @return Msd_Configuration * @return Msd_TaskManager
*/ */
public static function getInstance($taskType = 'backupTasks', public static function getInstance($taskType = 'backupTasks', $clear = false)
$clear = false)
{ {
if (null == self::$_instance) { if (null == self::$_instance) {
self::$_instance = new self($taskType, $clear); self::$_instance = new self($taskType, $clear);

Datei anzeigen

@ -246,6 +246,7 @@ class Msd_User
$configFile = $files[0]; $configFile = $files[0];
} }
} }
Msd_Configuration::getInstance($configFile, true); $config = Msd_Registry::getConfig();
$config->load($configFile . '.ini');
} }
} }

Datei anzeigen

@ -100,6 +100,7 @@ class Zend_Config_Ini extends Zend_Config
public function __construct($filename, $section = null, $options = false) public function __construct($filename, $section = null, $options = false)
{ {
if (empty($filename)) { if (empty($filename)) {
var_export(debug_backtrace());
/** /**
* @see Zend_Config_Exception * @see Zend_Config_Exception
*/ */

Binäre Datei nicht angezeigt.

Datei anzeigen

@ -11,8 +11,8 @@ class SqlboxTest extends ControllerTestCase
public function testCanCreateTableSelectBox() public function testCanCreateTableSelectBox()
{ {
$model = new Application_Model_Sqlbox(); $model = new Application_Model_Sqlbox();
$config = Msd_Configuration::getInstance(); $dynamicConfig = Msd_Registry::getDynamicConfig();
$config->set('dynamic.dbActual', 'information_schema'); $dynamicConfig->setParam('dbActual', 'information_schema');
$selectBox = $model->getTableSelectBox(); $selectBox = $model->getTableSelectBox();
$tables = array('CHARACTER_SETS', 'COLLATIONS', 'COLLATION_CHARACTER_SET_APPLICABILITY', $tables = array('CHARACTER_SETS', 'COLLATIONS', 'COLLATION_CHARACTER_SET_APPLICABILITY',
'COLUMNS', 'COLUMN_PRIVILEGES', 'ENGINES' 'COLUMNS', 'COLUMN_PRIVILEGES', 'ENGINES'

Datei anzeigen

@ -20,8 +20,8 @@ class MenuTest extends ControllerTestCase
public function testCanRenderMenuWithInvalidActualDatabase() public function testCanRenderMenuWithInvalidActualDatabase()
{ {
$this->loginUser(); $this->loginUser();
$config = Msd_Configuration::getInstance(); $dynamicConfig = Msd_Registry::getDynamicConfig();
$config->set('dynamic.dbActual', -1); $dynamicConfig->setParam('dbActual', -1);
$this->dispatch('/'); $this->dispatch('/');
$this->assertQueryContentContains('#selectedDb', 'information_schema'); $this->assertQueryContentContains('#selectedDb', 'information_schema');
} }
@ -29,9 +29,10 @@ class MenuTest extends ControllerTestCase
public function testCanFallbackToDefaultDbIfActualDbIsInvalid() public function testCanFallbackToDefaultDbIfActualDbIsInvalid()
{ {
$this->loginUser(); $this->loginUser();
$config = Msd_Configuration::getInstance(); $dynamicConfig = Msd_Registry::getDynamicConfig();
$config->set('dynamic.dbActual', 'i_dont_exist'); $dynamicConfig->setParam('dbActual', 'i_dont_exist');
$config->set('config.dbuser.defaultDb', 'information_schema'); $config = Msd_Registry::getConfig();
$config->set('dbuser.defaultDb', 'information_schema');
$this->dispatch('/'); $this->dispatch('/');
$this->assertQueryContentContains('#selectedDb', 'information_schema'); $this->assertQueryContentContains('#selectedDb', 'information_schema');
} }
@ -39,9 +40,10 @@ class MenuTest extends ControllerTestCase
public function testCanFallbackToFirstDbIfActualAndDefaultDbsAreInvalid() public function testCanFallbackToFirstDbIfActualAndDefaultDbsAreInvalid()
{ {
$this->loginUser(); $this->loginUser();
$config = Msd_Configuration::getInstance(); $dynamicConfig = Msd_Registry::getDynamicConfig();
$config->set('dynamic.dbActual', 'i_dont_exist'); $dynamicConfig->setParam('dbActual', 'i_dont_exist');
$config->set('config.dbuser.defaultDb', 'I_dont_exist'); $config = Msd_Registry::getConfig();
$config->setParam('dbuser.defaultDb', 'I_dont_exist');
$this->dispatch('/'); $this->dispatch('/');
$this->assertQueryContentContains('#selectedDb', 'information_schema'); $this->assertQueryContentContains('#selectedDb', 'information_schema');
} }