How to call upgrade.php/run via CURL (for Installatron)

I work for Installatron (http://installatron.com/), a webhosting application auto-installer that has been installing Drupal since 2004. I’m just updating the installer to support 8.4.2 but I’m having some difficulty with the upgrade process.

To quickly explain Installatron’s system a bit, Installatron uses scripted sequences to perform install and upgrade tasks, where the scripting is comprised of commands like ‘extract archive’, ‘delete file’, ‘chmod this to some value’, ‘edit this file’ and so on. I have the upgrade script started but I can see that this upgrade to 8.4.x wants to run “upgrade.php/run” before it considers the upgrade complete.

I have tried calling that script with a simple CURL fetch, without success, and have also tried calling it via an intermediary php script like this:

<?php
$path = '.var_export($this->path,true).';
$url = '.var_export($this->url,true).';
chdir($path);
$_REQUEST["op"] = "run";

for($x = 0; $x < 400; $x++)
{
	$ch = curl_init(); 
	curl_setopt($ch, CURLOPT_URL, $url."/update.php/run");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$output = curl_exec($ch);
	curl_close($ch);
	file_put_contents(".htupdate_new{$x}.txt", $output);
}
?>

From that last example, if I then check the output from each loop of that call I see this sort of things:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="1;url=[...]/update.php/start?id=401&amp;op=start" />

<title>Redirecting to http://[...]/update.php/start?id=401&amp;op=start</title>
</head>
<body>
Redirecting to <a href="http://[...]/update.php/start?id=401&amp;op=start">http://[...]/update.php/start?id=401&amp;op=start</a>.
</body>
</html>

The output changes each loop, but only because the id=401 number increments. So it gives the impression that it is working through some sort of multi-step upgrade process, but I’m guessing that if it hasn’t finished by step 401 that it’s never going to finish. And even with this many steps now performed the ‘check’ tool in Drupal admin backend still reports the same number of problems in need of database upgrading, suggesting that this loop hasn’t performed anything up to this point.

Does anyone happen to have any thoughts on how I might be able to run this database/plugins update process via a curl http call?

Any advice appreciated.
Rowan.
@Installatron.com

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/21/feed