45
45
use OCP \Files \NotPermittedException ;
46
46
use Symfony \Component \Console \Input \InputArgument ;
47
47
use Symfony \Component \Console \Input \InputInterface ;
48
+ use Symfony \Component \Console \Input \InputOption ;
48
49
use Symfony \Component \Console \Output \OutputInterface ;
49
50
50
51
/**
@@ -97,7 +98,9 @@ public function __construct(
97
98
protected function configure () {
98
99
$ this ->setName ('backup:point:upload ' )
99
100
->setDescription ('Upload a local restoring point on others instances ' )
100
- ->addArgument ('point ' , InputArgument::REQUIRED , 'Id of the restoring point ' );
101
+ ->addArgument ('point ' , InputArgument::REQUIRED , 'Id of the restoring point ' )
102
+ ->addOption ('remote ' , '' , InputOption::VALUE_REQUIRED , 'address of the remote instance ' , '' )
103
+ ->addOption ('external ' , '' , InputOption::VALUE_REQUIRED , 'id of the external folder ' , '' );
101
104
}
102
105
103
106
@@ -118,6 +121,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int
118
121
$ point = $ this ->pointService ->getLocalRestoringPoint ($ input ->getArgument ('point ' ));
119
122
120
123
$ this ->outputService ->setOutput ($ output );
124
+ if ($ input ->getOption ('external ' )) {
125
+ $ this ->uploadService ->initUpload ($ point );
126
+ $ this ->uploadService ->uploadToExternalFolder ($ point , (int )$ input ->getOption ('external ' ));
127
+
128
+ return 0 ;
129
+ }
130
+
131
+ if ($ input ->getOption ('remote ' )) {
132
+ $ this ->uploadService ->initUpload ($ point );
133
+ $ this ->uploadService ->uploadToRemoteInstances ($ point , $ input ->getOption ('remote ' ));
134
+
135
+ return 0 ;
136
+ }
137
+
138
+
121
139
$ this ->uploadService ->uploadPoint ($ point );
122
140
123
141
return 0 ;
0 commit comments