Dieser Commit ist enthalten in:
Ursprung
2b21070b1a
Commit
f7a7c71f86
1583 geänderte Dateien mit 454759 neuen und 0 gelöschten Zeilen
380
application/controllers/ConfigController.php
Normale Datei
380
application/controllers/ConfigController.php
Normale Datei
|
|
@ -0,0 +1,380 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Config Controller
|
||||
*
|
||||
* Controller to handle actions triggered on configuration screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class ConfigController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Active jQuery tab Id
|
||||
* @var string
|
||||
*/
|
||||
private $_activeTab = 'tab_general';
|
||||
|
||||
/**
|
||||
* Build the form on demand.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _buildForm()
|
||||
{
|
||||
$form = new Zend_Form(
|
||||
array(
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
)
|
||||
);
|
||||
$form->addElementPrefixPath(
|
||||
'Msd_Form_Decorator',
|
||||
'Msd/Form/Decorator/',
|
||||
'decorator'
|
||||
);
|
||||
$form->addPrefixPath(
|
||||
'Msd_Form_Decorator',
|
||||
'Msd/Form/Decorator/',
|
||||
'decorator'
|
||||
);
|
||||
$form->setAction(
|
||||
$this->view->url(
|
||||
array(
|
||||
'controller' => 'config',
|
||||
'action' => 'index'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$langs = $this->view->lang->getAvailableLanguages();
|
||||
asort($langs);
|
||||
|
||||
$formGeneral = $this->_getSubformIni('general');
|
||||
$elementTitle = $formGeneral->getElement('title');
|
||||
$elementTitle->setValue(
|
||||
$this->view->config->get('config.general.title')
|
||||
);
|
||||
|
||||
$form->addSubForm($formGeneral, 'general');
|
||||
$form->addSubForm($this->_getPanelDatabases(), 'dbuser');
|
||||
$form->addSubForm($this->_getSubformIni('autodelete'), 'autodelete');
|
||||
$form->addSubForm(new Application_Form_Config_Email(), 'email');
|
||||
$form->addSubForm(new Application_Form_Config_Ftp(), 'ftp');
|
||||
$form->addSubForm($this->_getSubformIni('cronscript'), 'cronscript');
|
||||
|
||||
$formInterface = $this->_getSubformIni('interface');
|
||||
$themeSelect = $formInterface->getElement('theme');
|
||||
$themeSelect->setMultiOptions(Msd_File::getThemeList());
|
||||
$langSelect = $formInterface->getElement('language');
|
||||
$langSelect->setMultiOptions($langs);
|
||||
$form->addSubForm($formInterface, 'interface');
|
||||
|
||||
$form->clearDecorators();
|
||||
$translator = $this->view->lang->getTranslator();
|
||||
|
||||
$saveIcon = $this->view->getIcon('save', $translator->_('L_SAVE'));
|
||||
$form->addElement(
|
||||
'submit',
|
||||
'save',
|
||||
array(
|
||||
'class' => 'Formbutton',
|
||||
'helper' => 'formButton',
|
||||
'content' => $saveIcon . ' ' . $translator->_('L_SAVE'),
|
||||
'escape' => false,
|
||||
'type' => 'submit',
|
||||
'disableLoadDefaultDecorators' => true,
|
||||
'decorators' => array(
|
||||
'ViewHelper',
|
||||
'Tooltip'
|
||||
)
|
||||
)
|
||||
);
|
||||
$form->addDecorator('ConfigForm');
|
||||
$this->_setFormDefaultValues($form);
|
||||
$this->_setGroupVisibilities($form);
|
||||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Index action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
if ($this->_request->isPost()) {
|
||||
// if language is changed, we need to refresh the config before
|
||||
// the form is rendered
|
||||
$postData = $this->_request->getParams();
|
||||
if (isset($postData['language'])) {
|
||||
$this->view->lang->loadLanguage($postData['language']);
|
||||
}
|
||||
}
|
||||
$this->_buildForm();
|
||||
$this->_activeTab = $this->_getParam('selectedTab', 'tab_general');
|
||||
if ($this->_request->isPost()) {
|
||||
$this->_validateForm();
|
||||
}
|
||||
$this->view->currentTab = $this->_activeTab;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get validation errors and look for first tab with errors to jump to
|
||||
*
|
||||
* @param array $messages Form error messages
|
||||
*
|
||||
* @return array Array with messages and first tab to show
|
||||
*/
|
||||
private function _getFormErrors($messages)
|
||||
{
|
||||
$message = array();
|
||||
$firstTab = null;
|
||||
$form = $this->view->form;
|
||||
foreach ($messages as $tabKey => $tabMessage) {
|
||||
foreach ($tabMessage as $inputName => $inputMessage) {
|
||||
foreach ($inputMessage as $messageId => $messageText) {
|
||||
if ($firstTab === null) {
|
||||
$firstTab = 'tab_' . $tabKey;
|
||||
}
|
||||
$subForm = $form->getSubForm($tabKey);
|
||||
$formElement = $subForm->getElement($inputName);
|
||||
$elementClass = $formElement->getAttrib('class');
|
||||
$elementClass .= ' ' . 'inputError';
|
||||
$formElement->setAttrib('class', $elementClass);
|
||||
$message[] = $formElement->getLabel() . ': ' .
|
||||
$this->view->lang->translateZendId(
|
||||
$messageId,
|
||||
$messageText
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$ret = array();
|
||||
$ret['messages'] = implode('<br />', $message);
|
||||
$ret['firstTab'] = $firstTab;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get view values for configuration panel databases
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getPanelDatabases()
|
||||
{
|
||||
$formDb = $this->_getSubformIni('dbuser');
|
||||
|
||||
// get database names
|
||||
$dbAdapter = Msd_Db::getAdapter();
|
||||
$databases = $dbAdapter->getDatabaseNames();
|
||||
|
||||
// fill select-options with database names
|
||||
$formDb->getElement('defaultDb')->addMultioptions(
|
||||
array_combine($databases, $databases)
|
||||
);
|
||||
|
||||
return $formDb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read ini file and create subform
|
||||
*
|
||||
* @param string $subform
|
||||
*
|
||||
* @return Zend_Form_SubForm
|
||||
*/
|
||||
private function _getSubformIni($subform)
|
||||
{
|
||||
$subFormIni = new Zend_Config_Ini(
|
||||
APPLICATION_PATH . DS . 'forms' . DS . 'Config' . DS . $subform .
|
||||
'.ini'
|
||||
);
|
||||
$options = array('displayGroupPrefixPath' => $subform . '_');
|
||||
return new Zend_Form_SubForm($subFormIni, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Cc-Recipient to email form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addRecipientCcAction()
|
||||
{
|
||||
$recipientsCc = $this->view->config->get('config.email.RecipientCc');
|
||||
if ($recipientsCc === null) {
|
||||
$recipientsCc = array();
|
||||
}
|
||||
$index = count($recipientsCc);
|
||||
$recipientsCc[$index]['Name'] = '';
|
||||
$recipientsCc[$index]['Address'] = '';
|
||||
$recipientsCc = array_values($recipientsCc);
|
||||
$this->view->config->set('config.email.RecipientCc', $recipientsCc);
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a Cc-Recipient entry
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteRecipientCcAction()
|
||||
{
|
||||
$recipientToDelete = (int)$this->_request->getPost('param');
|
||||
$recipientsCc = $this->view->config->get('config.email.RecipientCc');
|
||||
if (isset($recipientsCc[$recipientToDelete])) {
|
||||
unset($recipientsCc[$recipientToDelete]);
|
||||
}
|
||||
$this->view->config->set('config.email.RecipientCc', $recipientsCc);
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Ftp-Connection
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addFtpConnectionAction()
|
||||
{
|
||||
$ftpConfig = $this->view->config->get('config.ftp');
|
||||
$index = 0;
|
||||
if (!empty($ftpConfig)) {
|
||||
$index = max(array_keys($ftpConfig)) + 1;
|
||||
}
|
||||
$default = $this->view->config->loadConfiguration(
|
||||
'defaultConfig',
|
||||
false
|
||||
);
|
||||
$default = $default->toArray();
|
||||
$ftpConfig[$index] = $default['ftp'][0];
|
||||
$this->view->config->set('config.ftp', $ftpConfig);
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Ftp-Connection
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteFtpConnectionAction()
|
||||
{
|
||||
$index = (int)$this->_request->getPost('param');
|
||||
$ftpConfig = $this->view->config->get('config.ftp');
|
||||
if (isset($ftpConfig[$index])) {
|
||||
unset($ftpConfig[$index]);
|
||||
sort($ftpConfig);
|
||||
}
|
||||
$this->view->config->set('config.ftp', $ftpConfig);
|
||||
$this->_forward('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default value of all sub forms to the configuration values
|
||||
*
|
||||
* @param Zend_Form $form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _setFormDefaultValues($form)
|
||||
{
|
||||
$subForms = $form->getSubForms();
|
||||
foreach ($subForms as $subForm) {
|
||||
$group = $subForm->getName();
|
||||
$elements = array_keys($subForm->getElements());
|
||||
foreach ($elements as $element) {
|
||||
$element = str_replace($group . '_', '', $element);
|
||||
$element = str_replace('_', '.', $element);
|
||||
$value = $this->view->config->get(
|
||||
'config.' .
|
||||
$group . '.' .
|
||||
$element
|
||||
);
|
||||
if ($value !== null) {
|
||||
$subForm->setDefault($element, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the config form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _validateForm()
|
||||
{
|
||||
$postData = $this->_request->getPost();
|
||||
$form = $this->view->form;
|
||||
$form->setDefaults($postData);
|
||||
if (isset($postData['save'])) {
|
||||
if (!$form->isValid($postData)) {
|
||||
$errors = $this->_getFormErrors($form->getMessages());
|
||||
if ($errors['messages'] != '') {
|
||||
$this->view->popUpMessage()->addMessage(
|
||||
'config-validate-error',
|
||||
'L_ERROR',
|
||||
$errors['messages'],
|
||||
array(
|
||||
'modal' => true
|
||||
)
|
||||
);
|
||||
// jump to first tab with validation error
|
||||
$this->_activeTab = $errors['firstTab'];
|
||||
}
|
||||
} else {
|
||||
$configData = $form->getValidValues($postData);
|
||||
$configValidator =
|
||||
new Application_Model_Config_FormValidator($configData);
|
||||
$configValidator->validate($this->view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default visibilities of the display groups inside of the form.
|
||||
* The visibilities depends on the current configuration.
|
||||
*
|
||||
* @param Zend_Form $form The whole form.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _setGroupVisibilities(Zend_Form $form)
|
||||
{
|
||||
$visibilityMap = array(
|
||||
true => 'block',
|
||||
false => 'none',
|
||||
);
|
||||
$emailForm = $form->getSubForm('email');
|
||||
$sendmailConfig = $emailForm->getDisplayGroup('sendmailConfig');
|
||||
$smtpConfig = $emailForm->getDisplayGroup('smtpConfig');
|
||||
$sendmailVisibility = false;
|
||||
$smtpVisibility = false;
|
||||
switch ($this->view->config->get('config.email.Program')) {
|
||||
case 'sendmail':
|
||||
$sendmailVisibility = true;
|
||||
break;
|
||||
case 'smtp':
|
||||
$smtpVisibility = true;
|
||||
break;
|
||||
}
|
||||
$sendmailConfig->addAttribs(
|
||||
array(
|
||||
'style' => 'display:'
|
||||
. $visibilityMap[$sendmailVisibility] . ';',
|
||||
)
|
||||
);
|
||||
$smtpConfig->addAttribs(
|
||||
array(
|
||||
'style' => 'display:' . $visibilityMap[$smtpVisibility] . ';',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
71
application/controllers/DumpController.php
Normale Datei
71
application/controllers/DumpController.php
Normale Datei
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Dump Controller
|
||||
*
|
||||
* Controller to handle actions triggered on dump screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class DumpController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Show dump page
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$dump = new Msd_Dump();
|
||||
$dump->prepareDumpProcess();
|
||||
$this->view->dumpData = '';
|
||||
$this->view->dumpData->nrOfDatabasesToBackup =
|
||||
count($dump->dbsToBackup);
|
||||
$this->view->dumpData->databasesToBackup =
|
||||
implode(', ', array_keys($dump->dbsToBackup));
|
||||
$this->view->dumpData->sumTotal = $dump->sumTotal;
|
||||
//TODO get comment from config profile
|
||||
$this->view->dumpData->comment = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Start dump action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function startDumpAction()
|
||||
{
|
||||
$taskList = Msd_TaskManager::getInstance('backupTasks');
|
||||
$tasks = $taskList->getTasks();
|
||||
$this->view->config = Msd_Configuration::getInstance();
|
||||
$this->view->sessionId = Zend_Session::getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do dump action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function doDumpAction()
|
||||
{
|
||||
Zend_Layout::getMvcInstance()->disableLayout();
|
||||
Zend_Controller_Front::getInstance()->setParam('noViewRenderer', true);
|
||||
$taskList = Msd_TaskManager::getInstance('backupTasks');
|
||||
$tasks = $taskList->getTasks();
|
||||
$ret = array(
|
||||
'backup_in_progress' => false,
|
||||
'config_file' => $this->view->config->get('dynamic.configFile')
|
||||
|
||||
);
|
||||
echo json_encode($ret);
|
||||
}
|
||||
}
|
||||
60
application/controllers/ErrorController.php
Normale Datei
60
application/controllers/ErrorController.php
Normale Datei
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Error Controller
|
||||
*
|
||||
* Handle unexpected errors and uncaught Exceptions
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class ErrorController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Handle error
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function errorAction()
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$errors = $this->_getParam('error_handler');
|
||||
if (is_object($errors)) {
|
||||
$exceptionTypes = array(
|
||||
Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE,
|
||||
Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER,
|
||||
Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION
|
||||
);
|
||||
if (in_array($errors->type, $exceptionTypes)) {
|
||||
// 404 error -- controller or action not found
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
$this->view->message = 'Page not found<br />'
|
||||
. $errors->exception->getMessage();
|
||||
$this->view->displayErrors = 1;
|
||||
} else {
|
||||
// application error
|
||||
$this->getResponse()->setHttpResponseCode(200);
|
||||
$this->view->message = 'Application error: '
|
||||
. $errors->exception->getMessage();
|
||||
}
|
||||
|
||||
// conditionally display exceptions
|
||||
if ($this->getInvokeArg('displayExceptions') == true) {
|
||||
$this->view->exception = $errors->exception;
|
||||
}
|
||||
if (in_array(APPLICATION_ENV, array('development', 'testing'))) {
|
||||
$this->view->displayErrors = 1;
|
||||
}
|
||||
$this->view->request = $errors->request;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
32
application/controllers/FilesController.php
Normale Datei
32
application/controllers/FilesController.php
Normale Datei
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* File Controller
|
||||
*
|
||||
* Controller to handle actions triggered on file management screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class FilesController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
// action body
|
||||
}
|
||||
|
||||
public function restoreAction()
|
||||
{
|
||||
//Dateien waehlen
|
||||
}
|
||||
}
|
||||
|
||||
306
application/controllers/IndexController.php
Normale Datei
306
application/controllers/IndexController.php
Normale Datei
|
|
@ -0,0 +1,306 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Index controller
|
||||
*
|
||||
* Controller to handle actions triggered on index screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class IndexController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Remember last controler
|
||||
* @var string
|
||||
*/
|
||||
private $_lastController;
|
||||
|
||||
/**
|
||||
* Remember last action
|
||||
* @var string
|
||||
*/
|
||||
private $_lastAction;
|
||||
|
||||
/**
|
||||
* Init
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$this->_lastController = $request->getParam('lastController', 'index');
|
||||
$this->_lastAction = $request->getParam('lastAction', 'index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Process index action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$version = new Msd_Version();
|
||||
if (!$version->checkPhpVersion()) {
|
||||
$this->_forward(
|
||||
'badversion',
|
||||
'install',
|
||||
'default',
|
||||
array(
|
||||
'message' => 'L_PHP_VERSION_TOO_OLD'
|
||||
)
|
||||
);
|
||||
}
|
||||
try {
|
||||
$dbo = Msd_Db::getAdapter();
|
||||
$data = Msd_File::getLatestBackupInfo();
|
||||
if (!empty($data)) {
|
||||
$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');
|
||||
$this->view->assign($data);
|
||||
if ($this->view->config->get('dynamic.dbActual') == '') {
|
||||
$dbNames = $dbo->getDatabaseNames();
|
||||
$this->view->config->set('dynamic.dbActual', $dbNames[0]);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$configNames = Msd_File::getConfigNames();
|
||||
if (count($configNames) == 0) {
|
||||
// no configuration file found - we need to install MSD
|
||||
$this->_redirect('/install/index');
|
||||
} else {
|
||||
// config found and loaded but we couldn't access MySQL
|
||||
// MySQL data seems to be invalid (changed user or server)
|
||||
// TODO give feedback to user and let him correct MySQL data
|
||||
$this->_redirect('/index/login');
|
||||
}
|
||||
}
|
||||
if (!$version->checkMysqlVersion()) {
|
||||
$this->_forward(
|
||||
'badversion',
|
||||
'install',
|
||||
'default',
|
||||
array('message' => 'L_MYSQL_VERSION_TOO_OLD')
|
||||
);
|
||||
}
|
||||
$this->view->version = $version;
|
||||
$this->view->dbAdapter = get_class($dbo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch configuration file
|
||||
*
|
||||
* Load selected configuration and forward to last page
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function switchconfigAction()
|
||||
{
|
||||
$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);
|
||||
if ($this->_lastAction != 'switchconfig') { //prevent endless loop
|
||||
$this->_forward($this->_lastAction, $this->_lastController);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select another database as actual db
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function selectdbAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$request = $this->getRequest();
|
||||
$selectedDb = base64_decode($request->getParam('selectedDb'));
|
||||
$this->view->config->set('dynamic.dbActual', $selectedDb);
|
||||
if ($this->_lastAction != 'selectdb') { //prevent endless loop
|
||||
$redirectUrl = $this->view->url(
|
||||
array(
|
||||
'controller' => $this->_lastController,
|
||||
'action' => $this->_lastAction,
|
||||
),
|
||||
null,
|
||||
true
|
||||
);
|
||||
$this->_response->setRedirect($redirectUrl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh database list
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function dbrefreshAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$dbo = Msd_Db::getAdapter();
|
||||
$databases = $dbo->getDatabaseNames();
|
||||
$this->view->config->set('dynamic.databases', $databases);
|
||||
$actualDb = $this->view->config->get('dynamic.dbActual');
|
||||
if ($dbo->selectDb($actualDb) !== true) {
|
||||
//actual db is no longer available -> switch to first one
|
||||
$this->view->config->set('dynamic.dbActual', $databases[0]);
|
||||
}
|
||||
if ($this->_lastAction != 'refreshdb') { //prevent endless loop
|
||||
$redirectUrl = $this->view->url(
|
||||
array(
|
||||
'controller' => $this->_lastController,
|
||||
'action' => $this->_lastAction,
|
||||
),
|
||||
null,
|
||||
true
|
||||
);
|
||||
$this->_response->setRedirect($redirectUrl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process phpinfo action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function phpinfoAction()
|
||||
{
|
||||
//nothing to process - just render view
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to url
|
||||
*
|
||||
* @param array $url
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _doRedirect(array $url = array())
|
||||
{
|
||||
$this->_response->setRedirect($this->view->url($url, null, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout the user and redirect him to login page
|
||||
*/
|
||||
public function logoutAction()
|
||||
{
|
||||
//un-Auth user
|
||||
$user = new Msd_User();
|
||||
$user->logout();
|
||||
if (PHP_SAPI != 'cli') {
|
||||
setcookie('msd_autologin', null, null, '/');
|
||||
}
|
||||
$this->_doRedirect(
|
||||
array(
|
||||
'controller' => 'index',
|
||||
'action' => 'login'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* User login
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loginAction()
|
||||
{
|
||||
$form = new Application_Form_Login();
|
||||
if ($this->_request->isPost()) {
|
||||
$user = new Msd_User();
|
||||
$postData = $this->_request->getParams();
|
||||
if ($form->isValid($postData)) {
|
||||
$autoLogin = ($postData['autologin'] == 1) ? true : false;
|
||||
$loginResult = $user->login(
|
||||
$postData['user'],
|
||||
$postData['pass'],
|
||||
$autoLogin
|
||||
);
|
||||
$this->view->messages = $user->getAuthMessages();
|
||||
switch ($loginResult) {
|
||||
case Msd_User::NO_USER_FILE:
|
||||
case Msd_User::NO_VALID_USER:
|
||||
// users.ini doesn't exist or doesn't have entries
|
||||
$this->_doRedirect(
|
||||
array(
|
||||
'controller' => 'install',
|
||||
'action' => 'index'
|
||||
)
|
||||
);
|
||||
break;
|
||||
case Msd_User::UNKNOWN_IDENTITY:
|
||||
// user is not listed in users.ini
|
||||
break;
|
||||
case Msd_User::SUCCESS:
|
||||
$defaultDb = $this->view->config->get(
|
||||
'config.dbuser.defaultDb'
|
||||
);
|
||||
|
||||
// set actualDb to defaultDb
|
||||
if ($defaultDb != '') {
|
||||
$this->view->config->set(
|
||||
'dynamic.dbActual',
|
||||
$defaultDb
|
||||
);
|
||||
}
|
||||
$this->_doRedirect(
|
||||
array(
|
||||
'controller' => 'index',
|
||||
'action' => 'index'
|
||||
)
|
||||
);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
// if we get here wrong credentials are given
|
||||
$this->view->popUpMessage()
|
||||
->addMessage(
|
||||
'login-message',
|
||||
'L_LOGIN',
|
||||
$user->getAuthMessages(),
|
||||
array(
|
||||
'modal' => true,
|
||||
'dialogClass' => 'error'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle menu state (shown or hidden) and save state to session.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxToggleMenuAction()
|
||||
{
|
||||
$menu = new Zend_Session_Namespace('menu');
|
||||
if (isset($menu->showMenu)) {
|
||||
$menu->showMenu = (int)$menu->showMenu;
|
||||
} else {
|
||||
$menu->showMenu = 0;
|
||||
}
|
||||
$menu->showMenu = $menu->showMenu == 1 ? 0 : 1;
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->view->showMenu = $menu->showMenu;
|
||||
}
|
||||
|
||||
}
|
||||
387
application/controllers/InstallController.php
Normale Datei
387
application/controllers/InstallController.php
Normale Datei
|
|
@ -0,0 +1,387 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Install controller
|
||||
*
|
||||
* Controller to handle actions triggered on install process
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class InstallController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Init controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$layout = Zend_Layout::getMvcInstance();
|
||||
$layout->setLayout('install');
|
||||
$this->version = new Msd_Version();
|
||||
$_SESSION['msd_install'] = true;
|
||||
if (
|
||||
$this->_request->getActionName() != 'badversion!' &&
|
||||
!$this->version->checkPhpVersion()
|
||||
) {
|
||||
$this->_forward(
|
||||
'badversion',
|
||||
'install',
|
||||
'default',
|
||||
array(
|
||||
'message' => 'L_PHP_VERSION_TOO_OLD'
|
||||
)
|
||||
);
|
||||
}
|
||||
$config = Msd_Configuration::getInstance('defaultConfig');
|
||||
$config->set('config.interface.theme', 'msd');
|
||||
}
|
||||
|
||||
/**
|
||||
* Start installation process
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
// 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();
|
||||
$_SESSION['msd_lang'] = $language;
|
||||
$redirectUrl = $this->view->url(array('controller' => 'install', 'action' => 'step2'), null, true);
|
||||
$this->_response->setRedirect($redirectUrl);
|
||||
}
|
||||
// set selected languge
|
||||
$language = $this->_getParam('language', 'en');
|
||||
$languages = $lang->getAvailableLanguages();
|
||||
|
||||
// check user browser language
|
||||
$locale = new Zend_Locale();
|
||||
$browserLocale = array_keys($locale->getBrowser());
|
||||
|
||||
// get default or last selected language
|
||||
if ($language === null) {
|
||||
if (isset($_SESSION['msd_lang'])) {
|
||||
$language = $_SESSION['msd_lang'];
|
||||
} else {
|
||||
foreach ($browserLocale as $localeCode) {
|
||||
if (array_key_exists($localeCode, $languages)) {
|
||||
$language = $localeCode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Msd_Language::getInstance()->loadLanguage($language);
|
||||
$this->view->language = $language;
|
||||
$this->view->stepInfo = array(
|
||||
'language' => $language,
|
||||
'stepInfo' => array(
|
||||
'number' => 1,
|
||||
'description' => $lang->getTranslator()
|
||||
->_('L_SELECT_LANGUAGE')
|
||||
. ' (' . $language . ')'));
|
||||
$languagesStatus = array();
|
||||
foreach ($languages as $langId => $langName) {
|
||||
$languagesStatus[$langId] = array(
|
||||
'langName' => $langName,
|
||||
'installed' => file_exists(
|
||||
APPLICATION_PATH . DS . 'language' .
|
||||
DS . $langId . DS . 'lang.php'
|
||||
)
|
||||
);
|
||||
}
|
||||
$config->set('config.interface.language', $language);
|
||||
$this->view->languages = $languagesStatus;
|
||||
$this->view->lang = $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 2 - check directories
|
||||
*
|
||||
* Make sure work-directories exist and are writable.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function step2Action()
|
||||
{
|
||||
$lang = Msd_Language::getInstance();
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$language = $config->get('config.interface.language');
|
||||
$this->view->stepInfo = array(
|
||||
'language' => $language,
|
||||
'firstStepOK' => true,
|
||||
'stepInfo' => array(
|
||||
'number' => 2,
|
||||
'description' => $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')
|
||||
);
|
||||
|
||||
foreach ($checkDirs as $checkDir) {
|
||||
clearstatcache();
|
||||
if (!is_dir($checkDir)) {
|
||||
@mkdir($checkDir, 0777);
|
||||
}
|
||||
clearstatcache();
|
||||
$checkExists = file_exists($checkDir);
|
||||
$checkWritable = Msd_File::isWritable($checkDir, 0777);
|
||||
$creationStatus[$checkDir] = array(
|
||||
'chmod' => Msd_File::getChmod($checkDir),
|
||||
'exists' => $checkExists,
|
||||
'writable' => $checkWritable,
|
||||
);
|
||||
$this->view->status = $creationStatus;
|
||||
}
|
||||
if (!in_array(false, $creationStatus)) {
|
||||
$config->set('dynamic.configFile', 'mysqldumper');
|
||||
$config->saveConfigToSession();
|
||||
$redirectUrl = $this->view->url(array('controller' => 'install', 'action' => 'step3'), null, true);
|
||||
$this->_response->setRedirect($redirectUrl);
|
||||
}
|
||||
$this->view->lang = $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 3 - Enter administrative user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function step3Action()
|
||||
{
|
||||
$lang = Msd_Language::getInstance();
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$language = $config->get('config.interface.language');
|
||||
$form = new Application_Form_Install_User();
|
||||
$this->view->stepInfo = array(
|
||||
'language' => $language,
|
||||
'firstStepOK' => true,
|
||||
'secondStepOK' => true,
|
||||
'stepInfo' => array(
|
||||
'number' => 3,
|
||||
'description' => $lang->getTranslator()->_('L_AUTHENTICATE'),
|
||||
)
|
||||
);
|
||||
if ($this->_request->isPost()) {
|
||||
$postData = $this->_request->getParams();
|
||||
$form->getElement('pass_confirm')->getValidator('Identical')
|
||||
->setToken($postData['pass']);
|
||||
if ($form->isValid($postData)) {
|
||||
$ini = new Msd_Ini();
|
||||
$ini->set('name', $postData['user'], '0');
|
||||
$ini->set('pass', md5($postData['pass']), '0');
|
||||
$ini->save(APPLICATION_PATH . DS . 'configs' . DS . 'users.ini');
|
||||
$redirectUrl = $this->view->url(array('controller' => 'install', 'action' => 'step4'), null, true);
|
||||
$this->_response->setRedirect($redirectUrl);
|
||||
}
|
||||
}
|
||||
$this->view->form = $form;
|
||||
$this->view->lang = $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 4 - Enter database params
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function step4Action()
|
||||
{
|
||||
$lang = Msd_Language::getInstance();
|
||||
$config = Msd_Configuration::getInstance();
|
||||
$language = $config->get('config.interface.language');
|
||||
$this->view->stepInfo = array(
|
||||
'language' => $language,
|
||||
'firstStepOK' => true,
|
||||
'secondStepOK' => true,
|
||||
'thirdStepOK' => true,
|
||||
'stepInfo' => array(
|
||||
'number' => 4,
|
||||
'description' => $lang->getTranslator()->_('L_DBPARAMETER'),
|
||||
)
|
||||
);
|
||||
|
||||
if ($this->_request->isPost()) {
|
||||
$options = array(
|
||||
'host' => $this->_getParam('host'),
|
||||
'user' => $this->_getParam('user'),
|
||||
'pass' => $this->_getParam('pass'),
|
||||
'manual' => $this->_getParam('manual'),
|
||||
'port' => $this->_getParam('port'),
|
||||
'socket' => $this->_getParam('socket'),
|
||||
);
|
||||
$saveParam = $this->_getParam('save');
|
||||
$config->set('config.dbuser', $options);
|
||||
if ($saveParam !== null && $saveParam == 1) {
|
||||
$config->set('config.general.title', 'MySQLDumper');
|
||||
$config->set('config.dbuser.defaultDb', $this->_getParam('defaultDb'));
|
||||
$config->save('mysqldumper');
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax action for loading language packs
|
||||
*
|
||||
* @return string Json response
|
||||
*/
|
||||
public function ajaxAction()
|
||||
{
|
||||
Zend_Layout::getMvcInstance()->disableLayout();
|
||||
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(
|
||||
'lang' => ':language' . DS . 'lang.php',
|
||||
'flag' => ':language' . DS . 'flag.gif'
|
||||
);
|
||||
if ($language === null) {
|
||||
if (!isset($_SESSION['langlist'])) {
|
||||
$languages = $lang->getAvailableLanguages();
|
||||
$_SESSION['langlist'] = array_keys($languages);
|
||||
}
|
||||
rsort($_SESSION['langlist']);
|
||||
$language = array_pop($_SESSION['langlist']);
|
||||
}
|
||||
if ($language === null) {
|
||||
unset($_SESSION['langlist']);
|
||||
echo json_encode('done');
|
||||
return;
|
||||
}
|
||||
$update = new Msd_Update(
|
||||
APPLICATION_PATH . DS . 'configs' .
|
||||
DS . 'update.ini'
|
||||
);
|
||||
$update->setUpdateParam('language', $language);
|
||||
$update->setUpdateParam('version', $version->getMsdVersion());
|
||||
$updateResult = $update->doUpdate('language', $files);
|
||||
if (!($updateResult === true)) {
|
||||
switch ($updateResult['action']) {
|
||||
case 'connection':
|
||||
$message = array('L_UPDATE_CONNECTION_FAILED',
|
||||
$updateResult['server']);
|
||||
break;
|
||||
case 'saveresponse':
|
||||
$message = array('L_UPDATE_ERROR_RESPONSE',
|
||||
$updateResult['status']);
|
||||
break;
|
||||
case 'createfile':
|
||||
$message = array('L_WRONG_RIGHTS',
|
||||
$updateResult['file'],
|
||||
'0777');
|
||||
break;
|
||||
case 'getrequest':
|
||||
$message = array('L_UPDATE_ERROR_RESPONSE',
|
||||
$updateResult['status']);
|
||||
break;
|
||||
default:
|
||||
$message = '';
|
||||
}
|
||||
|
||||
if ($message !== '') {
|
||||
$this->view
|
||||
->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
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP or MySQL version requirements are not met.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function badversionAction()
|
||||
{
|
||||
$translator = Msd_Language::getInstance()->getTranslator();
|
||||
$messageId = $this->_request->get('message');
|
||||
$message = $translator->_($messageId);
|
||||
if ($messageId == 'L_PHP_VERSION_TOO_OLD') {
|
||||
$this->view->message = sprintf(
|
||||
$message,
|
||||
$this->version->getRequiredPhpVersion(),
|
||||
PHP_VERSION
|
||||
);
|
||||
} else {
|
||||
$dbObject = Msd_Db::getAdapter();
|
||||
$this->view->message = sprintf(
|
||||
$message,
|
||||
$dbObject->getServerInfo(),
|
||||
$this->version->getRequiredMysqlVersion()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
112
application/controllers/LogController.php
Normale Datei
112
application/controllers/LogController.php
Normale Datei
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Log Controller
|
||||
*
|
||||
* Controller to handle actions triggered on log screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class LogController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Delete a log file
|
||||
*
|
||||
* @param string $logType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteLogAction($logType)
|
||||
{
|
||||
$log = Msd_Log::getInstance();
|
||||
$log->delete($logType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show log
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$logType = $this->_getParam('log', Msd_Log::PHP);
|
||||
$logger = new Msd_Log;
|
||||
$log = $logger->getFile($logType);
|
||||
$reverse = $this->_getParam('reverse', 1);
|
||||
$offset = $this->_getParam('offset', 0);
|
||||
$delete = $this->_getParam('delete');
|
||||
|
||||
if ($delete != null) {
|
||||
$log->delete($logType);
|
||||
$this->_redirect('/log/index/log/' . $logType);
|
||||
}
|
||||
|
||||
$sortIcon = $this->view->getIcon('ArrowDown', '', 16);
|
||||
if ($reverse == 0) {
|
||||
$sortIcon = $this->view->getIcon('ArrowUp', '', 16);
|
||||
}
|
||||
$this->view->sortIcon = $sortIcon;
|
||||
$this->view->log = $log;
|
||||
$this->view->assign(
|
||||
array(
|
||||
'sortIcon' => $sortIcon,
|
||||
'SORT_ORDER' => $reverse == 0 ? 1 : 0
|
||||
)
|
||||
);
|
||||
$this->view->offset = $offset;
|
||||
$this->view->log = $logger;
|
||||
$this->view->activeLog = $logType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render log view and return as ajax response
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxAction()
|
||||
{
|
||||
$logType = $this->_getParam('log', Msd_Log::PHP);
|
||||
$reverse = $this->_getParam('reverse', 0);
|
||||
$page = $this->_getParam('offset', 1);
|
||||
$entriesPerPage =
|
||||
$this->view->config->get('config.interface.recordsPerPage');
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$logger = Msd_Log::getInstance();
|
||||
$lines = $logger->read($logType, $reverse);
|
||||
$pagination = $this->_getPaginator($lines, $page, $entriesPerPage);
|
||||
$this->view->log = $logType;
|
||||
$this->view->reverse = ($reverse == 1) ? 0 : 1;
|
||||
$this->view->page = $page;
|
||||
$this->view->entriesPerPage = $entriesPerPage;
|
||||
$this->view->logEntries = $pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Paginator
|
||||
*
|
||||
* @param array $lines
|
||||
* @param int $offset
|
||||
*
|
||||
* @return Zend_Paginator
|
||||
*/
|
||||
private function _getPaginator($lines, $offset, $entriesPerPage = 20)
|
||||
{
|
||||
$pagination = new Zend_Paginator(
|
||||
new Zend_Paginator_Adapter_Array($lines)
|
||||
);
|
||||
$pagination->setPageRange(20);
|
||||
$pagination->setCurrentPageNumber($offset)
|
||||
->setDefaultItemCountPerPage($entriesPerPage);
|
||||
return $pagination;
|
||||
}
|
||||
}
|
||||
|
||||
24
application/controllers/RestoreController.php
Normale Datei
24
application/controllers/RestoreController.php
Normale Datei
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Restore controller
|
||||
*
|
||||
* Controller to handle actions triggered on restore screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class RestoreController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
485
application/controllers/SqlController.php
Normale Datei
485
application/controllers/SqlController.php
Normale Datei
|
|
@ -0,0 +1,485 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Sql Controller
|
||||
*
|
||||
* Controller to handle actions an SQLBrowser screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class SqlController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Db-handle
|
||||
* @var Msd_Db
|
||||
*/
|
||||
private $_db;
|
||||
|
||||
/**
|
||||
* Init
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->_db = Msd_Db::getAdapter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show list of databases
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_forward('show.databases');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show list of databases
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showDatabasesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer('databases/show-databases');
|
||||
$databases = $this->_db->getDatabases(true);
|
||||
$dbNames = $this->_db->getDatabaseNames();
|
||||
$dbActual = $this->view->config->get('dynamic.dbActual');
|
||||
//Fallback to first found db if actual db doesn't exist
|
||||
if (!in_array($dbActual, $dbNames)) {
|
||||
$dbActual = $dbNames[0];
|
||||
}
|
||||
$this->_setDynamicParams($dbActual);
|
||||
$this->view->dbInfos = $databases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show list of all tables of selected database
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showTablesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer('tables/show-tables');
|
||||
$pageNum = $this->_getParam('offset', 1);
|
||||
$itemCountPerPage = $this->view->config->get(
|
||||
'config.interface.recordsPerPage'
|
||||
);
|
||||
|
||||
$dbActual = $this->_getParam(
|
||||
'database',
|
||||
$this->view->config->get('dynamic.dbActual')
|
||||
);
|
||||
if ($this->_getParam('dbName') !== null) {
|
||||
$dbActual = base64_decode($this->_getParam('dbName'));
|
||||
}
|
||||
$this->_db->selectDb($dbActual);
|
||||
$this->_setDynamicParams($dbActual);
|
||||
$paginatorAdapter = new Zend_Paginator_Adapter_Array(
|
||||
$this->_db->getTableStatus()
|
||||
);
|
||||
$paginator = new Zend_Paginator($paginatorAdapter);
|
||||
|
||||
$paginator->setDefaultItemCountPerPage($itemCountPerPage);
|
||||
$paginator->setCurrentPageNumber($pageNum);
|
||||
|
||||
$this->view->tables = $paginator;
|
||||
$this->view->page = $pageNum;
|
||||
$this->view->startEntry = $itemCountPerPage * ($pageNum - 1) + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show data of selected table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showTableDataAction()
|
||||
{
|
||||
$this->_getDynamicParams();
|
||||
$dbName = $this->view->config->get('dynamic.dbActual');
|
||||
$offset = (int)$this->_getParam('offset', 0);
|
||||
$limit = $this->view->config->get('config.interface.recordsPerPage');
|
||||
$this->_db->selectDb($dbName);
|
||||
$tableName = $this->view->config->get('dynamic.tableActual');
|
||||
try {
|
||||
$this->view->columns = $this->_db->getTableColumns($tableName);
|
||||
$tables = $this->_db->getTableStatus($tableName);
|
||||
} catch (Exception $e) {
|
||||
// selected table not found - fall back to first found table
|
||||
$tables = $this->_db->getTableStatus();
|
||||
if (isset($tables[0]['TABLE_NAME'])) {
|
||||
$tableName = $tables[0]['TABLE_NAME'];
|
||||
$this->view->columns = $this->_db->getTableColumns($tableName);
|
||||
} else {
|
||||
// the selected database has no tables
|
||||
$this->view->noTables = true;
|
||||
$tables = array();
|
||||
$tableName = '';
|
||||
}
|
||||
}
|
||||
$this->view->config->set('dynamic.tableActual', $tableName);
|
||||
if (!empty($tables)) {
|
||||
$query = sprintf(
|
||||
'SELECT SQL_CALC_FOUND_ROWS * FROM `%s` LIMIT %s, %s',
|
||||
$tableName,
|
||||
$offset,
|
||||
$limit
|
||||
);
|
||||
$this->view->data = $this->_db->query($query);
|
||||
}
|
||||
$this->view->table = $tableName;
|
||||
$this->view->tables = $tables;
|
||||
$this->view->database = $dbName;
|
||||
$this->view->offset = $offset;
|
||||
$this->render('tables/show-table-data');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new table for the selected database
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function createTableAction()
|
||||
{
|
||||
$this->render('tables/create-table');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of records
|
||||
*
|
||||
* //TODO unused at this moment - need to decide if we use this for
|
||||
* table information schema, because showing the nr of records takes too
|
||||
* long if done in one page request!
|
||||
* //TODO create clean http headers for response
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxShowRecordcountAction()
|
||||
{
|
||||
Zend_Layout::getMvcInstance()->disableLayout();
|
||||
Zend_Controller_Front::getInstance()->setParam('noViewRenderer', true);
|
||||
$dbName = $this->_getParam('dbName');
|
||||
$tableName = $this->_getParam('tableName');
|
||||
$records = $this->_db->getNrOfRowsBySelectCount($tableName, $dbName);
|
||||
echo $records;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new database
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function createDatabaseAction()
|
||||
{
|
||||
$this->_helper->viewRenderer('databases/create-database');
|
||||
$collations = $this->_db->getCollations();
|
||||
$this->view->charsets = array_keys($collations);
|
||||
$this->view->collations = $collations;
|
||||
$this->view->defaultCollations = $this->_db->getDefaultCollations();
|
||||
$defaults = array(
|
||||
'dbName' => '',
|
||||
'dbCharset' => 'utf8',
|
||||
'dbCollation' => 'utf8_general_ci',
|
||||
);
|
||||
$newDbInfo = $this->_request->getParam('newDbInfo', $defaults);
|
||||
if ($this->_request->isPost()) {
|
||||
$errorInfo = array();
|
||||
try {
|
||||
$dbCreated = $this->_db->createDatabase(
|
||||
$newDbInfo['dbName'],
|
||||
$newDbInfo['dbCharset'],
|
||||
$newDbInfo['dbCollation']
|
||||
);
|
||||
if (!$dbCreated) {
|
||||
$errorInfo = $this->_db->getLastError();
|
||||
} else {
|
||||
//db created - refresh db list for menu
|
||||
$this->view->config->set(
|
||||
'dynamic.dbActual',
|
||||
$newDbInfo['dbName']
|
||||
);
|
||||
$this->_refreshDbList('create.database');
|
||||
}
|
||||
} catch (Msd_Exception $e) {
|
||||
$dbCreated = false;
|
||||
$errorInfo = array(
|
||||
'code' => $e->getCode(),
|
||||
'message' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
$this->view->dbCreated = $dbCreated;
|
||||
$this->view->errorInfo = $errorInfo;
|
||||
|
||||
}
|
||||
$this->view->newDbInfo = $newDbInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops databases and set a result array for the view renderer.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function dropDatabaseAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
if ($this->_request->isPost()) {
|
||||
//selection of db names given
|
||||
$databases = $this->_request->getParam('dbNames', array());
|
||||
$databases = array_map('base64_decode', $databases);
|
||||
} else {
|
||||
//link for one db clicked
|
||||
$databases = $this->_request->getParam('dbName', '');
|
||||
if ($databases == '') {
|
||||
return;
|
||||
}
|
||||
$databases = base64_decode($databases);
|
||||
}
|
||||
$databaseModel = new Application_Model_Databases($this->_db);
|
||||
$dropResults = $databaseModel->dropDatabases($databases);
|
||||
$this->view->actionResults = $dropResults;
|
||||
$this->view->executedAction = 'L_DELETE_DATABASE';
|
||||
$this->_refreshDbList();
|
||||
$this->_forward('index', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncates (empties) a database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function truncateDatabaseAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$databases = $this->_request->getParam('dbNames', array());
|
||||
$databases = array_map('base64_decode', $databases);
|
||||
if (!empty($databases)) {
|
||||
$databaseModel = new Application_Model_Databases($this->_db);
|
||||
$truncateResult = array();
|
||||
foreach ($databases as $database) {
|
||||
$res = $databaseModel->truncateDatabase($database);
|
||||
$truncateResult = array_merge($truncateResult, $res);
|
||||
}
|
||||
$this->view->actionResults = $truncateResult;
|
||||
$this->view->executedAction = 'L_SQL_EMPTYDB';
|
||||
}
|
||||
$this->_forward('index', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimize selected tables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function optimizeTablesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$tables = $this->_request->getParam('tables', array());
|
||||
$optimizeResults = array();
|
||||
$this->view->action = $this->view->lang->L_OPTIMIZE;
|
||||
$database = $this->view->config->get('dynamic.dbActual');
|
||||
$this->_db->selectDb($database);
|
||||
if ($this->_request->isPost() && !empty($tables)) {
|
||||
|
||||
foreach ($tables as $tableName) {
|
||||
$optimizeResults[] = $this->_db->optimizeTable($tableName);
|
||||
}
|
||||
|
||||
$this->view->actionResult = $optimizeResults;
|
||||
}
|
||||
$this->view->selectedTables = $tables;
|
||||
$this->_forward('show.tables', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyze selected tables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function analyzeTablesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$tables = $this->_request->getParam('tables', array());
|
||||
$analyzeResults = array();
|
||||
$this->view->action = $this->view->lang->L_ANALYZE;
|
||||
$database = $this->view->config->get('dynamic.dbActual');
|
||||
$this->_db->selectDb($database);
|
||||
if ($this->_request->isPost() && !empty($tables)) {
|
||||
|
||||
foreach ($tables as $tableName) {
|
||||
$analyzeResults[] = $this->_db->analyzeTable($tableName);
|
||||
}
|
||||
|
||||
$this->view->actionResult = $analyzeResults;
|
||||
}
|
||||
$this->view->selectedTables = $tables;
|
||||
$this->_forward('show.tables', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check selected tables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkTablesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$tables = $this->_request->getParam('tables', array());
|
||||
$analyzeResults = array();
|
||||
$this->view->action = $this->view->lang->L_ANALYZE;
|
||||
$database = $this->view->config->get('dynamic.dbActual');
|
||||
$this->_db->selectDb($database);
|
||||
if ($this->_request->isPost() && !empty($tables)) {
|
||||
|
||||
foreach ($tables as $tableName) {
|
||||
$analyzeResults[] = $this->_db->checkTable($tableName);
|
||||
}
|
||||
|
||||
$this->view->actionResult = $analyzeResults;
|
||||
}
|
||||
$this->view->selectedTables = $tables;
|
||||
$this->_forward('show.tables', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Repair selected tables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function repairTablesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$tables = $this->_request->getParam('tables', array());
|
||||
$analyzeResults = array();
|
||||
$this->view->action = $this->view->lang->L_ANALYZE;
|
||||
$database = $this->view->config->get('dynamic.dbActual');
|
||||
$this->_db->selectDb($database);
|
||||
if ($this->_request->isPost() && !empty($tables)) {
|
||||
|
||||
foreach ($tables as $tableName) {
|
||||
$analyzeResults[] = $this->_db->repairTable($tableName);
|
||||
}
|
||||
|
||||
$this->view->actionResult = $analyzeResults;
|
||||
}
|
||||
$this->view->selectedTables = $tables;
|
||||
$this->_forward('show.tables', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncate selected tables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function emptyTablesAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$tables = $this->_request->getParam('tables', array());
|
||||
$truncateResults = array();
|
||||
$this->view->action = $this->view->lang->L_TRUNCATE;
|
||||
$database = $this->view->config->get('dynamic.dbActual');
|
||||
$this->_db->selectDb($database);
|
||||
if ($this->_request->isPost() && !empty($tables)) {
|
||||
|
||||
foreach ($tables as $tableName) {
|
||||
$res = $this->_db->truncateTable($tableName);
|
||||
}
|
||||
$this->view->actionResult = $truncateResults;
|
||||
}
|
||||
$this->view->selectedTables = $tables;
|
||||
$this->_forward('show.tables', 'sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show sqlbox and handel queries
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sqlboxAction()
|
||||
{
|
||||
$this->_helper->viewRenderer('sqlbox/sqlbox');
|
||||
$sqlboxModel = new Application_Model_Sqlbox();
|
||||
$this->view->tableSelectBox = $sqlboxModel->getTableSelectBox();
|
||||
$request = $this->getRequest();
|
||||
$config = $this->view->config;
|
||||
$query = '';
|
||||
if ($lastQuery = $config->get('dynamic.sqlboxQuery')) {
|
||||
$query = $lastQuery;
|
||||
}
|
||||
if ($request->isPost()) {
|
||||
$query = $request->getParam('sqltextarea', '');
|
||||
$config->set('dynamic.sqlboxQuery', $query);
|
||||
$query = trim($query);
|
||||
if ($query > '') {
|
||||
$parser = new Msd_Sqlparser($query);
|
||||
$query = $parser->parse();
|
||||
$this->_db->selectDb($config->get('dynamic.dbActual'));
|
||||
try {
|
||||
$res = $this->_db->query($query, Msd_Db::ARRAY_ASSOC);
|
||||
$this->view->resultset = $res;
|
||||
} catch (Exception $e) {
|
||||
$this->view->errorMessage = $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_setDynamicParams();
|
||||
$this->view->boxcontent = $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload database list after deleting or adding database(s)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _refreshDbList()
|
||||
{
|
||||
$databases = $this->_db->getDatabaseNames();
|
||||
$this->view->config->set('dynamic.databases', $databases);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set actual database and table
|
||||
*
|
||||
* @param bool|string $dbActual The actually selected database
|
||||
* @param string $tableActual The actually selected table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _setDynamicParams($dbActual = false, $tableActual = '')
|
||||
{
|
||||
if ($dbActual === false) {
|
||||
$dbActual = $this->view->config->get('dynamic.dbActual');
|
||||
}
|
||||
$this->view->config->set('dynamic.dbActual', $dbActual);
|
||||
$this->view->config->set('dynamic.tableActual', $tableActual);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get get/post params and set them to dynamic config
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _getDynamicParams()
|
||||
{
|
||||
$params = $this->_request->getParams();
|
||||
if (isset($params['dbName'])) {
|
||||
$dbName = base64_decode($params['dbName']);
|
||||
$this->view->config->set('dynamic.dbActual', $dbName);
|
||||
}
|
||||
|
||||
if (isset($params['tableName'])) {
|
||||
$dbName = base64_decode($params['tableName']);
|
||||
$this->view->config->set('dynamic.tableActual', $dbName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
145
application/controllers/SqlServerController.php
Normale Datei
145
application/controllers/SqlServerController.php
Normale Datei
|
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||
* http://www.mysqldumper.net
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
* @version SVN: $Rev$
|
||||
* @author $Author$
|
||||
*/
|
||||
/**
|
||||
* Sqlserver Controller
|
||||
*
|
||||
* Controller to handle actions an SQLBrowser screen
|
||||
*
|
||||
* @package MySQLDumper
|
||||
* @subpackage Controllers
|
||||
*/
|
||||
class SqlServerController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Init
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->db = Msd_Db::getAdapter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Index action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_forward('show.variables');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show list of MySQL Variables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showVariablesAction()
|
||||
{
|
||||
$selectedGroup = $this->getRequest()->getParam('group', '');
|
||||
$variables = $this->db->getVariables();
|
||||
$groups = Msd_Html::getPrefixArray($variables);
|
||||
$this->view->groupOptions =
|
||||
Msd_Html::getHtmlOptions($groups, $selectedGroup);
|
||||
if ($selectedGroup > '') {
|
||||
foreach ($variables as $key => $val) {
|
||||
if (substr($key, 0, strlen($selectedGroup)) != $selectedGroup) {
|
||||
unset($variables[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->view->variables = $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show status values of MySQL-Server
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showStatusAction()
|
||||
{
|
||||
$selectedGroup = $this->getRequest()->getParam('group', '');
|
||||
$variables = $this->db->getGlobalStatus();
|
||||
$groups = Msd_Html::getPrefixArray($variables);
|
||||
$this->view->groupOptions =
|
||||
Msd_Html::getHtmlOptions($groups, $selectedGroup);
|
||||
if ($selectedGroup > '') {
|
||||
foreach ($variables as $key => $val) {
|
||||
if (substr($key, 0, strlen($selectedGroup)) != $selectedGroup) {
|
||||
unset($variables[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->view->variables = $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show process list
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showProcesslistAction()
|
||||
{
|
||||
$this->getProcesslistAction(false);
|
||||
$interval = $this->view->config
|
||||
->get('config.interface.refreshProcesslist');
|
||||
if ($interval < 2) {
|
||||
$interval = 2;
|
||||
}
|
||||
$this->view->interval = $interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render process list
|
||||
*
|
||||
* @param boolean $disableLayout Whether to disable the layout
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getProcesslistAction($disableLayout = true)
|
||||
{
|
||||
if ($disableLayout) {
|
||||
$this->_helper->layout()->disableLayout();
|
||||
}
|
||||
$processes = $this->db->query('SHOW PROCESSLIST', Msd_Db::ARRAY_ASSOC);
|
||||
$this->view->processes = $processes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render process list
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function killProcessAction()
|
||||
{
|
||||
$processId = $this->getRequest()->getParam('processId', 0);
|
||||
try {
|
||||
$this->db->query('KILL ' . $processId, Msd_Db::ARRAY_ASSOC);
|
||||
} catch (Msd_Exception $e) {
|
||||
//echo $e->getMessage().' '.$e->getCode();
|
||||
//TODO return message to client
|
||||
}
|
||||
$this->_forward('show.processlist');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all known character sets
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showCharsetsAction()
|
||||
{
|
||||
$this->view->collations = $this->db->getCollations();
|
||||
$this->view->charsets = $this->db->getCharsets();
|
||||
}
|
||||
}
|
||||
|
||||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren