]> git.mxchange.org Git - friendica.git/blobdiff - bin/worker.php
Merge pull request #11107 from annando/api-oauth
[friendica.git] / bin / worker.php
index a39d04963222ff61bd3d61dc5f295a7301f06823..877f1333e040d37fd1e221afe4c42e5e58082214 100755 (executable)
  * Starts the background processing
  */
 
-use Friendica\Network\HTTPException\ForbiddenException;
-
 if (php_sapi_name() !== 'cli') {
-       throw new ForbiddenException();
+       header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
+       exit();
 }
 
 use Dice\Dice;
@@ -82,8 +81,10 @@ if ($spawn) {
 
 $run_cron = !array_key_exists('n', $options) && !array_key_exists('no_cron', $options);
 
-Worker::processQueue($run_cron);
+$process = DI::process()->create(getmypid(), basename(__FILE__));
+
+Worker::processQueue($run_cron, $process);
 
-Worker::unclaimProcess();
+Worker::unclaimProcess($process);
 
-DI::process()->end();
+DI::process()->delete($process);