File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 88use App \Models \Site ;
99use App \RemoteSite \Connection ;
1010use App \RemoteSite \Responses \PrepareUpdate ;
11+ use GuzzleHttp \Client ;
1112use GuzzleHttp \Exception \RequestException ;
1213use Illuminate \Contracts \Queue \ShouldQueue ;
1314use Illuminate \Foundation \Queue \Queueable ;
@@ -96,6 +97,9 @@ public function handle(): void
9697
9798 $ prepareResult = $ connection ->prepareUpdate (["targetVersion " => $ this ->targetVersion ]);
9899
100+ // Perform additional preparation calls
101+ $ this ->performExtraPreparations ($ prepareResult );
102+
99103 // Perform the actual extraction
100104 try {
101105 $ this ->performExtraction ($ prepareResult );
@@ -131,6 +135,29 @@ public function handle(): void
131135 CheckSiteHealth::dispatch ($ this ->site );
132136 }
133137
138+ protected function performExtraPreparations (PrepareUpdate $ prepareResult ): void
139+ {
140+ if (!count ($ prepareResult ->preparationUrls )) {
141+ return ;
142+ }
143+
144+ /** @var Client $httpClient */
145+ $ httpClient = App::make (Client::class);
146+
147+ // Call each preparation URL
148+ foreach ($ prepareResult ->preparationUrls as $ url ) {
149+ $ httpClient ->get (
150+ $ url ,
151+ [
152+ 'timeout ' => 30.0 ,
153+ 'allow_redirects ' => [
154+ 'max ' => 100
155+ ]
156+ ]
157+ );
158+ }
159+ }
160+
134161 protected function performExtraction (PrepareUpdate $ prepareResult ): void
135162 {
136163 /** Create a separate connection with the extraction password **/
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ class PrepareUpdate extends BaseDTO implements ResponseInterface
88{
99 public function __construct (
1010 public string $ password ,
11- public int $ filesize
11+ public int $ filesize ,
12+ public array $ preparationUrls = []
1213 ) {
1314 }
1415}
You can’t perform that action at this time.
0 commit comments