}
foreach ($toDelete as $key => $path) {
+ // Make sure to cleanup version table relations as expire does not pass deleteVersion
+ try {
+ /** @var VersionsMapper $versionsMapper */
+ $versionsMapper = \OC::$server->get(VersionsMapper::class);
+ $file = \OC::$server->get(IRootFolder::class)->getUserFolder($uid)->get($filename);
+ $pathparts = pathinfo($path);
+ $timestamp = (int)substr($pathparts['extension'] ?? '', 1);
+ $versionEntity = $versionsMapper->findVersionForFileId($file->getId(), $timestamp);
+ if ($versionEntity->getLabel() !== '') {
+ continue;
+ }
+ $versionsMapper->delete($versionEntity);
+ } catch (DoesNotExistException $e) {
+ }
+
\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]);
self::deleteVersion($versionsFileview, $path);
\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]);