1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/*************************************************************** |
4
|
|
|
* Copyright notice |
5
|
|
|
* |
6
|
|
|
* (c) 2009 AOE GmbH ([email protected]) |
7
|
|
|
* All rights reserved |
8
|
|
|
* |
9
|
|
|
* This script is part of the TYPO3 project. The TYPO3 project is |
10
|
|
|
* free software; you can redistribute it and/or modify |
11
|
|
|
* it under the terms of the GNU General Public License as published by |
12
|
|
|
* the Free Software Foundation; either version 2 of the License, or |
13
|
|
|
* (at your option) any later version. |
14
|
|
|
* |
15
|
|
|
* The GNU General Public License can be found at |
16
|
|
|
* http://www.gnu.org/copyleft/gpl.html. |
17
|
|
|
* |
18
|
|
|
* This script is distributed in the hope that it will be useful, |
19
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
20
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21
|
|
|
* GNU General Public License for more details. |
22
|
|
|
* |
23
|
|
|
* This copyright notice MUST APPEAR in all copies of the script! |
24
|
|
|
***************************************************************/ |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Class tx_crawler_domain_process_repository |
28
|
|
|
*/ |
29
|
|
|
class tx_crawler_domain_process_repository extends AOE\Crawler\Domain\Repository\AbstractRepository |
30
|
|
|
{ |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string object class name |
34
|
|
|
*/ |
35
|
|
|
protected $objectClassname = 'tx_crawler_domain_process'; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
protected $tableName = 'tx_crawler_process'; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* This method is used to find all cli processes within a limit. |
44
|
|
|
* |
45
|
|
|
* @param string $orderField |
46
|
|
|
* @param string $orderDirection |
47
|
|
|
* @param integer $itemCount |
48
|
|
|
* @param integer $offset |
49
|
|
|
* @param string $where |
50
|
|
|
* |
51
|
|
|
* @return tx_crawler_domain_process_collection |
52
|
|
|
*/ |
53
|
|
|
public function findAll($orderField = '', $orderDirection = 'DESC', $itemCount = null, $offset = null, $where = '') |
54
|
|
|
{ |
55
|
|
|
/** @var tx_crawler_domain_process_collection $collection */ |
56
|
|
|
$collection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_domain_process_collection'); |
|
|
|
|
57
|
|
|
|
58
|
|
|
$orderField = trim($orderField); |
59
|
|
|
$orderField = empty($orderField) ? 'process_id' : $orderField; |
60
|
|
|
|
61
|
|
|
$orderDirection = strtoupper(trim($orderDirection)); |
62
|
|
|
$orderDirection = in_array($orderDirection, ['ASC', 'DESC']) ? $orderDirection : 'DESC'; |
63
|
|
|
|
64
|
|
|
$rows = $this->getDB()->exec_SELECTgetRows( |
65
|
|
|
'*', |
66
|
|
|
$this->tableName, |
67
|
|
|
$where, |
68
|
|
|
'', |
69
|
|
|
htmlspecialchars($orderField) . ' ' . htmlspecialchars($orderDirection), |
70
|
|
|
self::getLimitFromItemCountAndOffset($itemCount, $offset) |
71
|
|
|
); |
72
|
|
|
|
73
|
|
|
if (is_array($rows)) { |
74
|
|
|
foreach ($rows as $row) { |
75
|
|
|
$collection->append(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($this->objectClassname, $row)); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
return $collection; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* This method is used to count all processes in the process table. |
84
|
|
|
* |
85
|
|
|
* @param string $where Where clause |
86
|
|
|
* |
87
|
|
|
* @return integer |
88
|
|
|
*/ |
89
|
|
|
public function countAll($where = '1 = 1') |
90
|
|
|
{ |
91
|
|
|
return $this->countByWhere($where); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Returns the number of active processes. |
96
|
|
|
* |
97
|
|
|
* @return integer |
98
|
|
|
*/ |
99
|
|
|
public function countActive() |
100
|
|
|
{ |
101
|
|
|
return $this->countByWhere('active = 1 AND deleted = 0'); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Returns the number of processes that live longer than the given timestamp. |
106
|
|
|
* |
107
|
|
|
* @param integer $ttl |
108
|
|
|
* |
109
|
|
|
* @return integer |
110
|
|
|
*/ |
111
|
|
|
public function countNotTimeouted($ttl) |
112
|
|
|
{ |
113
|
|
|
return $this->countByWhere('deleted = 0 AND ttl > ' . intval($ttl)); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Get limit clause |
118
|
|
|
* |
119
|
|
|
* @param integer $itemCount |
120
|
|
|
* @param integer $offset |
121
|
|
|
* |
122
|
|
|
* @return string |
123
|
|
|
*/ |
124
|
|
|
public static function getLimitFromItemCountAndOffset($itemCount, $offset) |
125
|
|
|
{ |
126
|
|
|
$itemCount = filter_var($itemCount, FILTER_VALIDATE_INT, ['options' => ['min_range' => 1, 'default' => 20]]); |
127
|
|
|
$offset = filter_var($offset, FILTER_VALIDATE_INT, ['options' => ['min_range' => 0, 'default' => 0]]); |
128
|
|
|
$limit = $offset . ', ' . $itemCount; |
129
|
|
|
|
130
|
|
|
return $limit; |
131
|
|
|
} |
132
|
|
|
} |
133
|
|
|
|
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