1111
1212use OC \DB \Exceptions \DbalException ;
1313use OCA \Files_External \Service \GlobalStoragesService ;
14+ use OCA \PreviewGenerator \Exceptions \EncryptionEnabledException ;
1415use OCA \PreviewGenerator \Model \WorkerConfig ;
16+ use OCA \PreviewGenerator \Service \EncryptionService ;
1517use OCA \PreviewGenerator \Service \ModuloService ;
1618use OCA \PreviewGenerator \SizeHelper ;
1719use OCP \DB \Exception ;
18- use OCP \Encryption \IManager ;
1920use OCP \Files \File ;
2021use OCP \Files \Folder ;
2122use OCP \Files \GenericFileException ;
@@ -48,7 +49,7 @@ class Generate extends Command {
4849 protected IPreview $ previewGenerator ;
4950 protected IConfig $ config ;
5051 protected OutputInterface $ output ;
51- protected IManager $ encryptionManager ;
52+ protected EncryptionService $ encryptionService ;
5253 protected SizeHelper $ sizeHelper ;
5354
5455 private ?WorkerConfig $ workerConfig = null ;
@@ -57,7 +58,7 @@ public function __construct(IRootFolder $rootFolder,
5758 IUserManager $ userManager ,
5859 IPreview $ previewGenerator ,
5960 IConfig $ config ,
60- IManager $ encryptionManager ,
61+ EncryptionService $ encryptionService ,
6162 ContainerInterface $ container ,
6263 SizeHelper $ sizeHelper ) {
6364 parent ::__construct ();
@@ -66,7 +67,7 @@ public function __construct(IRootFolder $rootFolder,
6667 $ this ->rootFolder = $ rootFolder ;
6768 $ this ->previewGenerator = $ previewGenerator ;
6869 $ this ->config = $ config ;
69- $ this ->encryptionManager = $ encryptionManager ;
70+ $ this ->encryptionService = $ encryptionService ;
7071 $ this ->sizeHelper = $ sizeHelper ;
7172
7273 try {
@@ -98,8 +99,8 @@ protected function configure(): void {
9899 }
99100
100101 protected function execute (InputInterface $ input , OutputInterface $ output ): int {
101- if ($ this ->encryptionManager -> isEnabled ()) {
102- $ output ->writeln ('<error>Encryption is enabled. Aborted. </error> ' );
102+ if (! $ this ->encryptionService -> isCompatibleWithCurrentEncryption ()) {
103+ $ output ->writeln ('<error> ' . EncryptionEnabledException:: DEFAULT_MESSAGE . ' </error> ' );
103104 return 1 ;
104105 }
105106
0 commit comments