diff --git a/lib/Cron/Backup.php b/lib/Cron/Backup.php index 6007ce75..94226ab0 100644 --- a/lib/Cron/Backup.php +++ b/lib/Cron/Backup.php @@ -31,7 +31,8 @@ namespace OCA\Backup\Cron; -use OC\BackgroundJob\TimedJob; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; use OCA\Backup\Exceptions\JobsTimeSlotException; use OCA\Backup\Service\ConfigService; use OCA\Backup\Service\CronService; @@ -48,39 +49,24 @@ class Backup extends TimedJob { use TNCLogger; - - /** @var PointService */ - private $pointService; - - /** @var CronService */ - private $cronService; - - /** @var ConfigService */ - private $configService; - - /** @var LoggerInterface */ - private $loggerInterface; - /** * Backup constructor. * + * @param ITimeFactory $time * @param PointService $pointService * @param CronService $cronService * @param ConfigService $configService * @param LoggerInterface $loggerInterface */ public function __construct( - PointService $pointService, - CronService $cronService, - ConfigService $configService, - LoggerInterface $loggerInterface + ITimeFactory $time, + private PointService $pointService, + private CronService $cronService, + private ConfigService $configService, + private LoggerInterface $loggerInterface ) { + parent::__construct($time); $this->setInterval(900); - - $this->pointService = $pointService; - $this->cronService = $cronService; - $this->configService = $configService; - $this->loggerInterface = $loggerInterface; } diff --git a/lib/Cron/Event.php b/lib/Cron/Event.php index 7527ca5e..c8ee371b 100644 --- a/lib/Cron/Event.php +++ b/lib/Cron/Event.php @@ -31,7 +31,8 @@ namespace OCA\Backup\Cron; -use OC\BackgroundJob\TimedJob; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; use OCA\Backup\Db\EventRequest; use OCA\Backup\Model\BackupEvent; use OCA\Backup\Service\ConfigService; @@ -48,26 +49,10 @@ class Event extends TimedJob { use TArrayTools; - - /** @var EventRequest */ - private $eventRequest; - - /** @var PointService */ - private $pointService; - - /** @var FilesService */ - private $filesService; - - /** @var CronService */ - private $cronService; - - /** @var ConfigService */ - private $configService; - - /** * Event constructor. * + * @param ITimeFactory $time * @param EventRequest $eventRequest * @param PointService $pointService * @param FilesService $filesService @@ -75,19 +60,15 @@ class Event extends TimedJob { * @param ConfigService $configService */ public function __construct( - EventRequest $eventRequest, - PointService $pointService, - FilesService $filesService, - CronService $cronService, - ConfigService $configService + ITimeFactory $time, + private EventRequest $eventRequest, + private PointService $pointService, + private FilesService $filesService, + private CronService $cronService, + private ConfigService $configService ) { + parent::__construct($time); $this->setInterval(1); - - $this->eventRequest = $eventRequest; - $this->pointService = $pointService; - $this->filesService = $filesService; - $this->cronService = $cronService; - $this->configService = $configService; } diff --git a/lib/Cron/Manage.php b/lib/Cron/Manage.php index f21eb59b..cf34e095 100644 --- a/lib/Cron/Manage.php +++ b/lib/Cron/Manage.php @@ -31,7 +31,8 @@ namespace OCA\Backup\Cron; -use OC\BackgroundJob\TimedJob; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; use OCA\Backup\Exceptions\ExternalFolderNotFoundException; use OCA\Backup\Exceptions\JobsTimeSlotException; use OCA\Backup\Model\RestoringPoint; @@ -52,31 +53,10 @@ class Manage extends TimedJob { public const DELAY_CHECK_HEALTH = 86400 * 7; // 7d - /** @var CronService */ - private $cronService; - - /** @var PointService */ - private $pointService; - - /** @var PackService */ - private $packService; - - /** @var UploadService */ - private $uploadService; - - /** @var ExternalFolderService */ - private $externalFolderService; - - /** @var OutputService */ - private $outputService; - - /** @var ConfigService */ - private $configService; - - /** * Manage constructor. * + * @param ITimeFactory $time * @param CronService $cronService * @param PointService $pointService * @param PackService $packService @@ -86,23 +66,17 @@ class Manage extends TimedJob { * @param ConfigService $configService */ public function __construct( - CronService $cronService, - PointService $pointService, - PackService $packService, - UploadService $uploadService, - ExternalFolderService $externalFolderService, - OutputService $outputService, - ConfigService $configService + ITimeFactory $time, + private CronService $cronService, + private PointService $pointService, + private PackService $packService, + private UploadService $uploadService, + private ExternalFolderService $externalFolderService, + private OutputService $outputService, + private ConfigService $configService ) { + parent::__construct($time); $this->setInterval(3600); - - $this->cronService = $cronService; - $this->pointService = $pointService; - $this->packService = $packService; - $this->uploadService = $uploadService; - $this->externalFolderService = $externalFolderService; - $this->outputService = $outputService; - $this->configService = $configService; }