Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

solracsf
Copy link
Member

Checklist

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

Cannot concatenate with a possibly false false|string
@@ -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

The method OCP\Util::emitHook has been marked as deprecated
@@ -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

Invalid reference to $this in a static context
@@ -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

Invalid reference to $this in a static context
if ($view->file_exists($target)) {
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder();
$query = $this->connection->getQueryBuilder();

Check failure

Code scanning / Psalm

InvalidScope Error

Invalid reference to $this in a static context
$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

Invalid reference to $this in a static context
@@ -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

Invalid reference to $this in a static context
$view = new View('/' . $user);
$size = 0;

if ($timestamp) {
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder();
$query = $this->connection->getQueryBuilder();

Check failure

Code scanning / Psalm

InvalidScope Error

Invalid reference to $this in a static context
@@ -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

Invalid reference to $this in a static context
@@ -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

Argument 1 of OCP\Files\IRootFolder::getUserFolder cannot be false, possibly string value expected
@solracsf solracsf closed this Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant