Skip to content

Commit

Permalink
Adding a method to stop and exit safely the application
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrice Luraine committed Jul 18, 2009
1 parent 82741a9 commit 4fac3d0
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions lib/limonade.php
Expand Up @@ -382,9 +382,7 @@ function render_limonade_file()
{
echo after(error_notices_render() . $output);
}
flash_sweeper();
if(defined('SID')) session_write_close();
exit;
stop_and_exit();
}
else halt(SERVER_ERROR, "Routing error: undefined function '{$route['function']}'", $route);
}
Expand All @@ -395,6 +393,19 @@ function render_limonade_file()

}

/**
* Stop and exit limonade application
*
* @access private
* @return void
*/
function stop_and_exit()
{
flash_sweeper();
if(defined('SID')) session_write_close();
exit;
}

/**
* Returns limonade environment variables:
*
Expand Down Expand Up @@ -578,8 +589,7 @@ function error_handler_dispatcher($errno, $errstr, $errfile, $errline)
}
}
echo error_default_handler($errno, $errstr, $errfile, $errline);
if(defined('SID')) session_write_close();
exit;
stop_and_exit();
}
}

Expand Down Expand Up @@ -1523,7 +1533,7 @@ function flash_now($name = null, $value = null)
/**
* Delete current flash messages in session, and set new ones stored with
* flash function.
* Called before application exits.
* Called before application exit.
*
* @access private
* @return void
Expand Down

0 comments on commit 4fac3d0

Please sign in to comment.