Skip to content

Commit 976ca45

Browse files
Merge pull request chriskacerguis#307 from ricick/continue
added continue option to response for post return processes
2 parents a270a92 + c5d1b3f commit 976ca45

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

application/libraries/REST_Controller.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,13 @@ protected function _fire_method($method, $args)
435435
* Response
436436
*
437437
* Takes pure data and optionally a status code, then creates the response.
438+
* Set $continue to true to flush the response to the client and continue running the script.
438439
*
439440
* @param array $data
440441
* @param null|int $http_code
442+
* @param bool $continue
441443
*/
442-
public function response($data = null, $http_code = null)
444+
public function response($data = null, $http_code = null, $continue = false)
443445
{
444446
global $CFG;
445447

@@ -502,7 +504,14 @@ public function response($data = null, $http_code = null)
502504
header('Content-Length: ' . strlen($output));
503505
}
504506

505-
exit($output);
507+
if($continue){
508+
echo($output);
509+
ob_end_flush();
510+
ob_flush();
511+
flush();
512+
}else{
513+
exit($output);
514+
}
506515
}
507516

508517
/*

0 commit comments

Comments
 (0)