#1  
Old 3rd August 2011, 00:17
snowfly snowfly is offline
Member
 
Join Date: Jul 2006
Posts: 91
Thanks: 0
Thanked 4 Times in 3 Posts
Default Old website backups not deleted

I have noticed that if we change the backup options for a website in ISPConfig, the older backups are not deleted.
Running ISPConfig 3.0.3.3

This is when you change the copies of backups to keep from a larger number to a smaller number.

The effect of this is when we select a smaller number of backup copies to keep, we expect disk space usage to drop, this does not happen, as all backup copies are still kept.

Take this example:
Site: abc.de
Backup interval: daily
Backup copies: 2

In the /var/backup/webX/ folder we then get 2 backups:
web.1.zip
web.2.zip

Then we change backup copies = 1

The next day, the /var/backup/webX/ folder still has 2 backups (not 1):
web.1.zip
web.2.zip

The web.2.zip file is dated from 2 days ago.

So it appears the ispconfig cron_daily.php script does not take into account deleting older copies of backups.

Relevant code in /usr/local/ispconfig/server/cron_daily.php starts on line 430:
Code:
// Rename or remove old backups
                                $backup_copies = intval($rec['backup_copies']);

                                if(is_file($web_backup_dir.'/web.'.$backup_copies.'.zip')) unlink($web_backup_dir.'/web.'.$backup_copies.'.zip');

                                for($n = $backup_copies - 1; $n >= 1; $n--) {
                                        if(is_file($web_backup_dir.'/web.'.$n.'.zip')) {
                                                rename($web_backup_dir.'/web.'.$n.'.zip',$web_backup_dir.'/web.'.($n+1).'.zip');
                                        }
                                }
Should there also be some code that deletes any older backup copies that are greater than $backup_copies ($backup_copies +1)?
From when the user decreases the number of backup_copies to keep.

e.g. something like this maybe:
Code:
// delete any older backup copies that previously existed
// loop through $backup_copies+1 up to 10, check if file exists, then delete
for ($n = $backup_copies+1; $n <= 10; $n++) {
  if(is_file($web_backup_dir.'/web.'.$n.'.zip'))
    unlink($web_backup_dir.'/web.'.$n.'.zip');
}
Would something like the above work?

Last edited by snowfly; 3rd August 2011 at 00:20.
Reply With Quote
The Following User Says Thank You to snowfly For This Useful Post:
till (3rd August 2011)
Sponsored Links
  #2  
Old 3rd August 2011, 09:43
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,202
Thanks: 829
Thanked 5,420 Times in 4,262 Posts
Default

Your code shpould work. Thanks for the report and bugfix, I will add it to the bugtracker.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 30th August 2011, 00:35
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
 
Default

This would be "expected behaviour" for me .. i'dnot like it if a system starts messing with my backup files .. if i want to clean them, i'll do it manually, but hey, .. that's me!

At least some form of option to let the user decide if the older files should be deleted or not would be in nice. That way you can either keep running the old code, or the new code (which does delete them).
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
Ownership of website backups lucani Developers' Forum 0 17th November 2010 17:10
new website cannot be located prithwis Installation/Configuration 3 23rd October 2010 11:38
Website deleted on name change tristanlee85 General 5 28th June 2010 20:37


All times are GMT +2. The time now is 12:35.


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