Cleaned code
This commit is contained in:
parent
6c3b1ac4bd
commit
c1d1b189f7
|
@ -91,10 +91,8 @@ class Delayed
|
||||||
|
|
||||||
Logger::notice('Post stored', ['id' => $id, 'uid' => $item['uid'], 'cid' => $item['contact-id']]);
|
Logger::notice('Post stored', ['id' => $id, 'uid' => $item['uid'], 'cid' => $item['contact-id']]);
|
||||||
|
|
||||||
// It should always contain an URI since this is needed to create a delayed post entry
|
|
||||||
if (!empty($item['uri']) && self::exists($item['uri'], $item['uid'])) {
|
if (!empty($item['uri']) && self::exists($item['uri'], $item['uid'])) {
|
||||||
$result = self::delete($item['uri'], $item['uid']);
|
self::delete($item['uri'], $item['uid']);
|
||||||
Logger::notice('Delayed post entry deleted', ['result' => $result, 'uri' => $item['uri']]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($id) && (!empty($taglist) || !empty($attachments))) {
|
if (!empty($id) && (!empty($taglist) || !empty($attachments))) {
|
||||||
|
|
|
@ -623,7 +623,7 @@ class Feed
|
||||||
'taglist' => $taglist, 'attachments' => $attachments];
|
'taglist' => $taglist, 'attachments' => $attachments];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Logger::info('Post already crated or exists in the delayed posts queue', ['uri' => $item["uri"]]);
|
Logger::info('Post already crated or exists in the delayed posts queue', ['uid' => $item['uid'], 'uri' => $item["uri"]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,7 +634,7 @@ class Feed
|
||||||
// Posts shouldn't be delayed more than a day
|
// Posts shouldn't be delayed more than a day
|
||||||
$interval = min(1440, self::getPollInterval($contact));
|
$interval = min(1440, self::getPollInterval($contact));
|
||||||
$delay = max(round(($interval * 60) / $total), 60 * $min_posting);
|
$delay = max(round(($interval * 60) / $total), 60 * $min_posting);
|
||||||
Logger::notice('Got posting delay', ['delay' => $delay, 'interval' => $interval, 'items' => $total, 'cid' => $contact['id'], 'url' => $contact['url']]);
|
Logger::info('Got posting delay', ['delay' => $delay, 'interval' => $interval, 'items' => $total, 'cid' => $contact['id'], 'url' => $contact['url']]);
|
||||||
} else {
|
} else {
|
||||||
$delay = 0;
|
$delay = 0;
|
||||||
}
|
}
|
||||||
|
@ -644,7 +644,6 @@ class Feed
|
||||||
foreach ($postings as $posting) {
|
foreach ($postings as $posting) {
|
||||||
if ($delay > 0) {
|
if ($delay > 0) {
|
||||||
$publish_time = time() + $post_delay;
|
$publish_time = time() + $post_delay;
|
||||||
Logger::notice('Got publishing date', ['delay' => $delay, 'cid' => $contact['id'], 'url' => $contact['url']]);
|
|
||||||
$post_delay += $delay;
|
$post_delay += $delay;
|
||||||
} else {
|
} else {
|
||||||
$publish_time = time();
|
$publish_time = time();
|
||||||
|
@ -653,12 +652,6 @@ class Feed
|
||||||
$last_publish = DI::pConfig()->get($posting['item']['uid'], 'system', 'last_publish', 0, true);
|
$last_publish = DI::pConfig()->get($posting['item']['uid'], 'system', 'last_publish', 0, true);
|
||||||
$next_publish = max($last_publish + (60 * $min_posting), time());
|
$next_publish = max($last_publish + (60 * $min_posting), time());
|
||||||
if ($publish_time < $next_publish) {
|
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),
|
|
||||||
'uid' => $posting['item']['uid'], 'cid' => $posting['item']['contact-id'],
|
|
||||||
'uri' => $posting['item']["uri"]]);
|
|
||||||
$publish_time = $next_publish;
|
$publish_time = $next_publish;
|
||||||
}
|
}
|
||||||
$publish_at = date(DateTimeFormat::MYSQL, $publish_time);
|
$publish_at = date(DateTimeFormat::MYSQL, $publish_time);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user