2020-08-16 04:39:04 -04:00
|
|
|
<?php
|
|
|
|
/**
|
2022-01-02 02:27:47 -05:00
|
|
|
* @copyright Copyright (C) 2010-2022, the Friendica project
|
2020-08-16 04:39:04 -04:00
|
|
|
*
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Friendica\Worker;
|
|
|
|
|
|
|
|
use Friendica\Database\DBA;
|
|
|
|
use Friendica\DI;
|
2021-12-02 09:20:50 -05:00
|
|
|
use Friendica\Util\DateTimeFormat;
|
2020-08-16 04:39:04 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear cache entries
|
|
|
|
*/
|
|
|
|
class ClearCache
|
|
|
|
{
|
|
|
|
public static function execute()
|
|
|
|
{
|
|
|
|
// clear old cache
|
|
|
|
DI::cache()->clear();
|
|
|
|
|
|
|
|
// Delete the cached OEmbed entries that are older than three month
|
2021-12-02 09:20:50 -05:00
|
|
|
DBA::delete('oembed', ["`created` < ?", DateTimeFormat::utc('now - 3 months')]);
|
2020-08-16 04:39:04 -04:00
|
|
|
|
2021-02-16 10:16:04 -05:00
|
|
|
// Delete the cached "parsed_url" entries that are expired
|
2021-12-02 09:20:50 -05:00
|
|
|
DBA::delete('parsed_url', ["`expires` < ?", DateTimeFormat::utcNow()]);
|
2020-08-16 04:39:04 -04:00
|
|
|
}
|
|
|
|
}
|