44
44
use OCA \Backup \Exceptions \RestoringPointException ;
45
45
use OCA \Backup \Exceptions \RestoringPointNotFoundException ;
46
46
use OCA \Backup \Exceptions \RestoringPointPackException ;
47
+ use OCA \Backup \Model \ChunkPartHealth ;
47
48
use OCA \Backup \Model \RestoringChunk ;
48
49
use OCA \Backup \Model \RestoringData ;
49
50
use OCA \Backup \Model \RestoringPoint ;
@@ -171,7 +172,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
171
172
return 0 ;
172
173
}
173
174
174
- echo json_encode ($ point );
175
175
$ output = new ConsoleOutput ();
176
176
$ output = $ output ->section ();
177
177
@@ -195,7 +195,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
195
195
$ table = new Table ($ output );
196
196
$ table ->setHeaders (['Chunk Id ' , 'Size ' , 'Count ' , 'Part Id ' , 'Checksum ' , 'verified ' ]);
197
197
$ table ->render ();
198
- echo ' - ' ;
198
+
199
199
foreach ($ data ->getChunks () as $ chunk ) {
200
200
if ($ point ->isStatus (RestoringPoint::STATUS_PACKED )) {
201
201
$ this ->displayDetailsPacked ($ table , $ point , $ chunk );
@@ -239,15 +239,19 @@ private function displayDetailsPacked(
239
239
RestoringChunk $ chunk
240
240
): void {
241
241
$ fresh = true ;
242
+ $ health = $ point ->getHealth ();
242
243
foreach ($ chunk ->getParts () as $ part ) {
243
- try {
244
- $ checked = $ this ->packService ->getChecksum ($ point , $ chunk , $ part );
245
- } catch (ArchiveNotFoundException $ e ) {
246
- $ checked = '<error>missing chunk</error> ' ;
247
- }
248
-
249
- $ color = ($ checked === $ part ->getCurrentChecksum ()) ? 'info ' : 'error ' ;
250
- $ checked = '< ' . $ color . '> ' . $ checked . '</ ' . $ color . '> ' ;
244
+ $ partHealth = $ health ->getPart ($ chunk ->getName (), $ part ->getName ());
245
+ $ status = ChunkPartHealth::$ DEF_STATUS [$ partHealth ->getStatus ()];
246
+ //
247
+ // try {
248
+ // $checked = $this->packService->getChecksum($point, $chunk, $part);
249
+ // } catch (ArchiveNotFoundException $e) {
250
+ // $checked = '<error>missing chunk</error>';
251
+ // }
252
+
253
+ $ color = ($ partHealth ->getStatus () === ChunkPartHealth::STATUS_OK ) ? 'info ' : 'error ' ;
254
+ $ status = '< ' . $ color . '> ' . $ status . '</ ' . $ color . '> ' ;
251
255
252
256
$ table ->appendRow (
253
257
[
@@ -256,7 +260,7 @@ private function displayDetailsPacked(
256
260
($ fresh ) ? $ chunk ->getCount () : '' ,
257
261
$ part ->getName (),
258
262
$ part ->getCurrentChecksum (),
259
- $ checked
263
+ $ status
260
264
]
261
265
);
262
266
0 commit comments