1
0
Fork 0
- Changed old configuration to new class for installation
- removed old classes
Dieser Commit ist enthalten in:
DSB 2012-08-21 20:22:56 +00:00
Ursprung c0be3ce898
Commit 4a569043a6
18 geänderte Dateien mit 345 neuen und 753 gelöschten Zeilen

Datei anzeigen

@ -215,7 +215,7 @@ class ConfigController extends Msd_Controller_Action
*/
public function addRecipientCcAction()
{
$recipientsCc = $this->_config->Param('email.RecipientCc');
$recipientsCc = $this->_config->getParam('email.RecipientCc');
if ($recipientsCc === null) {
$recipientsCc = array();
}
@ -286,6 +286,7 @@ class ConfigController extends Msd_Controller_Action
sort($ftpConfig);
}
$this->_config->setParam('ftp', $ftpConfig);
//$this->_config->save();
}
$this->_forward('index');
}
@ -410,6 +411,7 @@ class ConfigController extends Msd_Controller_Action
$value = $this->_config->getParam($group . '.' . $element);
if (is_array($value)) {
list (, $key) = explode('.', $element);
$value[$key] = isset($value[$key]) ? $value[$key] : '';
$subForm->setDefault($element, $value[$key]);
} else if ($value !== null) {
$subForm->setDefault($element, $value);

Datei anzeigen

@ -58,7 +58,6 @@ class IndexController extends Msd_Controller_Action
array('message' => 'L_PHP_VERSION_TOO_OLD')
);
}
try {
$dbo = Msd_Db::getAdapter();
$data = Msd_File::getLatestBackupInfo();
@ -265,14 +264,14 @@ class IndexController extends Msd_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'
)
);
'login-message',
'L_LOGIN',
$user->getAuthMessages(),
array(
'modal' => true,
'dialogClass' => 'error'
)
);
}
}
$this->view->form = $form;

Datei anzeigen

