Permalink
Browse files

[kernel] lazy event notify processing

After having returned response data to a client, event notify processing
is carried out.
  • Loading branch information...
nao-pon committed Apr 7, 2015
1 parent 2719761 commit ffb59463af16d1818a3cdae0ea215b632284e29e
Showing with 22 additions and 1 deletion.
  1. +22 −1 html/kernel/notification.php
@@ -87,11 +87,32 @@ function XoopsNotification()
* @param string $template Template name
* @param string $subject Subject line for notification message
* @param array $tags Array of substitutions for template variables
* @param bool $onshutdown For lazy execution on shutdown
*
* @return bool true if success, false if error
**/
function notifyUser($template_dir, $template, $subject, $tags)
function notifyUser($template_dir, $template, $subject, $tags, $onshutdown = false)
{
if (! $onshutdown) {
// regist as shutdown function
ignore_user_abort(true);
register_shutdown_function(array($this, 'notifyUser'), $template_dir, $template, $subject, $tags, true);
return true;
}
// execution at onshutdown
// push current output all the way to the browser
header('Connection: close', true);
while (ob_get_level()){
$len = ob_get_length();
if ($len !== false) {
header('Content-Length: '.$len, true);
}
@ob_end_flush();
}
flush();
// Check the user's notification preference.
$member_handler = xoops_gethandler('member');

0 comments on commit ffb5946

Please sign in to comment.