Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
provision
Commits
7d07ea83
Commit
7d07ea83
authored
Oct 22, 2009
by
anarcat
Committed by
anarcat
Oct 22, 2009
Browse files
don't run gzip as a separate process
this improves performance radically on big backups
parent
b9933320
Changes
1
Hide whitespace changes
Inline
Side-by-side
platform/backup.provision.inc
View file @
7d07ea83
...
@@ -21,26 +21,25 @@ function drush_provision_drupal_provision_backup_validate($url = NULL, $backup_f
...
@@ -21,26 +21,25 @@ function drush_provision_drupal_provision_backup_validate($url = NULL, $backup_f
}
}
if
(
$backup_file
)
{
if
(
$backup_file
)
{
if
(
provision_path
(
"exists"
,
$backup_file
,
FALSE
,
if
(
provision_path
(
"exists"
,
$backup_file
,
FALSE
,
dt
(
"Backing site up to @path."
),
dt
(
"Backing site up to @path."
),
dt
(
"Back up file @path already exists."
),
dt
(
"Back up file @path already exists."
),
'PROVISION_BACKUP_ALREADY_EXISTS'
))
{
'PROVISION_BACKUP_ALREADY_EXISTS'
))
{
drush_set_option
(
'backup_file'
,
$backup_file
);
drush_set_option
(
'backup_file'
,
str_replace
(
".gz"
,
''
,
$backup_file
));
}
}
}
}
if
(
!
$backup_file
)
{
if
(
!
$backup_file
)
{
$suggested
=
drush_get_option
(
'backup_path'
)
.
"/
$url
-"
.
date
(
"Y-m-d"
,
mktime
())
.
".tar"
;
$suggested
=
drush_get_option
(
'backup_path'
)
.
"/
$url
-"
.
date
(
"Y-m-d"
,
mktime
())
.
".tar
.gz
"
;
// Use format of mysite.com-2008-01-02, if already existing, add number.
// Use format of mysite.com-2008-01-02, if already existing, add number.
while
(
is_file
(
$suggested
.
'.gz'
))
{
while
(
is_file
(
$suggested
))
{
$count
++
;
$count
++
;
$suggested
=
drush_get_option
(
'backup_path'
)
.
"/
$url
-"
.
date
(
"Y-m-d"
,
mktime
())
.
"_
$count
.tar"
;
$suggested
=
drush_get_option
(
'backup_path'
)
.
"/
$url
-"
.
date
(
"Y-m-d"
,
mktime
())
.
"_
$count
.tar
.gz
"
;
}
}
drush_set_option
(
'backup_file'
,
$suggested
);
drush_set_option
(
'backup_file'
,
str_replace
(
".gz"
,
''
,
$suggested
));
}
}
}
}
/**
/**
...
@@ -50,20 +49,9 @@ function drush_provision_drupal_provision_backup($url) {
...
@@ -50,20 +49,9 @@ function drush_provision_drupal_provision_backup($url) {
$backup_file
=
drush_get_option
(
'backup_file'
);
$backup_file
=
drush_get_option
(
'backup_file'
);
// Adds the site directory into the backup file
// Adds the site directory into the backup file
drush_log
(
dt
(
"Adding sites directory to !backup_file"
,
array
(
'!backup_file'
=>
$backup_file
)),
'backup'
);
drush_log
(
dt
(
"Adding sites directory to !backup_file"
,
array
(
'!backup_file'
=>
$backup_file
)),
'backup'
);
$result
=
provision_shell_exec
(
"tar -C %s -p -c -f %s ."
,
drush_get_option
(
'sites_path'
)
.
"/
$url
"
,
$backup_file
);
$result
=
provision_shell_exec
(
"tar -C %s -p -c
-z
-f %s ."
,
drush_get_option
(
'sites_path'
)
.
"/
$url
"
,
$backup_file
);
if
(
!
$result
&&
!
drush_get_option
(
'force'
,
false
))
{
if
(
!
$result
&&
!
drush_get_option
(
'force'
,
false
))
{
drush_set_error
(
'PROVISION_BACKUP_FAILED'
,
dt
(
"Could not back up sites directory for drupal"
));
drush_set_error
(
'PROVISION_BACKUP_FAILED'
,
dt
(
"Could not back up sites directory for drupal"
));
}
}
}
}
/**
* Generate a backup tarbal for a site.
*/
function
drush_provision_drupal_post_provision_backup
(
$url
,
$backup_file
=
NULL
)
{
$backup_file
=
drush_get_option
(
'backup_file'
);
provision_shell_exec
(
"gzip %s"
,
$backup_file
);
drush_set_option
(
'backup_file'
,
$backup_file
.
'.gz'
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment