#!/usr/bin/env php . /** * StoreRemoteMediaPlugin * * @category Plugin * @package GNUsocial * @author Diogo Peralta Cordeiro * @author Alexei Sorokin * @copyright 2018-2021 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ define('INSTALLDIR', dirname(__DIR__, 3)); define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public'); $shortoptions = 'l::a::i'; $longoptions = ['limit=', 'all', 'image']; $helptext = <<query(sprintf( <<<'END' SELECT file_to_post.file_id FROM file_to_post INNER JOIN file ON file_to_post.file_id = file.id INNER JOIN notice ON file_to_post.post_id = notice.id WHERE notice.is_local = 0 AND notice.modified <= '%3$s' GROUP BY file_to_post.file_id ORDER BY MAX(notice.modified) END, $fn->escape($max_date) )); while ($fn->fetch()) { $file = File::getByID($fn->file_id); $file_info_id = $file->getID(); // Delete current file $file->delete(); if (!$quiet) { echo "Deleted file with id: {$file_info_id}\n"; } }