-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(trashbin): Use OCP classes where possible #46658
Conversation
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@@ -455,7 +457,7 @@ | |||
if ($timestamp) { | |||
$location = self::getLocation($user, $filename, $timestamp); | |||
if ($location === false) { | |||
\OC::$server->get(LoggerInterface::class)->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']); | |||
Server::get(LoggerInterface::class)->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']); |
Check notice
Code scanning / Psalm
PossiblyFalseOperand Note
@@ -504,18 +506,18 @@ | |||
$view->chroot('/' . $user . '/files'); | |||
$view->touch('/' . $location . '/' . $uniqueFilename, $mtime); | |||
$view->chroot($fakeRoot); | |||
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => $targetPath, 'trashPath' => $sourcePath]); | |||
Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => $targetPath, 'trashPath' => $sourcePath]); |
Check notice
Code scanning / Psalm
DeprecatedMethod Note
@@ -96,7 +103,7 @@ | |||
* @return array<string, array<string, array{location: string, deletedBy: string}>> | |||
*/ | |||
public static function getExtraData($user) { | |||
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); | |||
$query = $this->connection->getQueryBuilder(); |
Check failure
Code scanning / Psalm
InvalidScope Error
@@ -121,7 +128,7 @@ | |||
* @return string original location | |||
*/ | |||
public static function getLocation($user, $filename, $timestamp) { | |||
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); | |||
$query = $this->connection->getQueryBuilder(); |
Check failure
Code scanning / Psalm
InvalidScope Error
if ($view->file_exists($target)) { | ||
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); | ||
$query = $this->connection->getQueryBuilder(); |
Check failure
Code scanning / Psalm
InvalidScope Error
$dispatcher->dispatchTyped($event); | ||
|
||
self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp); | ||
|
||
if ($timestamp) { | ||
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); | ||
$query = $this->connection->getQueryBuilder(); |
Check failure
Code scanning / Psalm
InvalidScope Error
@@ -607,7 +608,7 @@ | |||
// actual file deletion | |||
$trash->delete(); | |||
|
|||
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); | |||
$query = $this->connection->getQueryBuilder(); |
Check failure
Code scanning / Psalm
InvalidScope Error
$view = new View('/' . $user); | ||
$size = 0; | ||
|
||
if ($timestamp) { | ||
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); | ||
$query = $this->connection->getQueryBuilder(); |
Check failure
Code scanning / Psalm
InvalidScope Error
@@ -744,7 +747,7 @@ | |||
* @return bool result of db delete operation | |||
*/ | |||
public static function deleteUser($uid) { | |||
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); | |||
$query = $this->connection->getQueryBuilder(); |
Check failure
Code scanning / Psalm
InvalidScope Error
@@ -579,7 +577,10 @@ | |||
*/ | |||
public static function deleteAll() { | |||
$user = OC_User::getUser(); | |||
$userRoot = \OC::$server->getUserFolder($user)->getParent(); | |||
$rootFolder = Server::get(IRootFolder::class); | |||
$userFolder = $rootFolder->getUserFolder($user); |
Check notice
Code scanning / Psalm
PossiblyFalseArgument Note
Checklist