diff --git a/Classes/Repository/CacheMd5paramsRepository.php b/Classes/Repository/CacheMd5paramsRepository.php index 1850793..08bc478 100644 --- a/Classes/Repository/CacheMd5paramsRepository.php +++ b/Classes/Repository/CacheMd5paramsRepository.php @@ -102,4 +102,46 @@ public function insert(string $md5, int $timestamp, string $inUrl, int $type = 2 ] ); } + + /** + * Delete the stored variables using the hash value to access the database + */ + public function delete(string $md5): int + { + $result = 0; + if ($md5 != '') { + $connection = $this->getConnection(); + $result = $connection->delete( + $this->table, + [ + 'md5hash' => $md5 + ] + ); + } + return $result; + } + + /** + * Delete the stored variables using the hash value to access the database + * Return the affected rows. + */ + public function deleteOutdatedHours(int $hours, int $type = 2): int + { + $maxLifetime = time() - (3600 * $hours); + $queryBuilder = $this->getQueryBuilder(); + return $queryBuilder + ->delete($this->table) + ->andWhere( + $queryBuilder->expr()->lte( + 'tstamp', + $queryBuilder->createNamedParameter($maxLifetime, Connection::PARAM_INT) + ), + $queryBuilder->expr()->eq( + 'type', + $queryBuilder->createNamedParameter($type, Connection::PARAM_INT) + ), + ) + ->executeStatement(); + } } + diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml new file mode 100644 index 0000000..7f09eef --- /dev/null +++ b/Configuration/Services.yaml @@ -0,0 +1,9 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + FoT3\Rdct\: + resource: '../Classes/**' + exclude: '../Classes/Middleware/*' + diff --git a/ext_emconf.php b/ext_emconf.php index 835886a..55902d3 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -7,7 +7,7 @@ 'author' => 'Benni Mack', 'author_email' => 'benni@typo3.org', 'author_company' => '', - 'version' => '3.1.0', + 'version' => '3.2.0', 'constraints' => [ 'depends' => [ 'typo3' => '13.4.0-13.9.99',