Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Developers' Forum

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 12th April 2013, 12:27
florian030 florian030 is offline
Senior Member
 
Join Date: Oct 2012
Posts: 230
Thanks: 8
Thanked 64 Times in 55 Posts
Default Add backup size to web backups

I made some changes to display the size of each web-backup in the interface.

The modified files are available for download here. I`ll send my patch to Till next week so it might be available in the SVN.

Add one line to interface/web/sites/lib/lang/en_web_backup_list.lng:
Code:
$wb['filesize_txt'] = 'Filesize';
Extend interface/web/sites/templates/web_backup_list.htm by two lines:
Code:
<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>

[...]

<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">
Make some changes to /usr/local/ispconfig/server/cron_daily.php (line 741):

Code:
######################################################################
// 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)];
}
And change line 806:
Code:
$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)."')";
to
Code:
$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)) . "')";
Finally in the database the table web_backup must be expanded (i.e. with phpMyAdmin).
Code:
ALTER TABLE `web_backup` ADD `filesize` VARCHAR(10) NOT NULL AFTER `filename;`
__________________
regards
Florian

blog.schaal-24.de
Reply With Quote
The Following User Says Thank You to florian030 For This Useful Post:
till (16th April 2013)
Sponsored Links
  #2  
Old 16th April 2013, 09:29
florian030 florian030 is offline
Senior Member
 
Join Date: Oct 2012
Posts: 230
Thanks: 8
Thanked 64 Times in 55 Posts
 
Default

change line 932 from:
Code:
$sql = "INSERT INTO web_backup (server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename) VALUES (" . $conf['server_id'] . ,$web_id,'mysql','sqlgz'," . time() . ",'" . $app->db->quote($db_backup_file) . " . gz')";
to

Code:
$sql = "INSERT INTO web_backup (server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename,filesize) VALUES (".$conf['server_id'].",$web_id,'mysql','sqlgz',".time().",'".$app->db->quote($db_backup_file).".gz','".formatBytes(filesize($db_backup_dir.'/'.$db_backup_file))."')";
__________________
regards
Florian

blog.schaal-24.de

Last edited by florian030; 17th April 2013 at 11:49. Reason: change line 932
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error show pages in server qb7 General 1 31st October 2011 09:09
Old website backups not deleted snowfly Installation/Configuration 2 30th August 2011 00:35
[SHELL Script] - Backup WEB & DATABASES vaio1 Tips/Tricks/Mods 0 5th September 2007 14:48
Setting up a backup mail server setup with two installations of ISPConfig zitch Tips/Tricks/Mods 7 30th December 2006 10:07
backup size too long... gilas General 2 21st July 2006 14:22


All times are GMT +2. The time now is 07:59.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.