3030use OC \Installer ;
3131use OC \Updater \VersionCheck ;
3232use OCP \App \IAppManager ;
33- use OCP \Http \ Client \ IClientService ;
33+ use OCP \BackgroundJob \ TimedJob ;
3434use OCP \IConfig ;
3535use OCP \IGroup ;
3636use OCP \IGroupManager ;
3939class BackgroundJob extends TimedJob {
4040 protected $ connectionNotifications = [3 , 7 , 14 , 30 ];
4141
42- /** @var IConfig */
43- protected $ config ;
44-
45- /** @var IManager */
46- protected $ notificationManager ;
47-
48- /** @var IGroupManager */
49- protected $ groupManager ;
50-
51- /** @var IAppManager */
52- protected $ appManager ;
53-
54- /** @var IClientService */
55- protected $ client ;
56-
57- /** @var Installer */
58- protected $ installer ;
59-
6042 /** @var string[] */
6143 protected $ users ;
6244
63- public function __construct (IConfig $ config ,
64- IManager $ notificationManager ,
65- IGroupManager $ groupManager ,
66- IAppManager $ appManager ,
67- IClientService $ client ,
68- Installer $ installer ) {
45+ public function __construct (
46+ protected IConfig $ config ,
47+ protected IManager $ notificationManager ,
48+ protected IGroupManager $ groupManager ,
49+ protected IAppManager $ appManager ,
50+ protected Installer $ installer ,
51+ protected VersionCheck $ versionCheck ,
52+ ) {
6953 // Run once a day
7054 $ this ->setInterval (60 * 60 * 24 );
71-
72- $ this ->config = $ config ;
73- $ this ->notificationManager = $ notificationManager ;
74- $ this ->groupManager = $ groupManager ;
75- $ this ->appManager = $ appManager ;
76- $ this ->client = $ client ;
77- $ this ->installer = $ installer ;
7855 }
7956
8057 protected function run ($ argument ) {
@@ -101,12 +78,10 @@ protected function checkCoreUpdate() {
10178 return ;
10279 }
10380
104- $ updater = $ this ->createVersionCheck ();
105-
106- $ status = $ updater ->check ();
81+ $ status = $ this ->versionCheck ->check ();
10782 if ($ status === false ) {
108- $ errors = 1 + (int ) $ this ->config ->getAppValue ('updatenotification ' , 'update_check_errors ' , 0 );
109- $ this ->config ->setAppValue ('updatenotification ' , 'update_check_errors ' , $ errors );
83+ $ errors = 1 + (int ) $ this ->config ->getAppValue ('updatenotification ' , 'update_check_errors ' , ' 0 ' );
84+ $ this ->config ->setAppValue ('updatenotification ' , 'update_check_errors ' , ( string ) $ errors );
11085
11186 if (\in_array ($ errors , $ this ->connectionNotifications , true )) {
11287 $ this ->sendErrorNotifications ($ errors );
@@ -255,16 +230,6 @@ protected function deleteOutdatedNotifications($app, $version) {
255230 $ this ->notificationManager ->markProcessed ($ notification );
256231 }
257232
258- /**
259- * @return VersionCheck
260- */
261- protected function createVersionCheck (): VersionCheck {
262- return new VersionCheck (
263- $ this ->client ,
264- $ this ->config
265- );
266- }
267-
268233 /**
269234 * @return string
270235 */
0 commit comments