Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pull/pull
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,11 @@ provider_pull_pantheon_db ()
local last_backup
last_backup=$(_exec -T "terminus backup:list ${hostingsite}.${hostingenv} --element=db --format=list --field=date | head -n 1")
if_failed_error "Error retrieving list of backups from Pantheon for ${hostingsite} on the ${hostingenv} environment"
if [[ "last_backup" == "" ]] || [[ "${last_backup}" < "${yesterday}" ]] || [[ "$force" == "force" ]]; then
if [[ "${last_backup}" != "" ]]; then
# terminus returns a raw epoch timestamp; convert to the same "Y-m-d H:M:S" format as $yesterday so the comparison below is meaningful.
last_backup=$(_exec date --date="@${last_backup%%.*}" "+%Y-%m-%d %H:%M:%S")
fi
if [[ "${last_backup}" == "" ]] || [[ "${last_backup}" < "${yesterday}" ]] || [[ "$force" == "force" ]]; then
# If last backup does not exist or is older than 24 hours create new one.
echo -e "${acqua}Creating new backup on Pantheon for ${hostingsite} on the ${hostingenv} environment${NC}"
_exec terminus backup:create ${hostingsite}.${hostingenv} --element=db
Expand Down