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