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
// 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.
}
}
}
+
+ /**
+ * 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);
+ }
+ }
}