Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:bushbaby/BsbFlysystemMysqlBackup
Browse files Browse the repository at this point in the history
# Conflicts:
#	composer.json
  • Loading branch information
basz committed Mar 5, 2017
2 parents 4b9c779 + 725aeb9 commit 9ff462f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ return [
/*
* Container service name of the Flysystem filesystem used to persisted dumps
*
* @since 0.2.0 this may also be the name of a filesystem as it has been registered to the BsbFlysystem Manager
*/
// 'filesystem' => 'Container/Name/Of/FilesystemService',
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
"zendframework/zend-stdlib": "^2.7 || ^3.0",
"zendframework/zend-stratigility": "^1.0"
},
"suggest": {
"bushbaby/doctrine-managerregistry-servicemanager": ""
"suggest": {
"bushbaby/flysystem": "Zend Framework 2 module bridge for flysystem filesystem",
"bushbaby/doctrine-managerregistry-servicemanager": "An implementation of Doctrine's ManagerRegistry for the ZendFramework ServiceManager"
},
"require-dev": {
"plhw/hf-cs-fixer-config": "^1.0"
Expand Down
7 changes: 6 additions & 1 deletion src/Container/MysqlBackupServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace BsbFlysystemMysqlBackup\Container;

use BsbFlysystem\Service\FilesystemManager;
use BsbFlysystemMysqlBackup\Option\MysqlDumperOptions;
use BsbFlysystemMysqlBackup\Option\StorageOptions;
use BsbFlysystemMysqlBackup\Service\MysqlBackupService;
Expand All @@ -26,7 +27,11 @@ public function __invoke(ContainerInterface $container): MysqlBackupService
$dumperOptions = $container->get(MysqlDumperOptions::class);

/** @var Filesystem $filesystem */
$filesystem = $container->get($storageOptions->getFilesystem());
if ($container->has(FilesystemManager::class)) {
$filesystem = $container->get(FilesystemManager::class)->get($storageOptions->getFilesystem());
} else {
$filesystem = $container->get($storageOptions->getFilesystem());
}

return new MysqlBackupService($dumper, $filesystem, $storageOptions, $dumperOptions);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Service/MysqlBackupService.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(
public function doBackup()
{
$date = date('YmdHisO');
$dumpName = $this->options->getPath() . $date . '.sql';
$dumpName = trim($this->options->getPath() . $date . '.sql', '/');

switch ($this->dumperOptions->getCompress()) {
case Mysqldump::GZIP:
Expand All @@ -68,7 +68,7 @@ public function doBackup()
break;
}

$tmpFile = tempnam(sys_get_temp_dir(), 'bsb-offsite-mysql-backup-');
$tmpFile = tempnam(sys_get_temp_dir(), 'bsb-flysystem-mysql-backup-');
$fileStream = fopen($tmpFile, 'rb');

try {
Expand Down

0 comments on commit 9ff462f

Please sign in to comment.