Skip to content

Commit 19dd59e

Browse files
committed
removed $Filesystem proprerty. Commands use static Filesystem::instance()
1 parent 9627c42 commit 19dd59e

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

src/Command/DeleteAllCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Cake\Console\ConsoleOptionParser;
2121
use DatabaseBackup\Console\Command;
2222
use DatabaseBackup\Utility\BackupManager;
23+
use Tools\Filesystem;
2324

2425
/**
2526
* Deletes all backup files
@@ -56,7 +57,7 @@ public function execute(Arguments $args, ConsoleIo $io): void
5657
}
5758

5859
foreach ($files as $file) {
59-
$io->verbose(__d('database_backup', 'Backup `{0}` has been deleted', $this->Filesystem->rtr($file)));
60+
$io->verbose(__d('database_backup', 'Backup `{0}` has been deleted', Filesystem::instance()->rtr($file)));
6061
}
6162

6263
$io->success(__d('database_backup', 'Deleted backup files: {0}', count($files)));

src/Command/ExportCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use DatabaseBackup\Console\Command;
2424
use DatabaseBackup\Utility\BackupExport;
2525
use Exception;
26+
use Tools\Filesystem;
2627

2728
/**
2829
* Exports a database backup
@@ -94,7 +95,7 @@ public function execute(Arguments $args, ConsoleIo $io): void
9495

9596
//Exports
9697
$file = $instance->export();
97-
$io->success(__d('database_backup', 'Backup `{0}` has been exported', $this->Filesystem->rtr($file)));
98+
$io->success(__d('database_backup', 'Backup `{0}` has been exported', Filesystem::instance()->rtr($file)));
9899
$verbose = $args->getOption('verbose');
99100
$quiet = $args->getOption('quiet');
100101

src/Command/ImportCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use DatabaseBackup\Console\Command;
2222
use DatabaseBackup\Utility\BackupImport;
2323
use Exception;
24+
use Tools\Filesystem;
2425

2526
/**
2627
* Imports a database backup
@@ -57,7 +58,7 @@ public function execute(Arguments $args, ConsoleIo $io): void
5758

5859
try {
5960
$file = (new BackupImport())->filename($args->getArgument('filename'))->import();
60-
$io->success(__d('database_backup', 'Backup `{0}` has been imported', $this->Filesystem->rtr($file)));
61+
$io->success(__d('database_backup', 'Backup `{0}` has been imported', Filesystem::instance()->rtr($file)));
6162
} catch (Exception $e) {
6263
$io->error($e->getMessage());
6364
$this->abort();

src/Command/SendCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use DatabaseBackup\Console\Command;
2222
use DatabaseBackup\Utility\BackupManager;
2323
use Exception;
24+
use Tools\Filesystem;
2425

2526
/**
2627
* Sends a backup file via email
@@ -62,7 +63,7 @@ public function execute(Arguments $args, ConsoleIo $io): void
6263

6364
try {
6465
(new BackupManager())->send($args->getArgument('filename'), $args->getArgument('recipient'));
65-
$io->success(__d('database_backup', 'Backup `{0}` was sent via mail', $this->Filesystem->rtr($args->getArgument('filename'))));
66+
$io->success(__d('database_backup', 'Backup `{0}` was sent via mail', Filesystem::instance()->rtr($args->getArgument('filename'))));
6667
} catch (Exception $e) {
6768
$io->error($e->getMessage());
6869
$this->abort();

src/Console/Command.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Cake\Console\BaseCommand;
2020
use Cake\Console\ConsoleIo;
2121
use DatabaseBackup\BackupTrait;
22-
use Tools\Filesystem;
2322

2423
/**
2524
* Base class for console commands
@@ -28,19 +27,6 @@ class Command extends BaseCommand
2827
{
2928
use BackupTrait;
3029

31-
/**
32-
* @var \Tools\Filesystem
33-
*/
34-
protected $Filesystem;
35-
36-
/**
37-
* Construct
38-
*/
39-
public function __construct()
40-
{
41-
$this->Filesystem = $this->Filesystem ?: new Filesystem();
42-
}
43-
4430
/**
4531
* Implement this method with your command's logic
4632
* @param \Cake\Console\Arguments $args The command arguments

0 commit comments

Comments
 (0)