other: use direct for places setup

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/602/head
Varun Patil 2023-04-20 13:28:45 -07:00
parent 01c82dfe1b
commit fe766ce30e
1 changed files with 19 additions and 19 deletions

View File

@ -207,28 +207,28 @@ class OtherController extends GenericApiController
// Reset action token // Reset action token
$this->actionToken(true); $this->actionToken(true);
try { return Util::guardExDirect(function (Http\IOutput $out) {
// Set PHP timeout to infinite try {
set_time_limit(0); // Set PHP timeout to infinite
set_time_limit(0);
// Send headers for long-running request // Send headers for long-running request
header('Content-Type: text/plain'); $out->setHeader('Content-Type: text/plain');
header('X-Accel-Buffering: no'); $out->setHeader('X-Accel-Buffering: no');
header('Cache-Control: no-cache'); $out->setHeader('Cache-Control: no-cache');
header('Connection: keep-alive'); $out->setHeader('Connection: keep-alive');
header('Content-Length: 0'); $out->setHeader('Content-Length: 0');
$places = \OC::$server->get(\OCA\Memories\Service\Places::class); $places = \OC::$server->get(\OCA\Memories\Service\Places::class);
$datafile = $places->downloadPlanet(); $datafile = $places->downloadPlanet();
$places->importPlanet($datafile); $places->importPlanet($datafile);
$places->recalculateAll(); $places->recalculateAll();
echo "Done.\n"; $out->setOutput("Done.\n");
} catch (\Exception $e) { } catch (\Exception $e) {
echo 'Failed: '.$e->getMessage()."\n"; $out->setOutput('Failed: '.$e->getMessage()."\n");
} }
});
exit;
} }
/** /**