X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FWorker%2FCron.php;h=9db954298ad3b243e3bfbed71affad1685963986;hb=757a5c2de974ccf631e42a39b479a8a9de22a622;hp=4bf134f7bd807d4f777ab4b095bee8e5b19df783;hpb=11538376ed8714cfdf9c778face23707b3728f76;p=friendica.git diff --git a/src/Core/Worker/Cron.php b/src/Core/Worker/Cron.php index 4bf134f7bd..9db954298a 100644 --- a/src/Core/Worker/Cron.php +++ b/src/Core/Worker/Cron.php @@ -25,9 +25,11 @@ use Friendica\Core\Logger; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; +use Friendica\Model\Contact; use Friendica\Model\Post; use Friendica\Protocol\ActivityPub; use Friendica\Util\DateTimeFormat; +use Friendica\Util\Strings; /** * Contains the class for jobs that are executed in an interval @@ -99,7 +101,7 @@ class Cron // How long is the process already running? $duration = (time() - strtotime($entry["executed"])) / 60; if ($duration > $max_duration) { - Logger::notice('Worker process took too much time - killed', ['duration' => number_format($duration, 3), 'max' => $max_duration, 'id' => $entry["id"], 'pid' => $entry["pid"], 'command' => $command]); + Logger::warning('Worker process took too much time - killed', ['duration' => number_format($duration, 3), 'max' => $max_duration, 'id' => $entry["id"], 'pid' => $entry["pid"], 'command' => $command]); posix_kill($entry["pid"], SIGTERM); // We killed the stale process. @@ -179,4 +181,24 @@ class Cron } } } + + /** + * Add missing "intro" records. + * + * @return void + */ + private static function addIntros() + { + $contacts = DBA::p("SELECT `uid`, `id`, `created` FROM `contact` WHERE `rel` = ? AND `pending` AND NOT EXISTS (SELECT `id` FROM `intro` WHERE `contact-id` = `contact`.`id`)", Contact::FOLLOWER); + while ($contact = DBA::fetch($contacts)) { + $fields = [ + 'uid' => $contact['uid'], + 'contact-id' => $contact['id'], + 'datetime' => $contact['created'], + 'hash' => Strings::getRandomHex() + ]; + Logger::notice('Adding missing intro', ['fields' => $fields]); + DBA::insert('intro', $fields); + } + } }