File tree Expand file tree Collapse file tree 2 files changed +32
-2
lines changed
Expand file tree Collapse file tree 2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ public function __construct(
5757 }
5858
5959 protected function run ($ argument ) {
60+ // Do not check for updates if not connected to the internet
61+ if (!$ this ->config ->getSystemValueBool ('has_internet_connection ' , true )) {
62+ return ;
63+ }
64+
6065 if (\OC ::$ CLI && !$ this ->config ->getSystemValueBool ('debug ' , false )) {
6166 try {
6267 // Jitter the pinging of the updater server and the appstore a bit.
Original file line number Diff line number Diff line change @@ -112,9 +112,34 @@ public function testRun() {
112112 $ job ->expects ($ this ->once ())
113113 ->method ('checkAppUpdates ' );
114114
115+ $ this ->config ->expects ($ this ->exactly (2 ))
116+ ->method ('getSystemValueBool ' )
117+ ->withConsecutive (
118+ ['has_internet_connection ' , true ],
119+ ['debug ' , false ],
120+ )
121+ ->willReturnOnConsecutiveCalls (
122+ true ,
123+ true ,
124+ );
125+
126+ self ::invokePrivate ($ job , 'run ' , [null ]);
127+ }
128+
129+ public function testRunNoInternet () {
130+ $ job = $ this ->getJob ([
131+ 'checkCoreUpdate ' ,
132+ 'checkAppUpdates ' ,
133+ ]);
134+
135+ $ job ->expects ($ this ->never ())
136+ ->method ('checkCoreUpdate ' );
137+ $ job ->expects ($ this ->never ())
138+ ->method ('checkAppUpdates ' );
139+
115140 $ this ->config ->method ('getSystemValueBool ' )
116- ->with ('debug ' , false )
117- ->willReturn (true );
141+ ->with ('has_internet_connection ' , true )
142+ ->willReturn (false );
118143
119144 self ::invokePrivate ($ job , 'run ' , [null ]);
120145 }
You can’t perform that action at this time.
0 commit comments