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

Move from OC_User to UserSession #41964

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions apps/files_versions/lib/Listener/FileEventsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,23 @@
*
*/
public function pre_renameOrCopy_hook(Node $source, Node $target): void {
$user = $this->userSession->getUser()?->getUID();
if (!user) {

Check failure on line 327 in apps/files_versions/lib/Listener/FileEventsListener.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

UndefinedConstant

apps/files_versions/lib/Listener/FileEventsListener.php:327:8: UndefinedConstant: Const user is not defined (see https://psalm.dev/020)

Check failure

Code scanning / Psalm

UndefinedConstant Error

Const user is not defined
return;
}
// if we rename a movable mount point, then the versions don't have
// to be renamed
$oldPath = $this->getPathForNode($source);
$newPath = $this->getPathForNode($target);
$absOldPath = Filesystem::normalizePath('/' . \OC_User::getUser() . '/files' . $oldPath);
$absOldPath = Filesystem::normalizePath('/' . $user . '/files' . $oldPath);

Check notice

Code scanning / Psalm

PossiblyNullOperand Note

Cannot concatenate with a possibly null null|string

Check notice

Code scanning / Psalm

PossiblyNullOperand Note

Cannot concatenate with a possibly null null|string
$manager = Filesystem::getMountManager();
$mount = $manager->find($absOldPath);
$internalPath = $mount->getInternalPath($absOldPath);
if ($internalPath === '' and $mount instanceof MoveableMount) {
if ($internalPath === '' && $mount instanceof MoveableMount) {
return;
}

$view = new View(\OC_User::getUser() . '/files');
$view = new View($user . '/files');

Check notice

Code scanning / Psalm

PossiblyNullOperand Note

Cannot concatenate with a possibly null null|string
if ($view->file_exists($newPath)) {
Storage::store($newPath);
} else {
Expand Down
Loading