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

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -16,7 +16,7 @@
* @package MySQLDumper
* @subpackage Controllers
*/
class SqlController extends Zend_Controller_Action
class SqlController extends Msd_Controller_Action
{
/**
* Db-handle
@ -54,7 +54,7 @@ class SqlController extends Zend_Controller_Action
$this->_helper->viewRenderer('databases/show-databases');
$databases = $this->_db->getDatabases(true);
$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
if (!in_array($dbActual, $dbNames)) {
$dbActual = $dbNames[0];
@ -72,13 +72,11 @@ class SqlController extends Zend_Controller_Action
{
$this->_helper->viewRenderer('tables/show-tables');
$pageNum = $this->_getParam('offset', 1);
$itemCountPerPage = $this->view->config->get(
'config.interface.recordsPerPage'
);
$itemCountPerPage = $this->view->config->getParam('interface.recordsPerPage');
$dbActual = $this->_getParam(
'database',
$this->view->config->get('dynamic.dbActual')
$this->view->dynamicConfig->getParam('dbActual')
);
if ($this->_getParam('dbName') !== null) {
$dbActual = base64_decode($this->_getParam('dbName'));
@ -106,11 +104,11 @@ class SqlController extends Zend_Controller_Action
public function showTableDataAction()
{
$this->_getDynamicParams();
$dbName = $this->view->config->get('dynamic.dbActual');
$dbName = $this->view->dynamicConfig->getParam('dbActual');
$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);
$tableName = $this->view->config->get('dynamic.tableActual');
$tableName = $this->view->dynamicConfig->getParam('tableActual');
try {
$this->view->columns = $this->_db->getTableColumns($tableName);
$tables = $this->_db->getTableStatus($tableName);
@ -127,7 +125,7 @@ class SqlController extends Zend_Controller_Action
$tableName = '';
}
}
$this->view->config->set('dynamic.tableActual', $tableName);
$this->view->dynamicConfig->setParam('tableActual', $tableName);
if (!empty($tables)) {
$query = sprintf(
'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());
$optimizeResults = array();
$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);
if ($this->_request->isPost() && !empty($tables)) {
@ -278,7 +276,7 @@ class SqlController extends Zend_Controller_Action
$tables = $this->_request->getParam('tables', array());
$analyzeResults = array();
$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);
if ($this->_request->isPost() && !empty($tables)) {
@ -303,7 +301,7 @@ class SqlController extends Zend_Controller_Action
$tables = $this->_request->getParam('tables', array());
$analyzeResults = array();
$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);
if ($this->_request->isPost() && !empty($tables)) {
@ -328,7 +326,7 @@ class SqlController extends Zend_Controller_Action
$tables = $this->_request->getParam('tables', array());
$analyzeResults = array();
$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);
if ($this->_request->isPost() && !empty($tables)) {
@ -353,7 +351,7 @@ class SqlController extends Zend_Controller_Action
$tables = $this->_request->getParam('tables', array());
$truncateResults = array();
$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);
if ($this->_request->isPost() && !empty($tables)) {
@ -377,17 +375,17 @@ class SqlController extends Zend_Controller_Action
$sqlboxModel = new Application_Model_Sqlbox();
$this->view->tableSelectBox = $sqlboxModel->getTableSelectBox();
$request = $this->getRequest();
$config = $this->view->config;
$dynamicConfig = $this->view->dynamicConfig;
$query = '';
if ($lastQuery = $config->get('dynamic.sqlboxQuery')) {
if ($lastQuery = $dynamicConfig->getParam('sqlboxQuery')) {
$query = $lastQuery;
}
if ($request->isPost()) {
$query = $request->getParam('sqltextarea', '');
$config->set('dynamic.sqlboxQuery', $query);
$dynamicConfig->setParam('sqlboxQuery', $query);
$query = trim($query);
if ($query > '') {
$this->_db->selectDb($config->get('dynamic.dbActual'));
$this->_db->selectDb($dynamicConfig->getParam('dbActual'));
$sqlObject = new Msd_Sql_Object($query);
$parser = new Msd_Sql_Parser($sqlObject, true);
$parser->parse();
@ -430,7 +428,7 @@ class SqlController extends Zend_Controller_Action
private function _refreshDbList()
{
$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 = '')
{
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->config->set('dynamic.tableActual', $tableActual);
$this->view->dynamicConfig->setParam('dbActual', $dbActual);
$this->view->dynamicConfig->setParam('tableActual', $tableActual);
}
/**
@ -460,12 +458,12 @@ class SqlController extends Zend_Controller_Action
$params = $this->_request->getParams();
if (isset($params['dbName'])) {
$dbName = base64_decode($params['dbName']);
$this->view->config->set('dynamic.dbActual', $dbName);
$this->view->dynamicConfig->setParam('dbActual', $dbName);
}
if (isset($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
* @subpackage Controllers
*/
class SqlServerController extends Zend_Controller_Action
class SqlServerController extends Msd_Controller_Action
{
/**
* Init