]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/ClearCache.php
Merge pull request #12814 from nupplaphil/bug/config_multi_serialize
[friendica.git] / src / Worker / ClearCache.php
index 33bf5894752bcd74aa5a9681c4c41d1a8e710150..593395ad092b8f448c7877135e592943981ef8d0 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -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()]);
        }
 }