1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* (c) Kitodo. Key to digital objects e.V. <[email protected]> |
5
|
|
|
* |
6
|
|
|
* This file is part of the Kitodo and TYPO3 projects. |
7
|
|
|
* |
8
|
|
|
* @license GNU General Public License version 3 or later. |
9
|
|
|
* For the full copyright and license information, please read the |
10
|
|
|
* LICENSE.txt file that was distributed with this source code. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Kitodo\Dlf\Domain\Repository; |
14
|
|
|
|
15
|
|
|
class TokenRepository extends \TYPO3\CMS\Extbase\Persistence\Repository |
16
|
|
|
{ |
17
|
|
|
public function deleteExpiredTokens($execTime, $expired) { |
18
|
|
|
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_dlf_tokens'); |
|
|
|
|
19
|
|
|
|
20
|
|
|
$result = $queryBuilder |
21
|
|
|
->delete('tx_dlf_tokens') |
22
|
|
|
->where( |
23
|
|
|
$queryBuilder->expr()->eq('tx_dlf_tokens.ident', $queryBuilder->createNamedParameter('oai')), |
24
|
|
|
$queryBuilder->expr()->lt('tx_dlf_tokens.tstamp', |
25
|
|
|
$queryBuilder->createNamedParameter((int) ($execTime - $expired))) |
26
|
|
|
) |
27
|
|
|
->execute(); |
28
|
|
|
|
29
|
|
|
return $result; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function getResumptionToken($token) { |
33
|
|
|
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
34
|
|
|
->getQueryBuilderForTable('tx_dlf_tokens'); |
35
|
|
|
|
36
|
|
|
// Get resumption token. |
37
|
|
|
$result = $queryBuilder |
38
|
|
|
->select('tx_dlf_tokens.options AS options') |
39
|
|
|
->from('tx_dlf_tokens') |
40
|
|
|
->where( |
41
|
|
|
$queryBuilder->expr()->eq('tx_dlf_tokens.ident', $queryBuilder->createNamedParameter('oai')), |
42
|
|
|
$queryBuilder->expr()->eq('tx_dlf_tokens.token', |
43
|
|
|
$queryBuilder->expr()->literal($token) |
44
|
|
|
) |
45
|
|
|
) |
46
|
|
|
->setMaxResults(1) |
47
|
|
|
->execute(); |
48
|
|
|
|
49
|
|
|
return $result; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function generateResumptionToken($token, $documentListSet) { |
53
|
|
|
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_dlf_tokens'); |
54
|
|
|
$affectedRows = $queryBuilder |
55
|
|
|
->insert('tx_dlf_tokens') |
56
|
|
|
->values([ |
57
|
|
|
'tstamp' => $GLOBALS['EXEC_TIME'], |
58
|
|
|
'token' => $token, |
59
|
|
|
'options' => serialize($documentListSet), |
60
|
|
|
'ident' => 'oai', |
61
|
|
|
]) |
62
|
|
|
->execute(); |
63
|
|
|
|
64
|
|
|
return $affectedRows; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths