undo-ransomware /
ransomware_detection
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * @copyright Copyright (c) 2018 Matthias Held <[email protected]> |
||
| 5 | * @author Matthias Held <[email protected]> |
||
| 6 | * @license GNU AGPL version 3 or any later version |
||
| 7 | * |
||
| 8 | * This program is free software: you can redistribute it and/or modify |
||
| 9 | * it under the terms of the GNU Affero General Public License as |
||
| 10 | * published by the Free Software Foundation, either version 3 of the |
||
| 11 | * License, or (at your option) any later version. |
||
| 12 | * |
||
| 13 | * This program is distributed in the hope that it will be useful, |
||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 16 | * GNU Affero General Public License for more details. |
||
| 17 | * |
||
| 18 | * You should have received a copy of the GNU Affero General Public License |
||
| 19 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
||
| 20 | */ |
||
| 21 | |||
| 22 | namespace OCA\RansomwareDetection\BackgroundJob; |
||
| 23 | |||
| 24 | use OCA\RansomwareDetection\Service\FileOperationService; |
||
| 25 | use OC\BackgroundJob\TimedJob; |
||
|
0 ignored issues
–
show
|
|||
| 26 | use OCP\IConfig; |
||
|
0 ignored issues
–
show
The type
OCP\IConfig was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 27 | |||
| 28 | class CleanUpJob extends TimedJob |
||
| 29 | { |
||
| 30 | /** @var IConfig */ |
||
| 31 | protected $config; |
||
| 32 | |||
| 33 | /** @var FileOperationService */ |
||
| 34 | protected $fileOperationService; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param FileOperationService $fileOperationService |
||
| 38 | * @param IConfig $config |
||
| 39 | */ |
||
| 40 | public function __construct( |
||
| 41 | FileOperationService $fileOperationService, |
||
| 42 | IConfig $config |
||
| 43 | ) { |
||
| 44 | // Run once a day |
||
| 45 | $this->setInterval(24 * 60 * 60); |
||
| 46 | $this->fileOperationService = $fileOperationService; |
||
| 47 | $this->config = $config; |
||
| 48 | } |
||
| 49 | |||
| 50 | public function run($argument) |
||
| 51 | { |
||
| 52 | $expireDays = $this->config->getAppValue('ransomware_detection', 'expire_days', 7); |
||
| 53 | $this->fileOperationService->deleteFileOperationsBefore(strtotime('-'.$expireDays.' day')); |
||
| 54 | } |
||
| 55 | } |
||
| 56 |
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