aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-05-12 17:08:54 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-08-01 09:46:40 +0200
commit458c2fa2971e6595a18a289b0afeb4a79ea0e0d3 (patch)
treec0bebce50e7d6956045df53f1e51dc44b0ab6c9e /apps/files_trashbin
parent952acd4d276b3190d23e0597c5e01b1dfc4d72bc (diff)
downloadnextcloud-server-458c2fa2971e6595a18a289b0afeb4a79ea0e0d3.tar.gz
nextcloud-server-458c2fa2971e6595a18a289b0afeb4a79ea0e0d3.zip
Remove OCP\App and OCP\BackgroundJob
Both deprecated since NC 23 IAppManager is the replacement for OCP\App unfortunately it can't be dependency injected in classes used by the installed otherwise the database connection is initialised too early Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/lib/Trashbin.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index d449a136016..975e9fd2557 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -54,6 +54,7 @@ use OC\Files\View;
use OCA\Files_Trashbin\AppInfo\Application;
use OCA\Files_Trashbin\Command\Expire;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\App\IAppManager;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\NotFoundException;
@@ -395,7 +396,7 @@ class Trashbin {
* @param integer $timestamp when the file was deleted
*/
private static function retainVersions($filename, $owner, $ownerPath, $timestamp) {
- if (\OCP\App::isEnabled('files_versions') && !empty($ownerPath)) {
+ if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('files_versions') && !empty($ownerPath)) {
$user = OC_User::getUser();
$rootView = new View('/');
@@ -543,7 +544,7 @@ class Trashbin {
* @return false|null
*/
private static function restoreVersions(View $view, $file, $filename, $uniqueFilename, $location, $timestamp) {
- if (\OCP\App::isEnabled('files_versions')) {
+ if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('files_versions')) {
$user = OC_User::getUser();
$rootView = new View('/');
@@ -704,7 +705,7 @@ class Trashbin {
*/
private static function deleteVersions(View $view, $file, $filename, $timestamp, $user) {
$size = 0;
- if (\OCP\App::isEnabled('files_versions')) {
+ if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('files_versions')) {
if ($view->is_dir('files_trashbin/versions/' . $file)) {
$size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file));
$view->unlink('files_trashbin/versions/' . $file);