Skip to content

Commit 717b615

Browse files
committed
Suggest to regenerate thunmbnails after restoring
close #207
1 parent 699bed3 commit 717b615

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/CLI/Commands/ResetCommand.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ public function __invoke($args, $assocArgs): void
3535
$logger->info(' * find all optimized attachments');
3636
$logger->info(' * restore the original full sized images');
3737
$logger->info(' * drop all meta flags (mark as non-optimized)');
38-
$logger->warning('You have to regenerate the all thumbnails afterwards');
39-
$logger->warning('by running the following command:');
40-
$logger->warning('$ wp media regenerate');
4138

4239
WP_CLI::confirm('Are you sure you want to reset all attachment optimization?', $assocArgs);
4340

@@ -53,9 +50,15 @@ public function __invoke($args, $assocArgs): void
5350
$logger
5451
);
5552
$restoreOperation->execute(...$ids);
53+
$logger->notice('Original full sized images restored.');
5654

5755
$logger->section("Dropping all optimized attachments' meta flags");
5856
$repo->markAllAsUnoptimized();
59-
$logger->notice('All meta flags dropped.');
57+
$logger->notice('Meta flags dropped.');
58+
59+
$logger->section('Actions Required!');
60+
$logger->warning('You should regenerate the all thumbnails now');
61+
$logger->warning('by running the following command -');
62+
$logger->warning(' $ wp media regenerate');
6063
}
6164
}

src/CLI/Commands/RestoreCommand.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,18 @@ public function __invoke($args, $assocArgs): void
4343

4444
$logger = LoggerFactory::create();
4545

46-
$logger->warning('You have to regenerate the thumbnails afterwards');
47-
$logger->warning('by running the following command:');
48-
$logger->warning('$ wp media regenerate ' . implode(' ', $ids));
4946
WP_CLI::confirm('Are you sure you want to restore the original full sized images?', $assocArgs);
5047

5148
$repo = new AttachmentRepository();
5249
$filesystem = new Filesystem();
5350

5451
$restoreOperation = RestoreFactory::create($repo, $filesystem, $logger);
5552
$restoreOperation->execute(...$ids);
53+
$logger->notice('Original full sized images restored.');
54+
55+
$logger->section('Actions Required!');
56+
$logger->warning('You should regenerate the all thumbnails now');
57+
$logger->warning('by running the following command -');
58+
$logger->warning(' $ wp media regenerate ' . implode(' ', $ids));
5659
}
5760
}

0 commit comments

Comments
 (0)