Commit ad5661d8 authored by Marius Burkard's avatar Marius Burkard

- drop mongodb code

parent 0868b08e
......@@ -104,3 +104,8 @@ ALTER TABLE `client`
ALTER TABLE `xmpp_domain`
ADD COLUMN `use_webpresence` enum('n','y') NOT NULL DEFAULT 'y',
ADD COLUMN `use_http_upload` enum('n','y') NOT NULL DEFAULT 'n';
-- STRIPDOWN!
ALTER TABLE `web_backup` CHANGE `backup_type` `backup_type` enum('web','mysql') NOT NULL DEFAULT 'web';
ALTER TABLE `web_database_user` DROP COLUMN `database_password_mongo`;
\ No newline at end of file
......@@ -1927,7 +1927,7 @@ CREATE TABLE `web_backup` (
`backup_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(10) unsigned NOT NULL DEFAULT '0',
`parent_domain_id` int(10) unsigned NOT NULL DEFAULT '0',
`backup_type` enum('web','mysql','mongodb') NOT NULL DEFAULT 'web',
`backup_type` enum('web','mysql') NOT NULL DEFAULT 'web',
`backup_mode` varchar(64) NOT NULL DEFAULT '',
`tstamp` int(10) unsigned NOT NULL DEFAULT '0',
`filename` varchar(255) NOT NULL DEFAULT '',
......@@ -1986,7 +1986,6 @@ CREATE TABLE IF NOT EXISTS `web_database_user` (
`database_user` varchar(64) DEFAULT NULL,
`database_user_prefix` varchar(50) NOT NULL default '',
`database_password` varchar(64) DEFAULT NULL,
`database_password_mongo` varchar(32) DEFAULT NULL,
PRIMARY KEY (`database_user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
......
......@@ -504,39 +504,6 @@ class tools_monitor {
return $html;
}
function showMongoDB() {
global $app;
/* fetch the Data from the DB */
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_mongodb' and server_id = ? ORDER BY created DESC", $_SESSION['monitor']['server_id']);
if(isset($record['data'])) {
$html =
'<div class="systemmonitor-state state-'.$record['state'].'">
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
/*
* First, we have to detect, if there is any monitoring-data.
* If not (because mongodb is not installed) show this.
*/
$data = unserialize($record['data']);
if ($data == '') {
$html .= '<p>'.
'MongoDB is not installed on this server.<br />' .
'</p>';
}
else {
$html .= nl2br($data);
}
$html .= '</div></div>';
} else {
$html = '<p>There is no data available at the moment.</p>';
}
return $html;
}
function showIPTables() {
global $app;
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'iptables_rules' and server_id = ? ORDER BY created DESC", $_SESSION['monitor']['server_id']);
......
......@@ -1858,12 +1858,6 @@ $form["tabs"]['rescue'] = array(
'default' => 'n',
'value' => array(0 => 'n', 1 => 'y')
),
'do_not_try_rescue_mongodb' => array(
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'n',
'value' => array(0 => 'n', 1 => 'y')
),
'do_not_try_rescue_mysql' => array(
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
......
......@@ -17,14 +17,6 @@
{tmpl_var name='do_not_try_rescue_httpd'}
</div>
</div>
<!--
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='do_not_try_rescue_mongodb_txt'}</label>
<div class="col-sm-9">
{tmpl_var name='do_not_try_rescue_mongodb'}
</div>
</div>
-->
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='do_not_try_rescue_mysql_txt'}</label>
<div class="col-sm-9">
......
......@@ -201,12 +201,6 @@ $items[] = array( 'title' => "Show fail2ban-Log",
'link' => 'monitor/show_data.php?type=fail2ban',
'html_id' => 'fai2ban');
/*
$items[] = array( 'title' => "Show MongoDB-Log",
'target' => 'content',
'link' => 'monitor/show_data.php?type=mongodb',
'html_id' => 'mongodb');
*/
$items[] = array( 'title' => "Show IPTables",
'target' => 'content',
'link' => 'monitor/show_data.php?type=iptables',
......
......@@ -138,15 +138,6 @@ case 'fail2ban':
$description = '';
$add_padding = true;
break;
/*
case 'mongodb':
$template = 'templates/show_data.htm';
$output .= $app->tools_monitor->showMongoDB();
$time = $app->tools_monitor->getDataTime('log_mongodb');
$title = $app->lng("monitor_title_mongodb_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
$description = '';
break;
*/
case 'iptables':
$template = 'templates/show_data.htm';
$output .= $app->tools_monitor->showIPTables();
......
......@@ -168,14 +168,6 @@ class page_action extends tform_actions {
$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
}
/* prepare password for MongoDB */
// TODO: this still doens't work as when only the username changes we have no database_password.
// taking the one from oldData doesn't work as it's encrypted...shit!
/*
$this->dataRecord['database_password_mongo'] = $this->dataRecord['database_user'].":mongo:".$this->dataRecord['database_password'];
$this->dataRecord['server_id'] = 0; // we need this on all servers
*/
parent::onBeforeUpdate();
}
......@@ -211,9 +203,6 @@ class page_action extends tform_actions {
$this->dataRecord['server_id'] = 0; // we need this on all servers
/* prepare password for MongoDB */
// $this->dataRecord['database_password_mongo'] = $this->dataRecord['database_user'].":mongo:".$this->dataRecord['database_password'];
parent::onBeforeInsert();
}
......
......@@ -90,7 +90,6 @@ $form["tabs"]['database'] = array (
'formtype' => 'SELECT',
'default' => 'mysql',
'value' => array(
/*'mongo' => 'MongoDB',*/
'mysql' => 'MySQL'
)
),
......
......@@ -115,15 +115,7 @@ $form["tabs"]['database_user'] = array (
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'database_password_mongo' => array (
'datatype' => 'VARCHAR',
'formtype' => 'PASSWORD',
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
)
//#################################
// ENDE Datatable fields
//#################################
......
......@@ -78,7 +78,6 @@ $liste["item"][] = array( 'field' => "type",
'suffix' => "",
'width' => "",
'value' => array(
'mongo' => "MongoDB",
'mysql' => "MySQL"
)
);
......
......@@ -454,16 +454,6 @@ class monitor_tools {
$state = 'error'; // because service is down
}
}
/*
$data['mongodbserver'] = -1;
if ($this->_checkTcp('localhost', 27017)) {
$data['mongodbserver'] = 1;
} else {
$data['mongodbserver'] = 0;
*/
//$state = 'error'; // because service is down
/* TODO!!! check if this is a mongodbserver at all, otherwise it will always throw an error state!!! */
// }
/*
* Return the Result
......@@ -598,9 +588,6 @@ class monitor_tools {
$logfile = '/var/log/fail2ban.log';
}
break;
case 'log_mongodb':
$logfile = '/var/log/mongodb/mongodb.log';
break;
case 'log_ispconfig':
if ($dist == 'debian') {
$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
......
......@@ -94,11 +94,6 @@ class rescue_core_module {
*/
$this->_rescueData = $this->_getRescueData();
/*
* rescue MongoDB if needed
*/
// $this->_rescueMongoDB();
/*
* rescue mysql if needed (maybe httpd depends on mysql, so try this first!)
*/
......@@ -311,73 +306,6 @@ class rescue_core_module {
$this->_rescueDaemon($daemon);
}
/**
* restarts MongoDB, if needed
*/
// private function _rescueMongoDB(){
// global $app, $conf;
/*
* do nothing, if it is not allowed to rescue mysql
*/
// if ((isset($conf['serverconfig']['rescue']['do_not_try_rescue_mongodb']) && ($conf['serverconfig']['rescue']['do_not_try_rescue_mongodb']) == 'y')){
// return;
// }
/*
* if the service is up and running, or the service is not installed there is nothing to do...
*/
// if ($this->_monitoringData[0][0]['data']['mongodbserver'] != 0){
// /* Clear the try counter, because we do not have to try to rescue the service */
// $this->_rescueData['mongodbserver']['try_counter'] = 0;
// return;
// }
/*
* OK, the service is installed and down.
* Maybe this is because of a restart of the service by the admin.
* This means, we check the data 1 minute ago
*/
// if ((!isset($this->_monitoringData[1][0]['data']['mongodbserver'])) ||
// ((isset($this->_monitoringData[1][0]['data']['mongodbserver'])) && ($this->_monitoringData[1][0]['data']['mongodbserver'] != 0))){
/*
* We do NOT have this data or we have this data, but the webserver was not down 1 minute ago.
* This means, it could be, that the admin is restarting the server.
* We wait one more minute...
*/
// return;
// }
/*#####
* The service is down and it was down 1 minute ago.
* We try to rescue it
*#####*/
/* Get the try counter */
// $tryCount = (!isset($this->_rescueData['mongodbserver']['try_counter']))? 1 : $this->_rescueData['mongodbserver']['try_counter'] + 1;
/* Set the new try counter */
// $this->_rescueData['mongodbserver']['try_counter'] = $tryCount;
/* if 5 times will not work, we have to give up... */
// if ($tryCount > 5){
// $app->log('MongoDB is down! Rescue will not help!', LOGLEVEL_ERROR);
// return;
// }
// $app->log('MongoDB is down! Try rescue MongoDB (try:' . $tryCount . ')...', LOGLEVEL_WARN);
// if(is_file($conf['init_scripts'] . '/' . 'mongodb')) {
// $daemon = 'mongodb';
// } else {
// $daemon = 'mongodb';
// }
// $this->_rescueDaemon($daemon);
// }
/**
* restarts mysql, if needed
*/
......
......@@ -93,32 +93,6 @@ class backup_plugin {
}
}
//* Restore a MongoDB backup
if($action_name == 'backup_restore' && $backup['backup_type'] == 'mongodb') {
if(file_exists($backup_dir.'/'.$backup['filename'])) {
//$parts = explode('_',$backup['filename']);
//$db_name = $parts[1];
preg_match('@^db_(.+)_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}\.tar\.gz$@', $backup['filename'], $matches);
$db_name = $matches[1];
// extract tar.gz archive
$dump_directory = str_replace(".tar.gz", "", $backup['filename']);
$extracted = "/usr/local/ispconfig/server/temp";
exec("tar -xzvf ".escapeshellarg($backup_dir.'/'.$backup['filename'])." --directory=".escapeshellarg($extracted));
$restore_directory = $extracted."/".$dump_directory."/".$db_name;
// mongorestore -h 127.0.0.1 -u root -p 123456 --authenticationDatabase admin -d c1debug --drop ./toRestore
$command = "mongorestore -h 127.0.0.1 --port 27017 -u root -p 123456 --authenticationDatabase admin -d ".$db_name." --drop ".escapeshellarg($restore_directory);
exec($command);
exec("rm -rf ".escapeshellarg($extracted."/".$dump_directory));
}
unset($clientdb_host);
unset($clientdb_user);
unset($clientdb_password);
$app->log('Restored MongoDB backup '.$backup_dir.'/'.$backup['filename'], LOGLEVEL_DEBUG);
}
//* Restore a mysql backup
if($action_name == 'backup_restore' && $backup['backup_type'] == 'mysql') {
//* Load sql dump into db
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment