- $id = Item::insert($posting['item'], $posting['notify']);
-
- Logger::notice("Feed for contact " . $contact["url"] . " stored under id " . $id);
-
- if (!empty($id) && (!empty($posting['taglist']) || !empty($posting['attachments']))) {
- $feeditem = Item::selectFirst(['uri-id'], ['id' => $id]);
- foreach ($posting['taglist'] as $tag) {
- Tag::store($feeditem['uri-id'], Tag::HASHTAG, $tag);
- }
- foreach ($posting['attachments'] as $attachment) {
- $attachment['uri-id'] = $feeditem['uri-id'];
- Post\Media::insert($attachment);
- }
+ $last_publish = DI::pConfig()->get($posting['item']['uid'], 'system', 'last_publish', 0, true);
+ $next_publish = max($last_publish + (60 * $min_posting), time());
+ if ($publish_time < $next_publish) {
+ Logger::notice('Adapting publish time',
+ ['last' => date(DateTimeFormat::MYSQL, $last_publish),
+ 'next' => date(DateTimeFormat::MYSQL, $next_publish),
+ 'publish' => date(DateTimeFormat::MYSQL, $publish_time)]);
+ $publish_time = $next_publish;