diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index b4499fec62..1709bd5018 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -29,6 +29,7 @@ use OCA\Mail\Events\MessageDeletedEvent; use OCA\Mail\Events\MessageFlaggedEvent; use OCA\Mail\Events\MessageSentEvent; +use OCA\Mail\Events\NewMessagesSynchronized; use OCA\Mail\Events\OutboxMessageCreatedEvent; use OCA\Mail\Events\SynchronizationEvent; use OCA\Mail\HordeTranslationHandler; @@ -44,7 +45,6 @@ use OCA\Mail\Listener\MessageCacheUpdaterListener; use OCA\Mail\Listener\MessageKnownSinceListener; use OCA\Mail\Listener\MoveJunkListener; -use OCA\Mail\Listener\NewMessageClassificationListener; use OCA\Mail\Listener\NewMessagesNotifier; use OCA\Mail\Listener\OauthTokenRefreshListener; use OCA\Mail\Listener\OptionalIndicesListener; @@ -123,10 +123,8 @@ public function register(IRegistrationContext $context): void { $context->registerEventListener(MessageDeletedEvent::class, MessageCacheUpdaterListener::class); $context->registerEventListener(MessageSentEvent::class, AddressCollectionListener::class); $context->registerEventListener(MessageSentEvent::class, InteractionListener::class); - $context->registerEventListener(NewMessagesSynchronized::class, NewMessageClassificationListener::class); $context->registerEventListener(NewMessagesSynchronized::class, MessageKnownSinceListener::class); $context->registerEventListener(NewMessagesSynchronized::class, NewMessagesNotifier::class); - $context->registerEventListener(MessageSentEvent::class, SaveSentMessageListener::class); $context->registerEventListener(SynchronizationEvent::class, AccountSynchronizedThreadUpdaterListener::class); $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); $context->registerEventListener(NewMessagesSynchronized::class, FollowUpClassifierListener::class); diff --git a/lib/Db/StatisticsDao.php b/lib/Db/StatisticsDao.php index 9d3ded4ea6..0b23e0b759 100644 --- a/lib/Db/StatisticsDao.php +++ b/lib/Db/StatisticsDao.php @@ -157,7 +157,7 @@ public function getSubjects(array $mailboxes, array $emails): array { ->where($qb->expr()->eq('r.type', $qb->createNamedParameter(Address::TYPE_FROM, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT)) ->andWhere($qb->expr()->in('m.mailbox_id', $qb->createNamedParameter($mailboxIds, IQueryBuilder::PARAM_INT_ARRAY))) ->andWhere($qb->expr()->in('r.email', $qb->createNamedParameter($emails, IQueryBuilder::PARAM_STR_ARRAY), IQueryBuilder::PARAM_STR_ARRAY)); - $result = $select->execute(); + $result = $select->executeQuery(); $rows = $result->fetchAll(); $result->closeCursor(); $data = []; @@ -181,7 +181,7 @@ public function getPreviewTexts(array $mailboxes, array $emails): array { ->andWhere($qb->expr()->in('m.mailbox_id', $qb->createNamedParameter($mailboxIds, IQueryBuilder::PARAM_INT_ARRAY))) ->andWhere($qb->expr()->in('r.email', $qb->createNamedParameter($emails, IQueryBuilder::PARAM_STR_ARRAY), IQueryBuilder::PARAM_STR_ARRAY)) ->andWhere($qb->expr()->isNotNull('m.preview_text')); - $result = $select->execute(); + $result = $select->executeQuery(); $rows = $result->fetchAll(); $result->closeCursor(); $data = []; diff --git a/lib/Service/Classification/FeatureExtraction/SubjectExtractor.php b/lib/Service/Classification/FeatureExtraction/SubjectExtractor.php index 20dcbeae34..b768938139 100644 --- a/lib/Service/Classification/FeatureExtraction/SubjectExtractor.php +++ b/lib/Service/Classification/FeatureExtraction/SubjectExtractor.php @@ -116,8 +116,13 @@ public function extract(Message $message): array { * Limit feature vector length to actual vocabulary size. */ private function limitFeatureSize(): void { - $vocab = $this->wordCountVectorizer->vocabularies()[0]; - $this->max = count($vocab); + $vocabularies = $this->wordCountVectorizer->vocabularies(); + if (!isset($vocabularies[0])) { + // Should not happen but better safe than sorry + return; + } + + $this->max = count($vocabularies[0]); echo("WCF vocab size: {$this->max}\n"); } } diff --git a/lib/Service/Sync/ImapToDbSynchronizer.php b/lib/Service/Sync/ImapToDbSynchronizer.php index 71fec38a48..e4d0e87474 100644 --- a/lib/Service/Sync/ImapToDbSynchronizer.php +++ b/lib/Service/Sync/ImapToDbSynchronizer.php @@ -20,6 +20,7 @@ use OCA\Mail\Db\MessageMapper as DatabaseMessageMapper; use OCA\Mail\Db\Tag; use OCA\Mail\Db\TagMapper; +use OCA\Mail\Events\NewMessagesSynchronized; use OCA\Mail\Events\SynchronizationEvent; use OCA\Mail\Exception\ClientException; use OCA\Mail\Exception\IncompleteSyncException; @@ -30,7 +31,6 @@ use OCA\Mail\Exception\UidValidityChangedException; use OCA\Mail\IMAP\IMAPClientFactory; use OCA\Mail\IMAP\MessageMapper as ImapMessageMapper; -use OCA\Mail\IMAP\PreviewEnhancer; use OCA\Mail\IMAP\Sync\Request; use OCA\Mail\IMAP\Sync\Synchronizer; use OCA\Mail\Model\IMAPMessage; @@ -76,7 +76,6 @@ class ImapToDbSynchronizer { /** @var IMailManager */ private $mailManager; - private PreviewEnhancer $previewEnhancer; private TagMapper $tagMapper; private NewMessagesClassifier $newMessagesClassifier; @@ -90,7 +89,6 @@ public function __construct(DatabaseMessageMapper $dbMapper, PerformanceLogger $performanceLogger, LoggerInterface $logger, IMailManager $mailManager, - PreviewEnhancer $previewEnhancer, TagMapper $tagMapper, NewMessagesClassifier $newMessagesClassifier) { $this->dbMapper = $dbMapper; @@ -102,7 +100,6 @@ public function __construct(DatabaseMessageMapper $dbMapper, $this->performanceLogger = $performanceLogger; $this->logger = $logger; $this->mailManager = $mailManager; - $this->previewEnhancer = $previewEnhancer; $this->tagMapper = $tagMapper; $this->newMessagesClassifier = $newMessagesClassifier; }