Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3/**
4 * Interface for exposing the "deleteExpired" method required by command line
5 * cleanup tools.
6 *
7 * PHP version 8
8 *
9 * Copyright (C) Villanova University 2024.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2,
13 * as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23 *
24 * @category VuFind
25 * @package  Database
26 * @author   Demian Katz <demian.katz@villanova.edu>
27 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
28 * @link     https://vufind.org/wiki/development:plugins:database_gateways Wiki
29 */
30
31namespace VuFind\Db\Service\Feature;
32
33use DateTime;
34
35/**
36 * Interface for exposing the "deleteExpired" method required by command line
37 * cleanup tools.
38 *
39 * @category VuFind
40 * @package  Database
41 * @author   Demian Katz <demian.katz@villanova.edu>
42 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
43 * @link     https://vufind.org/wiki/development:plugins:database_gateways Wiki
44 */
45interface DeleteExpiredInterface
46{
47    /**
48     * Delete expired records. Allows setting a limit so that rows can be deleted in small batches.
49     *
50     * @param DateTime $dateLimit Date threshold of an "expired" record.
51     * @param ?int     $limit     Maximum number of rows to delete or null for no limit.
52     *
53     * @return int Number of rows deleted
54     */
55    public function deleteExpired(DateTime $dateLimit, ?int $limit = null): int;
56}