tbrehm
2013-04-19 209f8ae15c1b2fb02f38d6ed5f9df3b13292d1d9
Add web backup size in backup list.
5 files modified
13 ■■■■■ changed files
install/sql/incremental/upd_0049.sql 1 ●●●● patch | view | raw | blame | history
install/sql/ispconfig3.sql 1 ●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_web_backup_list.lng 1 ●●●● patch | view | raw | blame | history
interface/web/sites/templates/web_backup_list.htm 2 ●●●●● patch | view | raw | blame | history
server/cron_daily.php 8 ●●●● patch | view | raw | blame | history
install/sql/incremental/upd_0049.sql
@@ -1 +1,2 @@
ALTER TABLE `client_template` CHANGE `limit_aps` `limit_aps` INT( 11 ) NOT NULL DEFAULT '-1';
ALTER TABLE `web_backup` ADD `filesize` VARCHAR(10) NOT NULL AFTER `filename`;
install/sql/ispconfig3.sql
@@ -1631,6 +1631,7 @@
  `backup_mode` varchar(64) NOT NULL DEFAULT  '',
  `tstamp` int(10) unsigned NOT NULL,
  `filename` varchar(255) NOT NULL,
  `filesize` VARCHAR(10) NOT NULL,
  PRIMARY KEY (`backup_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
interface/web/sites/lib/lang/en_web_backup_list.lng
@@ -3,6 +3,7 @@
$wb['date_txt'] = 'Date';
$wb['backup_type_txt'] = 'Type';
$wb['filename_txt'] = 'Backup file';
$wb['filesize_txt'] = 'Filesize';
$wb['restore_backup_txt'] = 'Restore';
$wb['download_backup_txt'] = 'Download';
$wb['download_info_txt'] = 'The backup file will be available for download in the backup folder of the website in a few minutes.';
interface/web/sites/templates/web_backup_list.htm
@@ -16,6 +16,7 @@
                        <th class="tbl_col_date" scope="col"><tmpl_var name="date_txt"></th>
                        <th class="tbl_col_date" scope="col"><tmpl_var name="backup_type_txt"></th>
                        <th class="tbl_col_filename" scope="col"><tmpl_var name="filename_txt"></th>
                        <th class="tbl_col_filename" scope="col"><tmpl_var name="filesize_txt"></th>
                        <th class="tbl_col_limit" scope="col">{tmpl_var name='search_limit'}</th>
                    </tr>
                </thead>
@@ -25,6 +26,7 @@
                            <td class="tbl_col_date">{tmpl_var name="date"}</td>
                            <td class="tbl_col_date">{tmpl_var name="backup_type"}</td>
                            <td class="tbl_col_filename">{tmpl_var name="filename"}</td>
                            <td class="tbl_col_filesize">{tmpl_var name="filesize"}</td>
                            <td class="tbl_col_buttons">
                                <div class="buttons">
                                    <button class="button iconstxt icoRestore" type="button" onclick="confirm_action('sites/web_domain_edit.php?id={tmpl_var name='parent_id'}&next_tab=backup&backup_action=restore&backup_id={tmpl_var name='backup_id'}','{tmpl_var name='restore_confirm_txt'}');"><span>{tmpl_var name="restore_backup_txt"}</span></button>
server/cron_daily.php
@@ -769,6 +769,11 @@
#######################################################################################################
// Create website backups
#######################################################################################################
function formatBytes($size, $precision = 2) {
    $base=log($size)/log(1024);
    $suffixes=array('','k','M','G','T');
        return round(pow(1024,$base-floor($base)),$precision).$suffixes[floor($base)];
}
$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
$backup_dir = $server_config['backup_dir'];
@@ -831,7 +836,8 @@
                //* Insert web backup record in database
                //$insert_data = "(server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename) VALUES (".$conf['server_id'].",".$web_id.",'web','".$backup_mode."',".time().",'".$app->db->quote($web_backup_file)."')";
                //$app->dbmaster->datalogInsert('web_backup', $insert_data, 'backup_id');
                $sql = "INSERT INTO web_backup (server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename) VALUES (".$conf['server_id'].",".$web_id.",'web','".$backup_mode."',".time().",'".$app->db->quote($web_backup_file)."')";
                $sql = "INSERT INTO web_backup (server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename,filesize) VALUES (".$conf['server_id'].",".$web_id.",'web','".$backup_mode."',".time().",'".$app->db->quote($web_backup_file)."','".formatBytes(filesize($web_backup_dir.'/'.$web_backup_file))."')";
                $app->db->query($sql);
                if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);