Skip to content

Commit

Permalink
UCRM 6305 - Dropbox plugin - Use writeStream()
Browse files Browse the repository at this point in the history
  • Loading branch information
janprochazkacz committed Nov 29, 2024
1 parent 04a8754 commit f396c4d
Show file tree
Hide file tree
Showing 10 changed files with 240 additions and 220 deletions.
Binary file modified plugins/backup-sync-dropbox/backup-sync-dropbox.zip
Binary file not shown.
416 changes: 224 additions & 192 deletions plugins/backup-sync-dropbox/src/composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugins/backup-sync-dropbox/src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"displayName": "Backup synchronization - Dropbox",
"description": "This plugin handles synchronization of your UNMS backups to a Dropbox folder.",
"url": "https://github.com/Ubiquiti-App/UCRM-plugins/tree/master/plugins/backup-sync-dropbox",
"version": "1.2.0",
"version": "1.2.1",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
Expand Down
30 changes: 9 additions & 21 deletions plugins/backup-sync-dropbox/src/src/Facade/BackupFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,11 @@

final class BackupFacade
{
/**
* @var UnmsApi
*/
private $unmsApi;

/**
* @var Filesystem
*/
private $filesystem;

/**
* @var LoggerInterface
*/
private $logger;

public function __construct(UnmsApi $unmsApi, Filesystem $filesystem, LoggerInterface $logger)
{
$this->unmsApi = $unmsApi;
$this->filesystem = $filesystem;
$this->logger = $logger;
public function __construct(
private UnmsApi $unmsApi,
private Filesystem $filesystem,
private LoggerInterface $logger
) {
}

public function upload(UnmsBackup $unmsBackup): void
Expand All @@ -41,7 +26,10 @@ public function upload(UnmsBackup $unmsBackup): void
return;
}

$this->filesystem->write($unmsBackup->filename, $this->unmsApi->get(sprintf('nms/backups/%s', $unmsBackup->id)));
$temp = tmpfile();
fwrite($temp, $this->unmsApi->get(sprintf('nms/backups/%s', $unmsBackup->id)));

$this->filesystem->writeStream($unmsBackup->filename, $temp);

$this->logger->info(sprintf('Uploaded file "%s".', $unmsBackup->filename));
}
Expand Down
2 changes: 1 addition & 1 deletion plugins_2.1.x.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"displayName": "Backup synchronization - Dropbox",
"description": "This plugin handles synchronization of your UNMS backups to a Dropbox folder.",
"url": "https:\/\/github.com\/Ubiquiti-App\/UCRM-plugins\/tree\/master\/plugins\/backup-sync-dropbox",
"version": "1.2.0",
"version": "1.2.1",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
Expand Down
2 changes: 1 addition & 1 deletion plugins_2.2.x.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"displayName": "Backup synchronization - Dropbox",
"description": "This plugin handles synchronization of your UNMS backups to a Dropbox folder.",
"url": "https:\/\/github.com\/Ubiquiti-App\/UCRM-plugins\/tree\/master\/plugins\/backup-sync-dropbox",
"version": "1.2.0",
"version": "1.2.1",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
Expand Down
2 changes: 1 addition & 1 deletion plugins_2.3.x.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"displayName": "Backup synchronization - Dropbox",
"description": "This plugin handles synchronization of your UNMS backups to a Dropbox folder.",
"url": "https:\/\/github.com\/Ubiquiti-App\/UCRM-plugins\/tree\/master\/plugins\/backup-sync-dropbox",
"version": "1.2.0",
"version": "1.2.1",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
Expand Down
2 changes: 1 addition & 1 deletion plugins_2.4.x.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"displayName": "Backup synchronization - Dropbox",
"description": "This plugin handles synchronization of your UNMS backups to a Dropbox folder.",
"url": "https:\/\/github.com\/Ubiquiti-App\/UCRM-plugins\/tree\/master\/plugins\/backup-sync-dropbox",
"version": "1.2.0",
"version": "1.2.1",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
Expand Down
2 changes: 1 addition & 1 deletion plugins_2.5.x.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"displayName": "Backup synchronization - Dropbox",
"description": "This plugin handles synchronization of your UNMS backups to a Dropbox folder.",
"url": "https:\/\/github.com\/Ubiquiti-App\/UCRM-plugins\/tree\/master\/plugins\/backup-sync-dropbox",
"version": "1.2.0",
"version": "1.2.1",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
Expand Down
2 changes: 1 addition & 1 deletion plugins_3.0.x.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"displayName": "Backup synchronization - Dropbox",
"description": "This plugin handles synchronization of your UNMS backups to a Dropbox folder.",
"url": "https:\/\/github.com\/Ubiquiti-App\/UCRM-plugins\/tree\/master\/plugins\/backup-sync-dropbox",
"version": "1.2.0",
"version": "1.2.1",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
Expand Down

0 comments on commit f396c4d

Please sign in to comment.