diff options
Diffstat (limited to 'lib/private/FilesMetadata/Job')
-rw-r--r-- | lib/private/FilesMetadata/Job/UpdateSingleMetadata.php | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/lib/private/FilesMetadata/Job/UpdateSingleMetadata.php b/lib/private/FilesMetadata/Job/UpdateSingleMetadata.php index d18c8aa3680..5746493ddef 100644 --- a/lib/private/FilesMetadata/Job/UpdateSingleMetadata.php +++ b/lib/private/FilesMetadata/Job/UpdateSingleMetadata.php @@ -2,25 +2,8 @@ declare(strict_types=1); /** - * @copyright 2023 Maxence Lange <maxence@artificial-owl.com> - * - * @author Maxence Lange <maxence@artificial-owl.com> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OC\FilesMetadata\Job; @@ -46,7 +29,7 @@ class UpdateSingleMetadata extends QueuedJob { ITimeFactory $time, private IRootFolder $rootFolder, private FilesMetadataManager $filesMetadataManager, - private LoggerInterface $logger + private LoggerInterface $logger, ) { parent::__construct($time); } @@ -55,10 +38,9 @@ class UpdateSingleMetadata extends QueuedJob { [$userId, $fileId] = $argument; try { - $node = $this->rootFolder->getUserFolder($userId)->getById($fileId); - if (count($node) > 0) { - $file = array_shift($node); - $this->filesMetadataManager->refreshMetadata($file, IFilesMetadataManager::PROCESS_BACKGROUND); + $node = $this->rootFolder->getUserFolder($userId)->getFirstNodeById($fileId); + if ($node) { + $this->filesMetadataManager->refreshMetadata($node, IFilesMetadataManager::PROCESS_BACKGROUND); } } catch (\Exception $e) { $this->logger->warning('issue while running UpdateSingleMetadata', ['exception' => $e, 'userId' => $userId, 'fileId' => $fileId]); |