Fix shared folder upload
parent
d50f494f72
commit
83e6247716
|
@ -109,10 +109,10 @@ class Index extends Command {
|
|||
\OC_Util::setupFS($user->getUID());
|
||||
|
||||
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
|
||||
$this->parseFolder($user, $userFolder);
|
||||
$this->parseFolder($userFolder);
|
||||
}
|
||||
|
||||
private function parseFolder(IUser $user, Folder $folder): void {
|
||||
private function parseFolder(Folder $folder): void {
|
||||
try {
|
||||
$folderPath = $folder->getPath();
|
||||
|
||||
|
@ -129,9 +129,9 @@ class Index extends Command {
|
|||
|
||||
foreach ($nodes as $node) {
|
||||
if ($node instanceof Folder) {
|
||||
$this->parseFolder($user, $node);
|
||||
$this->parseFolder($node);
|
||||
} elseif ($node instanceof File) {
|
||||
$this->parseFile($user, $node);
|
||||
$this->parseFile($node);
|
||||
}
|
||||
}
|
||||
} catch (StorageNotAvailableException $e) {
|
||||
|
@ -142,8 +142,8 @@ class Index extends Command {
|
|||
}
|
||||
}
|
||||
|
||||
private function parseFile(IUser $user, File $file): void {
|
||||
private function parseFile(File $file): void {
|
||||
// $this->output->writeln('Generating entry for ' . $file->getPath() . ' ' . $file->getId());
|
||||
$this->util->processFile($user->getUID(), $file);
|
||||
$this->util->processFile($file);
|
||||
}
|
||||
}
|
|
@ -42,7 +42,7 @@ class Util {
|
|||
return $dateTaken;
|
||||
}
|
||||
|
||||
public function processFile(string $user, File $file): void {
|
||||
public function processFile(File $file): void {
|
||||
$mime = $file->getMimeType();
|
||||
$is_image = in_array($mime, Application::IMAGE_MIMES);
|
||||
$is_video = in_array($mime, Application::VIDEO_MIMES);
|
||||
|
@ -51,6 +51,7 @@ class Util {
|
|||
}
|
||||
|
||||
// Get parameters
|
||||
$user = $file->getOwner()->getUID();
|
||||
$fileId = $file->getId();
|
||||
$dateTaken = $this->getDateTaken($file);
|
||||
$dayId = floor($dateTaken / 86400);
|
||||
|
|
|
@ -47,13 +47,10 @@ class PostWriteListener implements IEventListener {
|
|||
}
|
||||
|
||||
$node = $event->getNode();
|
||||
$absPath = ltrim($node->getPath(), '/');
|
||||
$owner = explode('/', $absPath)[0];
|
||||
|
||||
if ($node instanceof Folder || !$this->userManager->userExists($owner)) {
|
||||
if ($node instanceof Folder) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->util->processFile($owner, $node);
|
||||
$this->util->processFile($node);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue