File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 55use App \Console \Traits \RequestTargetVersion ;
66use App \Jobs \UpdateSite ;
77use App \Models \Site ;
8+ use Carbon \Carbon ;
89use Illuminate \Console \Command ;
910use Illuminate \Database \Eloquent \Collection ;
1011
@@ -42,22 +43,31 @@ public function handle(): int
4243
4344 $ this ->output ->writeln ('Pushing update jobs ' );
4445
45- // Get update-ready sites in correct major branch that are not yet on the target version
46+ // Get update-ready sites... that are not yet on the target version
4647 $ sites = Site::query ()
48+ // ... in correct major version branch
4749 ->where (
4850 'cms_version ' ,
4951 'like ' ,
5052 $ this ->targetVersion [0 ] . '% '
5153 )
54+ // ... that are not yet on the target version
55+ ->where (
56+ 'cms_version ' ,
57+ '!= ' ,
58+ $ this ->targetVersion
59+ )
60+ // ... that match the update requirements
5261 ->where (
5362 'update_requirement_state ' ,
5463 '= ' ,
5564 1
5665 )
66+ // ... that have been seen in the last two health check cycles
5767 ->where (
58- 'cms_version ' ,
59- '!= ' ,
60- $ this -> targetVersion
68+ 'last_seen ' ,
69+ '> ' ,
70+ Carbon:: now ()-> subHours (( int ) config ( ' autoupdates.healthcheck_interval ' ) * 2 ) // @phpstan-ignore-line
6171 );
6272
6373 // Query the amount of sites to be updated
You can’t perform that action at this time.
0 commit comments