1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @copyright Copyright (c) 2017, Matias De lellis <[email protected]> |
4
|
|
|
* @copyright Copyright (c) 2018, Branko Kokanovic <[email protected]> |
5
|
|
|
* |
6
|
|
|
* @author Branko Kokanovic <[email protected]> |
7
|
|
|
* |
8
|
|
|
* @license GNU AGPL version 3 or any later version |
9
|
|
|
* |
10
|
|
|
* This program is free software: you can redistribute it and/or modify |
11
|
|
|
* it under the terms of the GNU Affero General Public License as |
12
|
|
|
* published by the Free Software Foundation, either version 3 of the |
13
|
|
|
* License, or (at your option) any later version. |
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 Affero General Public License for more details. |
19
|
|
|
* |
20
|
|
|
* You should have received a copy of the GNU Affero General Public License |
21
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
22
|
|
|
* |
23
|
|
|
*/ |
24
|
|
|
namespace OCA\FaceRecognition\Db; |
25
|
|
|
|
26
|
|
|
use JsonSerializable; |
27
|
|
|
|
28
|
|
|
use OCP\AppFramework\Db\Entity; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Image represent one image file for one user. |
32
|
|
|
* |
33
|
|
|
* @method string getUser() |
34
|
|
|
* @method void setUser(string $user) |
35
|
|
|
* |
36
|
|
|
* @method integer getFile() |
37
|
|
|
* @method void setFile(integer $file) |
38
|
|
|
* |
39
|
|
|
* @method integer getModel() |
40
|
|
|
* @method void setModel(integer $model) |
41
|
|
|
*/ |
42
|
|
|
class Image extends Entity implements JsonSerializable { |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* User this image belongs to. |
46
|
|
|
* |
47
|
|
|
* @var string |
48
|
|
|
* */ |
49
|
|
|
public $user; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* File that this image refer to. |
53
|
|
|
* todo: add proper getters in whole class |
54
|
|
|
* |
55
|
|
|
* @var integer |
56
|
|
|
*/ |
57
|
|
|
public $file; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Face model that processed this image. |
61
|
|
|
* |
62
|
|
|
* @var integer |
63
|
|
|
*/ |
64
|
|
|
protected $model; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Whether this image is processed or not. Needed because image doesn't have to have any faces on it, |
68
|
|
|
* yet we still need to know if it is being processed or not. |
69
|
|
|
* |
70
|
|
|
* @var bool |
71
|
|
|
*/ |
72
|
|
|
protected $isProcessed; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Description of error that happened during image processing. |
76
|
|
|
* If it exist, image processing should be skipped even if $is_processed is false. |
77
|
|
|
* |
78
|
|
|
* @var string|null |
79
|
|
|
*/ |
80
|
|
|
protected $error; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Timestamp when this image was last processed. |
84
|
|
|
* |
85
|
|
|
* @var timestamp|null |
|
|
|
|
86
|
|
|
*/ |
87
|
|
|
protected $lastProcessedTime; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Duration (in ms) it took to completely process this image. Should serve as a way to give estimates to user. |
91
|
|
|
* |
92
|
|
|
* @var integer|null |
93
|
|
|
*/ |
94
|
|
|
protected $processingDuration; |
95
|
|
|
|
96
|
|
|
public function jsonSerialize() { |
97
|
|
|
return [ |
98
|
|
|
'id' => $this->id, |
99
|
|
|
'user' => $this->user, |
100
|
|
|
'file' => $this->file, |
101
|
|
|
'model' => $this->model, |
102
|
|
|
'is_processed' => $this->isProcessed, |
103
|
|
|
'error' => $this->error, |
104
|
|
|
'last_processed_time' => $this->lastProcessedTime, |
105
|
|
|
'processing_duration' => $this->processingDuration |
106
|
|
|
]; |
107
|
|
|
} |
108
|
|
|
|
109
|
4 |
|
public function setIsProcessed($isProcessed) { |
110
|
4 |
|
if (is_bool($isProcessed)) { |
111
|
4 |
|
$this->isProcessed = $isProcessed; |
112
|
|
|
} else { |
113
|
|
|
$this->isProcessed = filter_var($isProcessed, FILTER_VALIDATE_BOOLEAN); |
114
|
|
|
} |
115
|
4 |
|
$this->markFieldUpdated('isProcessed'); |
116
|
4 |
|
} |
117
|
|
|
} |
118
|
|
|
|
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