Changeset 1010

Show
Ignore:
Timestamp:
02/19/08 22:02:33 (10 months ago)
Author:
joximu
Message:

Fixed #1057 + #1058

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CHANGELOG

    r1009 r1010  
    11ispCP ω 1.0.0 Changelog 
    22~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     3 
     42008-02-19 Christian Hernmarck 
     5        - ENGINE: 
     6                * Fixed #1057: more than one backup of db table ispcp 
     7                * Fixed #1058: Validation of "mail setup" make blank page 
    38 
    492008-02-18 Benedikt Heintel 
  • trunk/engine/backup/ispcp-backup-ispcp

    r960 r1010  
    220220        my $date = get_human_date(); 
    221221 
     222        # Backup of configuration files (/etc/ispcp), preparation 
    222223        my $backup_dir = $main::cfg{'BACKUP_FILE_DIR'}; 
    223224 
     
    238239        } 
    239240 
    240  
    241241        if(! -d $backup_dir) { 
    242242                $rs = make_dir($backup_dir, 0, 0, 0750); 
     
    245245        } 
    246246 
    247  
    248        my $dbuser = $main::db_user; 
    249        my $dbpass = $main::db_pwd; 
     247        # DB backup 
     248        my $dbuser = $main::db_user; 
     249        my $dbpass = $main::db_pwd; 
    250250        my $db_name = $main::cfg{'DATABASE_NAME'}; 
    251251 
    252         if ($dbuser && $dbpass) { 
    253                 my $db_backup_file = "$backup_dir/$db_name.sql"; 
    254  
    255                 my $db_backupcmd = "$main::cfg{'CMD_MYSQLDUMP'} --add-drop-table --allow-keywords --quote-names -u\'$dbuser\' -p\'$dbpass\' \'$db_name\' >\'$db_backup_file\'"; 
    256  
    257                 my ($db_filename, $db_compresscmd) = (undef, undef); 
    258  
    259                 if ($zip eq "bzip2") { 
    260                         $db_filename = "$db_backup_file.bz2"; 
    261                         $db_compresscmd = "$main::cfg{'CMD_BZIP'} --force \'$db_backup_file\'"; 
    262                 } 
    263                 elsif ($zip eq "gzip") { 
    264                         $db_filename = "$db_backup_file.gz"; 
    265                         $db_compresscmd = "$main::cfg{'CMD_GZIP'} --force \'$db_backup_file\'"; 
    266                 } 
    267                 else { 
    268                         push_el(\@main::el, 'backup_all_engine()', "Backup algorithm not supported: $zip"); 
    269  
    270                         return 1; 
    271                 } 
    272  
    273                 $rs = sys_command($db_backupcmd); 
    274  
    275                 if ($rs == 0) { 
    276                         $rs = setfmode("$db_backup_file", 0, 0, 0640); 
    277  
    278                         if ($rs != 0) { 
    279                                 unlink($db_backup_file); 
    280                         } else { 
    281                                 $rs = sys_command($db_compresscmd); 
    282                                 return $rs if ($rs != 0); 
    283                         } 
    284                         return $rs if ($rs != 0); 
    285                 } else { 
    286                         push_el(\@main::el, 'backup_ispcp_engine()', "ERROR: Failed to backup database $db_name"); 
    287                         unlink($db_backup_file); 
    288                 } 
    289         } 
    290  
    291         $rs = sys_command($backup_cmd); 
    292  
    293         # do not return if backup throws an error, otherwise other domains will not be backuped 
    294         if ($rs == 0) { 
    295  
    296                 $rs = sys_command("$cmd_rm -rf $main::cfg{'LOG_DIR'}/$backup_filename.log"); 
    297  
    298                 return $rs if ($rs != 0); 
    299         } elsif ( -e "$backup_dir/$backup_filename" ) { 
    300  
    301                 $rs = del_file("$backup_dir/$backup_filename"); 
    302                 return $rs if ($rs != 0); 
    303  
    304         } 
    305  
     252        if ($dbuser && $dbpass) { 
     253 
     254                my $db_backup_file = "$backup_dir/$db_name-$date.sql"; 
     255 
     256                my $db_backupcmd = "$main::cfg{'CMD_MYSQLDUMP'} --add-drop-table --allow-keywords --quote-names -u\'$dbuser\' -p\'$dbpass\' \'$db_name\' >\'$db_backup_file\'"; 
     257 
     258                my ($db_filename, $db_compresscmd) = (undef, undef); 
     259 
     260                if ($zip eq "bzip2") { 
     261 
     262                        $db_filename = "$db_backup_file.bz2"; 
     263                        $db_compresscmd = "$main::cfg{'CMD_BZIP'} --force \'$db_backup_file\'"; 
     264 
     265                } elsif ($zip eq "gzip") { 
     266 
     267                        $db_filename = "$db_backup_file.gz"; 
     268                        $db_compresscmd = "$main::cfg{'CMD_GZIP'} --force \'$db_backup_file\'"; 
     269 
     270                } else { 
     271 
     272                        push_el(\@main::el, 'backup_all_engine()', "Backup algorithm not supported: $zip"); 
     273                        return 1; 
     274 
     275                } 
     276 
     277                $rs = sys_command($db_backupcmd); 
     278 
     279                if ($rs == 0) { 
     280 
     281                        $rs = setfmode("$db_backup_file", 0, 0, 0640); 
     282                        if ($rs != 0) { 
     283                                unlink($db_backup_file); 
     284                        } else { 
     285                                $rs = sys_command($db_compresscmd); 
     286                                return $rs if ($rs != 0); 
     287                        } 
     288                        return $rs if ($rs != 0); 
     289 
     290                } else { 
     291 
     292                        push_el(\@main::el, 'backup_ispcp_engine()', "ERROR: Failed to backup database $db_name"); 
     293                        unlink($db_backup_file); 
     294 
     295                } 
     296        } 
     297 
     298        # do the config backup 
     299        $rs = sys_command($backup_cmd); 
     300 
     301        # do not return if backup throws an error, otherwise other domains will not be backuped 
     302        if ($rs == 0) { 
     303 
     304                $rs = sys_command("$cmd_rm -rf $main::cfg{'LOG_DIR'}/$backup_filename.log"); 
     305                return $rs if ($rs != 0); 
     306 
     307        } elsif ( -e "$backup_dir/$backup_filename" ) { 
     308 
     309                $rs = del_file("$backup_dir/$backup_filename"); 
     310                return $rs if ($rs != 0); 
     311 
     312        } 
     313 
     314        # remove old backups: >14 days old 
    306315        sys_command("find $backup_dir/* -maxdepth 0 -type f -mtime +14 -print | xargs -r /bin/rm"); 
    307316 
  • trunk/gui/admin/email_setup.php

    r823 r1010  
    4949        if(!empty($message)) { 
    5050                set_page_message($message); 
    51                 return false; 
    5251        } 
    5352        else { 
    5453                set_welcome_email($user_id, $data); 
    5554                set_page_message(tr('Auto email template data updated!')); 
    56                 return true; 
    5755        } 
    5856}