Skip to content

Commit

Permalink
Report number of backup items.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Aug 16, 2017
1 parent a76ccff commit 57b6a52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions framework/Backup/lib/Horde/Backup/Writer.php
Expand Up @@ -91,6 +91,11 @@ public function backup($application, Users $users)

/**
* Saves the backups.
*
* @param integer $format The backup format, one of the Backup::FORMAT_*
* constants.
*
* @return integer Number of processed items.
*/
public function save($format = Backup::FORMAT_ZIP)
{
Expand All @@ -115,6 +120,7 @@ public function save($format = Backup::FORMAT_ZIP)
}
$packer = new Json();

$count = 0;
foreach ($backups as $name => $applications) {
$data = array();
foreach ($applications as $application => $backup) {
Expand All @@ -127,6 +133,7 @@ public function save($format = Backup::FORMAT_ZIP)
'name' => $dir . $id,
'data' => $stream
);
$count++;
}
}
}
Expand All @@ -140,5 +147,7 @@ public function save($format = Backup::FORMAT_ZIP)
);
fclose($archive);
}

return $count;
}
}
6 changes: 5 additions & 1 deletion horde/lib/Cli/Backup.php
Expand Up @@ -158,7 +158,11 @@ protected function _backup($dir, $apps, $users)
)
);
}
$writer->save();
$count = $writer->save();
$this->message(
sprintf(_("Saved %d items."), $count),
'cli.success'
);
}

/**
Expand Down

0 comments on commit 57b6a52

Please sign in to comment.