-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New code for backups with lots of new features
- Loading branch information
Showing
75 changed files
with
3,340 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
-- add new proxy_protocol column | ||
ALTER TABLE `web_domain` | ||
ADD COLUMN `proxy_protocol` ENUM('n','y') NOT NULL DEFAULT 'n' AFTER `log_retention`; | ||
|
||
-- backup format | ||
ALTER TABLE `web_domain` ADD `backup_format_web` VARCHAR( 255 ) NOT NULL default 'default' AFTER `backup_copies`; | ||
ALTER TABLE `web_domain` ADD `backup_format_db` VARCHAR( 255 ) NOT NULL default 'gzip' AFTER `backup_format_web`; | ||
-- end of backup format | ||
|
||
-- backup encryption | ||
ALTER TABLE `web_domain` ADD `backup_encrypt` enum('n','y') NOT NULL DEFAULT 'n' AFTER `backup_format_db`; | ||
ALTER TABLE `web_domain` ADD `backup_password` VARCHAR( 255 ) NOT NULL DEFAULT '' AFTER `backup_encrypt`; | ||
ALTER TABLE `web_backup` ADD `backup_format` VARCHAR( 64 ) NOT NULL DEFAULT '' AFTER `backup_mode`; | ||
ALTER TABLE `web_backup` ADD `backup_password` VARCHAR( 255 ) NOT NULL DEFAULT '' AFTER `filesize`; | ||
-- end of backup encryption |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,34 @@ class plugin_backuplist extends plugin_base { | |
var $formdef; | ||
var $options; | ||
|
||
/** | ||
* Process request to make a backup. This request is triggered manually by the user in the ISPConfig interface. | ||
* @param string $message | ||
* @param string $error | ||
* @param string[] $wb language text | ||
* @author Ramil Valitov <[email protected]> | ||
* @uses backup_plugin::make_backup_callback() this method is called later in the plugin to run the backup | ||
*/ | ||
protected function makeBackup(&$message, &$error, $wb) | ||
{ | ||
global $app; | ||
|
||
$mode = $_GET['make_backup']; | ||
$action_type = ($mode == 'web') ? 'backup_web_files' : 'backup_database'; | ||
$domain_id = intval($this->form->id); | ||
|
||
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = ? AND action_param = ?"; | ||
$tmp = $app->db->queryOneRecord($sql, $action_type, $domain_id); | ||
if ($tmp['number'] == 0) { | ||
$server_id = $this->form->dataRecord['server_id']; | ||
$message .= $wb['backup_info_txt']; | ||
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) VALUES (?, UNIX_TIMESTAMP(), ?, ?, 'pending', '')"; | ||
$app->db->query($sql, $server_id, $action_type, $domain_id); | ||
} else { | ||
$error .= $wb['backup_pending_txt']; | ||
} | ||
} | ||
|
||
function onShow() { | ||
|
||
global $app; | ||
|
@@ -52,6 +80,10 @@ function onShow() { | |
$message = ''; | ||
$error = ''; | ||
|
||
if (isset($_GET['make_backup'])) { | ||
$this->makeBackup($message, $error, $wb); | ||
} | ||
|
||
if(isset($_GET['backup_action'])) { | ||
$backup_id = $app->functions->intval($_GET['backup_id']); | ||
|
||
|
@@ -137,7 +169,30 @@ function onShow() { | |
$rec["bgcolor"] = $bgcolor; | ||
|
||
$rec['date'] = date($app->lng('conf_format_datetime'), $rec['tstamp']); | ||
$rec['backup_type'] = $wb[('backup_type_'.$rec['backup_type'])]; | ||
$backup_format = $rec['backup_format']; | ||
if (empty($backup_format)) { | ||
//We have a backup from old version of ISPConfig | ||
switch ($rec['backup_type']) { | ||
case 'mysql': | ||
$backup_format = 'gzip'; | ||
break; | ||
case 'web': | ||
$backup_format = ($rec['backup_mode'] == 'userzip') ? 'zip' : 'tar_gzip'; | ||
break; | ||
default: | ||
$app->log('Unsupported backup type "' . $rec['backup_type'] . '" for backup id ' . $rec['backup_id'], LOGLEVEL_ERROR); | ||
break; | ||
} | ||
} | ||
$rec['backup_type'] = $wb[('backup_type_' . $rec['backup_type'])]; | ||
$backup_format = (!empty($backup_format)) ? $wb[('backup_format_' . $backup_format . '_txt')] : $wb["backup_format_unknown_txt"]; | ||
if (empty($backup_format)) | ||
$backup_format = $wb["backup_format_unknown_txt"]; | ||
|
||
$rec['backup_format'] = $backup_format; | ||
$rec['backup_encrypted'] = empty($rec['backup_password']) ? $wb["no_txt"] : $wb["yes_txt"]; | ||
$backup_manual_prefix = 'manual-'; | ||
$rec['backup_job'] = (substr($rec['filename'], 0, strlen($backup_manual_prefix)) == $backup_manual_prefix) ? $wb["backup_job_manual_txt"] : $wb["backup_job_auto_txt"]; | ||
|
||
$rec['download_available'] = true; | ||
if($rec['server_id'] != $web['server_id']) $rec['download_available'] = false; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.