@ -16,8 +16,22 @@
* @package MySQLDumper
* @subpackage Controllers
*/
class InstallController extends Zend_Controller_Action
class InstallController extends Msd_Controller_Action
{
/**
* @var Msd_Config
*/
public $config;
/**
* @var Msd_DynamicConfig
*/
public $dynamicConfig;
/**
* @var Msd_Language
*/
public $lang;
/**
* Init controller
*
@ -27,23 +41,28 @@ class InstallController extends Zend_Controller_Action
{
$layout = Zend_Layout::getMvcInstance();
$layout->setLayout('install');
$this->version = new Msd_Version();
$this->version = new Msd_Version();
$_SESSION['msd_install'] = true;
if (
$this->_request->getActionName() != 'badversion!' &&
!$this->version->checkPhpVersion()
) {
if ($this->_request->getActionName() != 'badversion!' && !$this->version->checkPhpVersion()) {
$this->_forward(
'badversion',
'install',
'default',
array(
'message' => 'L_PHP_VERSION_TOO_OLD'
'message' => 'L_PHP_VERSION_TOO_OLD'
)
);
}
$config = Msd_Configuration::getInstance('defaultConfig');
$config->set('config.interface.theme', 'msd');
$this->_config->setParam('interface.theme', 'msd');
$this->_config->setParam('paths.iconPath', 'css/msd/icons');
$this->_config->setParam('configFile', 'mysqldumper.ini');
$this->view->config = $this->_config;
$lang = $_SESSION['msd_lang'];
if ($lang == '') {
$lang = 'en';
}
$translator = Msd_Language::getInstance();
$this->view->lang = $translator->loadLanguage($lang);
}
/**
@ -53,31 +72,27 @@ class InstallController extends Zend_Controller_Action
*/
public function indexAction()
{
// delete cookie from further installation if present
// to not import old values
// delete cookie from further installation if present to not import old values
if (isset($_SESSION['msd_autologin'])) {
setcookie('msd_autologin', null, null, '/');
$_SESSION['msd_autologin'] = array();
}
Zend_Session_Namespace::resetSingleInstance('MySQLDumper');
$config = Msd_Configuration::getInstance('defaultConfig', true);
$lang = Msd_Language::getInstance();
if ($this->_request->isPost()) {
$language = $this->_getParam('language');
$config->set('config.interface.language', $language);
$config->set('dynamic.configFile', 'mysqldumper');
$config->set('config.general.title', 'MySQLDumper');
$config->saveConfigToSession();
$this->_config->setParam('interface.language', $language);
$this->_config->setParam('general.title', 'MySQLDumper');
$this->_config->setParam('configFile', 'mysqldumper.ini');
$_SESSION['msd_lang'] = $language;
$redirectUrl = $this->view->url(array('controller' => 'install', 'action' => 'step2'), null, true);
$redirectUrl = $this->view->url(array('controller' => 'install', 'action' => 'step2'), null, true);
$this->_response->setRedirect($redirectUrl);
}
// set selected languge
$language = $this->_getParam('language', null);
$languages = $lang->getAvailableLanguages();
$language = $this->_getParam('language', null);
$languages = $this->_lang->getAvailableLanguages();
// check user browser language
$locale = new Zend_Locale();
$locale = new Zend_Locale();
$browserLocale = array_keys($locale->getBrowser());
// get default or last selected language
@ -99,22 +114,24 @@ class InstallController extends Zend_Controller_Action
$this->view->stepInfo = array(
'language' => $language,
'stepInfo' => array(
'number' => 1,
'description' => $lang->getTranslator()
->_('L_SELECT_LANGUAGE')
. ' (' . $language . ')'));
$languagesStatus = array();
'number' => 1,
'description' => $this->_lang->getTranslator()
->_('L_SELECT_LANGUAGE')
. ' (' . $language . ')'));
$languagesStatus = array();
foreach ($languages as $langId => $langName) {
$languagesStatus[$langId] = array(
'langName' => $langName,
'langName' => $langName,
'installed' => file_exists(
APPLICATION_PATH . '/language/' . $langId . '/lang.php'
)
);
}
$config->set('config.interface.language', $language);
$this->_config->setParam('interface.language', $language);
$this->view->languages = $languagesStatus;
$this->view->lang = $lang;
$this->view->lang = Msd_Language::getInstance();
Msd_Registry::setConfig($this->_config);
$this->view->config = Msd_Registry::getConfig();
}
/**
@ -126,24 +143,22 @@ class InstallController extends Zend_Controller_Action
*/
public function step2Action()
{
$lang = Msd_Language::getInstance();
$config = Msd_Configuration::getInstance();
$language = $config->get('config.interface.language');
$language = $this->_config->getParam('interface.language');
$this->view->stepInfo = array(
'language' => $language,
'language' => $language,
'firstStepOK' => true,
'stepInfo' => array(
'number' => 2,
'description' => $lang->getTranslator()->_('L_CHECK_DIRS'),
'stepInfo' => array(
'number' => 2,
'description' => $this->_lang->getTranslator()->_('L_CHECK_DIRS'),
)
);
$creationStatus = array();
$checkDirs = array(
'work' => $config->get('paths.work'),
'config' => $config->get('paths.config'),
'log' => $config->get('paths.log'),
'backup' => $config->get('paths.backup'),
'iconpath' => $config->get('paths.iconPath')
$creationStatus = array();
$checkDirs = array(
'work' => $this->_config->getParam('paths.work'),
'config' => $this->_config->getParam('paths.config'),
'log' => $this->_config->getParam('paths.log'),
'backup' => $this->_config->getParam('paths.backup'),
'iconpath' => $this->_config->getParam('paths.iconPath')
);
foreach ($checkDirs as $checkDir) {
@ -152,22 +167,21 @@ class InstallController extends Zend_Controller_Action
@mkdir($checkDir, 0777);
}
clearstatcache();
$checkExists = file_exists($checkDir);
$checkWritable = Msd_File::isWritable($checkDir, 0777);
$checkExists = file_exists($checkDir);
$checkWritable = Msd_File::isWritable($checkDir, 0777);
$creationStatus[$checkDir] = array(
'chmod' => Msd_File::getChmod($checkDir),
'exists' => $checkExists,
'chmod' => Msd_File::getChmod($checkDir),
'exists' => $checkExists,
'writable' => $checkWritable,
);
$this->view->status = $creationStatus;
$this->view->status = $creationStatus;
}
if (!in_array(false, $creationStatus)) {
$config->set('dynamic.configFile', 'mysqldumper');
$config->saveConfigToSession();
$this->_config->setParam('configFile', 'mysqldumper');
//$this->_config->save();
$redirectUrl = $this->view->url(array('controller' => 'install', 'action' => 'step3'), null, true);
$this->_response->setRedirect($redirectUrl);
}
$this->view->lang = $lang;
}
/**
@ -177,23 +191,20 @@ class InstallController extends Zend_Controller_Action
*/
public function step3Action()
{
$lang = Msd_Language::getInstance();
$config = Msd_Configuration::getInstance();
$language = $config->get('config.interface.language');
$form = new Application_Form_Install_User();
$language = $this->_config->getParam('interface.language');
$form = new Application_Form_Install_User();
$this->view->stepInfo = array(
'language' => $language,
'firstStepOK' => true,
'language' => $language,
'firstStepOK' => true,
'secondStepOK' => true,
'stepInfo' => array(
'number' => 3,
'description' => $lang->getTranslator()->_('L_AUTHENTICATE'),
'stepInfo' => array(
'number' => 3,
'description' => $this->_lang->getTranslator()->_('L_AUTHENTICATE'),
)
);
if ($this->_request->isPost()) {
$postData = $this->_request->getParams();
$form->getElement('pass_confirm')->getValidator('Identical')
->setToken($postData['pass']);
$form->getElement('pass_confirm')->getValidator('Identical')->setToken($postData['pass']);
if ($form->isValid($postData)) {
$ini = new Msd_Ini();
$ini->set('name', $postData['user'], 'user');
@ -204,7 +215,7 @@ class InstallController extends Zend_Controller_Action
}
}
$this->view->form = $form;
$this->view->lang = $lang;
$this->view->lang = Msd_Language::getInstance();
}
/**
@ -214,63 +225,61 @@ class InstallController extends Zend_Controller_Action
*/
public function step4Action()
{
$lang = Msd_Language::getInstance();
$config = Msd_Configuration::getInstance();
$language = $config->get('config.interface.language');
$language = $this->_config->getParam('interface.language');
$this->view->stepInfo = array(
'language' => $language,
'firstStepOK' => true,
'language' => $language,
'firstStepOK' => true,
'secondStepOK' => true,
'thirdStepOK' => true,
'stepInfo' => array(
'number' => 4,
'description' => $lang->getTranslator()->_('L_DBPARAMETER'),
'thirdStepOK' => true,
'stepInfo' => array(
'number' => 4,
'description' => $this->_lang->getTranslator()->_('L_DBPARAMETER'),
)
);
if ($this->_request->isPost()) {
$options = array(
'host' => $this->_getParam('host'),
'user' => $this->_getParam('user'),
'pass' => $this->_getParam('pass'),
'host' => $this->_getParam('host'),
'user' => $this->_getParam('user'),
'pass' => $this->_getParam('pass'),
'manual' => $this->_getParam('manual'),
'port' => $this->_getParam('port'),
'port' => $this->_getParam('port'),
'socket' => $this->_getParam('socket'),
);
$dbAdapter = Msd_Db::getAdapter($options);
try {
$this->view->databases = $dbAdapter->getDatabaseNames();
$this->view->success = true;
$this->_config->setParam('dbuser', $options);
if (!$this->version->checkMysqlVersion()) {
$this->_forward(
'badversion',
'install',
'default',
array(
'message' => 'L_MYSQL_VERSION_TOO_OLD'
)
);
}
} catch (Msd_Exception $e) {
$this->view->errorMessage = $e->getMessage();
$this->view->success = false;
return;
}
$saveParam = $this->_getParam('save');
$config->set('config.dbuser', $options);
$this->_config->setParam('dbuser', $options);
if ($saveParam !== null && $saveParam == 1) {
$config->set('config.general.title', 'MySQLDumper');
$config->set('config.dbuser.defaultDb', $this->_getParam('defaultDb'));
$config->save('mysqldumper');
$this->_config->setParam('general.title', 'MySQLDumper');
$this->_config->setParam('dbuser.defaultDb', $this->_getParam('defaultDb'));
$this->_config->save('mysqldumper.ini');
unset($_SESSION['msd_lang']);
unset($_SESSION['msd_install']);
$redirectUrl = $this->view->url(array('controller' => 'index', 'action' => 'index', null, true));
$this->_response->setRedirect($redirectUrl);
} else {
$dbAdapter = Msd_Db::getAdapter($options);
try {
$this->view->databases = $dbAdapter->getDatabaseNames();
$this->view->success = true;
$config->set('config.dbuser', $options);
if (!$this->version->checkMysqlVersion()) {
$this->_forward(
'badversion',
'install',
'default',
array(
'message' => 'L_MYSQL_VERSION_TOO_OLD'
)
);
}
$config->saveConfigToSession();
} catch (Msd_Exception $e) {
$this->view->errorMessage = $e->getMessage();
$this->view->success = false;
}
}
}
$this->view->lang = $lang;
}
/**
@ -284,15 +293,14 @@ class InstallController extends Zend_Controller_Action
Zend_Controller_Front::getInstance()->setParam('noViewRenderer', true);
$this->_response->setHeader('Content-Type', 'text/javascript');
$language = $this->_request->getParam('lang');
$lang = Msd_Language::getInstance();
$version = new Msd_Version();
$files = array(
$version = new Msd_Version();
$files = array(
'lang' => ':language/lang.php',
'flag' => ':language/flag.gif'
);
if ($language === null) {
if (!isset($_SESSION['langlist'])) {
$languages = $lang->getAvailableLanguages();
$languages = $this->_lang->getAvailableLanguages();
$_SESSION['langlist'] = array_keys($languages);
}
rsort($_SESSION['langlist']);
@ -303,9 +311,7 @@ class InstallController extends Zend_Controller_Action
echo json_encode('done');
return;
}
$update = new Msd_Update(
APPLICATION_PATH . '/configs/update.ini'
);
$update = new Msd_Update(APPLICATION_PATH . '/configs/update.ini');
$update->setUpdateParam('language', $language);
$update->setUpdateParam('version', $version->getMsdVersion());
$updateResult = $update->doUpdate('language', $files);
@ -313,20 +319,20 @@ class InstallController extends Zend_Controller_Action
switch ($updateResult['action']) {
case 'connection':
$message = array('L_UPDATE_CONNECTION_FAILED',
$updateResult['server']);
$updateResult['server']);
break;
case 'saveresponse':
$message = array('L_UPDATE_ERROR_RESPONSE',
$updateResult['status']);
$updateResult['status']);
break;
case 'createfile':
$message = array('L_WRONG_RIGHTS',
$updateResult['file'],
'0777');
$updateResult['file'],
'0777');
break;
case 'getrequest':
$message = array('L_UPDATE_ERROR_RESPONSE',
$updateResult['status']);
$updateResult['status']);
break;
default:
$message = '';
@ -334,25 +340,25 @@ class InstallController extends Zend_Controller_Action
if ($message !== '') {
$this->view
->popUpMessage()
->addMessage(
'update-message',
'L_LOGIN',
$message,
array(
'modal' => true,
'dialogClass' => 'error'
)
);
->popUpMessage()
->addMessage(
'update-message',
'L_LOGIN',
$message,
array(
'modal' => true,
'dialogClass' => 'error'
)
);
$updateResult['message'] = (string)$this->view->popUpMessage();
}
}
echo json_encode(
array(
'language' => $language,
'success' => ($updateResult === true) ? true : false,
'error' => ($updateResult === true) ? '' : $updateResult
'language' => $language,
'success' => ($updateResult === true) ? true : false,
'error' => ($updateResult === true) ? '' : $updateResult
)
);
}
@ -365,8 +371,8 @@ class InstallController extends Zend_Controller_Action
public function badversionAction()
{
$translator = Msd_Language::getInstance()->getTranslator();
$messageId = $this->_request->get('message');
$message = $translator->_($messageId);
$messageId = $this->_request->get('message');
$message = $translator->_($messageId);
if ($messageId == 'L_PHP_VERSION_TOO_OLD') {
$this->view->message = sprintf(
$message,
@ -374,7 +380,7 @@ class InstallController extends Zend_Controller_Action
PHP_VERSION
);
} else {
$dbObject = Msd_Db::getAdapter();
$dbObject = Msd_Db::getAdapter();
$this->view->message = sprintf(
$message,
$dbObject->getServerInfo(),

Datei anzeigen

@ -90,8 +90,7 @@ class SqlServerController extends Msd_Controller_Action
public function showProcesslistAction()
{
$this->getProcesslistAction(false);
$interval = $this->view->config
->get('config.interface.refreshProcesslist');
$interval = $this->view->config->getParam('interface.refreshProcesslist');
if ($interval < 2) {
$interval = 2;
}