mirror of
https://github.com/friendica/friendica
synced 2024-11-10 04:22:54 +00:00
Replace references to NOW() in SQL queries with a DateTimeFormat generated parameter
This commit is contained in:
parent
80da47921e
commit
423892b814
2 changed files with 4 additions and 5 deletions
|
@ -146,7 +146,7 @@ class DatabaseCache extends AbstractCache implements ICanCache
|
|||
{
|
||||
try {
|
||||
if ($outdated) {
|
||||
return $this->dba->delete('cache', ['`expires` < NOW()']);
|
||||
return $this->dba->delete('cache', ['`expires` < ?', DateTimeFormat::utcNow()]);
|
||||
} else {
|
||||
return $this->dba->delete('cache', ['`k` IS NOT NULL ']);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Friendica\Worker;
|
|||
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
/**
|
||||
* Clear cache entries
|
||||
|
@ -31,15 +32,13 @@ class ClearCache
|
|||
{
|
||||
public static function execute()
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
// clear old cache
|
||||
DI::cache()->clear();
|
||||
|
||||
// Delete the cached OEmbed entries that are older than three month
|
||||
DBA::delete('oembed', ["`created` < NOW() - INTERVAL 3 MONTH"]);
|
||||
DBA::delete('oembed', ["`created` < ?", DateTimeFormat::utc('now - 3 months')]);
|
||||
|
||||
// Delete the cached "parsed_url" entries that are expired
|
||||
DBA::delete('parsed_url', ["`expires` < NOW()"]);
|
||||
DBA::delete('parsed_url', ["`expires` < ?", DateTimeFormat::utcNow()]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue