mirror of
https://github.com/friendica/friendica
synced 2025-04-26 18:30:11 +00:00
Replace references to UTC_TIMESTAMP in SQL queries with a DateTimeFormat generated parameter
This commit is contained in:
parent
ecaed2a845
commit
80da47921e
14 changed files with 37 additions and 28 deletions
|
@ -29,6 +29,7 @@ use Friendica\Core\System;
|
|||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
/**
|
||||
|
@ -547,7 +548,7 @@ class Tag
|
|||
{
|
||||
// Get a uri-id that is at least X hours old.
|
||||
// We use the uri-id in the query for the hash tags since this is much faster
|
||||
$post = Post::selectFirstThread(['uri-id'], ["`uid` = ? AND `received` < UTC_TIMESTAMP() - INTERVAL ? HOUR", 0, $period],
|
||||
$post = Post::selectFirstThread(['uri-id'], ["`uid` = ? AND `received` < ?", 0, DateTimeFormat::utc('now - ' . $period . ' hour')],
|
||||
['order' => ['received' => true]]);
|
||||
if (empty($post['uri-id'])) {
|
||||
return [];
|
||||
|
@ -600,7 +601,7 @@ class Tag
|
|||
{
|
||||
// Get a uri-id that is at least X hours old.
|
||||
// We use the uri-id in the query for the hash tags since this is much faster
|
||||
$post = Post::selectFirstThread(['uri-id'], ["`uid` = ? AND `received` < UTC_TIMESTAMP() - INTERVAL ? HOUR", 0, $period],
|
||||
$post = Post::selectFirstThread(['uri-id'], ["`uid` = ? AND `received` < ?", 0, DateTimeFormat::utc('now - ' . $period . ' hour')],
|
||||
['order' => ['received' => true]]);
|
||||
if (empty($post['uri-id'])) {
|
||||
return [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue