Skip to content

Commit

Permalink
Issue #6: Make timezone configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Anderson authored Sep 18, 2020
1 parent f8ccd1f commit 558323c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions config.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ BACKDROP_ROOT = /var/www/html
BACKUP_DESTINATION = /home/user/me/backups
; Number of backups you would like to keep before starting to roll off.
NUM_KEEP = 3
; Timezone to use for dates in filenames. See https://www.php.net/manual/en/timezones.php
TIMEZONE = UTC
3 changes: 2 additions & 1 deletion files-backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
$backdrop_root = $config['BACKDROP_ROOT'];
$destination = $config['BACKUP_DESTINATION'];
$num_keep = $config['NUM_KEEP'];
$timezone = $config['TIMEZONE'];

// Check which options were passed in on the command line.
if (in_array('--rollover_files', $argv) || in_array('-rf', $argv)) {
Expand All @@ -31,7 +32,7 @@
}

// Get timestamp.
date_default_timezone_set('EST');
date_default_timezone_set($timezone);
$date = date('F-j-Y-Gis');

// Make backup.
Expand Down
3 changes: 2 additions & 1 deletion sql-dump-sanitize.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
$backdrop_root = $config['BACKDROP_ROOT'];
$backup_destination = $config['BACKUP_DESTINATION'];
$num_keep = $config['NUM_KEEP'];
$timezone = $config['TIMEZONE'];

// Get some *.inc files we need.
require_once "$backdrop_root/core/includes/bootstrap.inc";
Expand Down Expand Up @@ -63,7 +64,7 @@
}

// Dump DB to file.
date_default_timezone_set('EST');
date_default_timezone_set($timezone);
$date = date('F-j-Y-Gis');
$file_name = $sanitize ? "$db_name-$date-sanatized" : "$db_name-$date";
exec("mkdir -p $backup_destination");
Expand Down

0 comments on commit 558323c

Please sign in to comment.