]> git.mxchange.org Git - friendica-addons.git/commitdiff
Remove old version conversion code
authorMatthew Exon <git.mexon@spamgourmet.com>
Sun, 14 Jul 2024 16:56:22 +0000 (18:56 +0200)
committerMatthew Exon <git.mexon@spamgourmet.com>
Sat, 20 Jul 2024 11:00:07 +0000 (13:00 +0200)
mailstream/mailstream.php

index b86c4e2a314bd8a39b8aaa0fd23f3686e5d79741..8bce2529eb7ef64defe39008dab59cc4bc3dca75 100644 (file)
@@ -37,25 +37,6 @@ function mailstream_install()
        Logger::info("installed mailstream");
 }
 
-/**
- * Enforces that mailstream_install has set up the current version
- */
-function mailstream_check_version()
-{
-       if (!is_null(DI::config()->get('mailstream', 'dbversion'))) {
-               DI::config()->delete('mailstream', 'dbversion');
-               Logger::info("old version detected, reinstalling");
-               mailstream_install();
-               Hook::loadHooks();
-               Hook::add(
-                       'mailstream_convert_table_entries',
-                       'addon/mailstream/mailstream.php',
-                       'mailstream_convert_table_entries'
-               );
-               Hook::fork(Worker::PRIORITY_LOW, 'mailstream_convert_table_entries');
-       }
-}
-
 /**
  * This is a statement rather than an actual function definition. The simple
  * existence of this method is checked to figure out if the addon offers a
@@ -142,8 +123,6 @@ function mailstream_send_hook(array $data)
  */
 function mailstream_post_hook(array &$item)
 {
-       mailstream_check_version();
-
        if ($item['uid'] === 0) {
                Logger::debug('mailstream: root user, skipping item ' . $item['id']);
                return;
@@ -462,29 +441,6 @@ function mailstream_html_wrap(string &$text)
        return $text;
 }
 
-/**
- * Convert v1 mailstream table entries to v2 workerqueue items
- */
-function mailstream_convert_table_entries()
-{
-       $ms_item_ids = DBA::selectToArray('mailstream_item', [], ['message-id', 'uri', 'uid', 'contact-id'], ["`mailstream_item`.`completed` IS NULL"]);
-       Logger::debug('processing items', ['count' => count($ms_item_ids)]);
-       foreach ($ms_item_ids as $ms_item_id) {
-               $send_hook_data = array('uid' => $ms_item_id['uid'],
-                                       'contact-id' => $ms_item_id['contact-id'],
-                                       'uri' => $ms_item_id['uri'],
-                                       'message_id' => $ms_item_id['message-id'],
-                                       'tries' => 0);
-               if (!$ms_item_id['message-id'] || !strlen($ms_item_id['message-id'])) {
-                       Logger::info('item has no message-id', ['item' => $ms_item_id['id'], 'uri' => $ms_item_id['uri']]);
-                       continue;
-               }
-               Logger::info('convert item to workerqueue', $send_hook_data);
-               Hook::fork(Worker::PRIORITY_LOW, 'mailstream_send_hook', $send_hook_data);
-       }
-       DBA::e('DROP TABLE `mailstream_item`');
-}
-
 /**
  * Form for configuring mailstream features for a user
  *