mirror of
https://github.com/nextcloud/richdocuments.git
synced 2025-12-18 05:20:43 +01:00
Signed-off-by: Julius Härtl <jus@bitgrid.net> Cleanup template loading Signed-off-by: Julius Härtl <jus@bitgrid.net> Fix template handling Signed-off-by: Julius Härtl <jus@bitgrid.net>
49 lines
1.5 KiB
PHP
49 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
|
|
*
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
|
*
|
|
* @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 <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
namespace OCA\Richdocuments\Backgroundjobs;
|
|
|
|
use OC\BackgroundJob\TimedJob;
|
|
use OCA\Richdocuments\Service\CapabilitiesService;
|
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
|
use OCP\IDBConnection;
|
|
|
|
class Cleanup extends TimedJob {
|
|
|
|
/** @var IDBConnection */
|
|
private $db;
|
|
|
|
public function __construct(IDBConnection $db) {
|
|
$this->db = $db;
|
|
|
|
$this->setInterval(60*60);
|
|
}
|
|
|
|
protected function run($argument) {
|
|
// Expire template mappings for file creation
|
|
$query = $this->db->getQueryBuilder();
|
|
$query->delete('richdocuments_template')
|
|
->where($query->expr()->lte('timestamp', $query->createNamedParameter(time() - 60, IQueryBuilder::PARAM_INT)));
|
|
$query->executeStatement();
|
|
}
|
|
}
|