* Setup: skip files backup on update even if configured

It might takes the server down for hours and updates usually dont affect the files
This commit is contained in:
Ralf Becker 2021-05-27 08:49:20 +02:00
parent c4bcae0598
commit 3248e82d65
2 changed files with 5 additions and 4 deletions

View File

@ -858,9 +858,10 @@ class Backup
* @param resource $f file opened with fopen for writing
* @param boolean $lock_table =null true: allways, false: never, null: if no primary key
* default of null limits memory usage if there is no primary key, by locking table and use ROW_CHUCK
* @param bool $skip_files_backup =false true: do not backup files, even if config / $this->backup_files is set (used by upgrade)
* @todo use https://github.com/maennchen/ZipStream-PHP to not assemble all files in memmory
*/
function backup($f, $lock_table=null)
function backup($f, $lock_table=null, bool $skip_files_backup=false)
{
//echo "function backup($f)<br>"; // !
@set_time_limit(0);
@ -876,7 +877,7 @@ class Backup
$name = $this->backup_dir.'/db_backup-'.date('YmdHi');
$filename = $name.'.zip';
$zippresent = false;
if(class_exists('ZipArchive') && $this->backup_files)
if(class_exists('ZipArchive') && $this->backup_files && !$skip_files_backup)
{
$zip = new ZipArchive;
if(is_object($zip))
@ -952,7 +953,7 @@ class Backup
if(!$zippresent) // save without files
{
if ($this->backup_files)
if ($this->backup_files && !$skip_files_backup)
{
echo '<center>'.lang("Cant open %1, needs ZipArchive", $name)."<br>\n".'</center>';
}

View File

@ -257,7 +257,7 @@ function do_backup($arg,$quite_check=false)
if (is_resource($f = $db_backup->fopen_backup($backup)))
{
echo lang('Backup started, this might take a few minutes ...')."\n";
$db_backup->backup($f);
$db_backup->backup($f, null, true); // true: skip (configured) files backup
echo lang('Backup finished')."\n";
}
else // backup failed ==> dont start the upgrade