From 4f362f66933e088efdc1cc086014b33da80827e0 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 6 Feb 2020 00:00:00 +0000 Subject: [PATCH] Asynchronously add contacts to avoid timeout problems --- mod/settings.php | 2 +- src/Worker/AddContact.php | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/Worker/AddContact.php diff --git a/mod/settings.php b/mod/settings.php index 69d9c77c9f..dde7bbf478 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -403,7 +403,7 @@ function settings_post(App $a) // "http" or "@" to be present in the string. // All other fields from the row will be ignored if ((strpos($csvRow[0],'@') !== false) || (strpos($csvRow[0],'http') !== false)) { - $arr = Contact::createFromProbe($_SESSION['uid'], $csvRow[0], '', false); + Worker::add(PRIORITY_LOW, 'AddContact', $_SESSION['uid'], $csvRow[0]); } } info(DI::l10n()->t('Importing Contacts done')); diff --git a/src/Worker/AddContact.php b/src/Worker/AddContact.php new file mode 100644 index 0000000000..47d9d01375 --- /dev/null +++ b/src/Worker/AddContact.php @@ -0,0 +1,24 @@ + $uid, 'url' => $url, 'result' => $result]); + } +} -- 2.39.5