|
54 | 54 | use OCA\Files_Trashbin\AppInfo\Application; |
55 | 55 | use OCA\Files_Trashbin\Command\Expire; |
56 | 56 | use OCP\AppFramework\Utility\ITimeFactory; |
| 57 | +use OCP\App\IAppManager; |
57 | 58 | use OCP\Files\File; |
58 | 59 | use OCP\Files\Folder; |
59 | 60 | use OCP\Files\NotFoundException; |
@@ -389,7 +390,7 @@ public static function move2trash($file_path, $ownerOnly = false) { |
389 | 390 | * @param integer $timestamp when the file was deleted |
390 | 391 | */ |
391 | 392 | private static function retainVersions($filename, $owner, $ownerPath, $timestamp) { |
392 | | - if (\OCP\App::isEnabled('files_versions') && !empty($ownerPath)) { |
| 393 | + if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('files_versions') && !empty($ownerPath)) { |
393 | 394 | $user = OC_User::getUser(); |
394 | 395 | $rootView = new View('/'); |
395 | 396 |
|
@@ -537,7 +538,7 @@ public static function restore($file, $filename, $timestamp) { |
537 | 538 | * @return false|null |
538 | 539 | */ |
539 | 540 | private static function restoreVersions(View $view, $file, $filename, $uniqueFilename, $location, $timestamp) { |
540 | | - if (\OCP\App::isEnabled('files_versions')) { |
| 541 | + if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('files_versions')) { |
541 | 542 | $user = OC_User::getUser(); |
542 | 543 | $rootView = new View('/'); |
543 | 544 |
|
@@ -698,7 +699,7 @@ public static function delete($filename, $user, $timestamp = null) { |
698 | 699 | */ |
699 | 700 | private static function deleteVersions(View $view, $file, $filename, $timestamp, $user) { |
700 | 701 | $size = 0; |
701 | | - if (\OCP\App::isEnabled('files_versions')) { |
| 702 | + if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('files_versions')) { |
702 | 703 | if ($view->is_dir('files_trashbin/versions/' . $file)) { |
703 | 704 | $size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file)); |
704 | 705 | $view->unlink('files_trashbin/versions/' . $file); |
|
0 commit comments