try again with shutdown handler, fix issue #373 (live-pubstream div wasn't present

This commit is contained in:
redmatrix 2016-05-10 01:30:22 -07:00
parent baa7020036
commit 0c5434d5e3
4 changed files with 17 additions and 5 deletions

View File

@ -28,7 +28,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
if(! $maxheight) if(! $maxheight)
$maxheight = 400; $maxheight = 400;
$o .= '<div id="live-public"></div>' . "\r\n"; $o .= '<div id="live-pubstream"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1)) $o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1))
. "; var profile_page = " . \App::$pager['page'] . "; var profile_page = " . \App::$pager['page']
. "; divmore_height = " . intval($maxheight) . "; </script>\r\n"; . "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
@ -161,7 +161,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
if(($items) && (! $update)) if(($items) && (! $update))
$o .= alt_pager($a,count($items)); $o .= alt_pager($a,count($items));
return $o; return $o;
} }

View File

@ -7,7 +7,7 @@ namespace Zotlabs\Module;
class Update_pubstream extends \Zotlabs\Web\Controller { class Update_pubstream extends \Zotlabs\Web\Controller {
function get() { function get() {
$profile_uid = ((intval($_GET['p'])) ? intval($_GET['p']) : (-1)); $profile_uid = ((intval($_GET['p'])) ? intval($_GET['p']) : (-1));
$load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0); $load = (((argc() > 1) && (argv(1) == 'load')) ? 1 : 0);
header("Content-type: text/html"); header("Content-type: text/html");

View File

@ -31,7 +31,7 @@ class Session {
$handler = new \Zotlabs\Web\SessionHandler(); $handler = new \Zotlabs\Web\SessionHandler();
self::$handler = $handler; self::$handler = $handler;
$x = session_set_save_handler($handler,true); $x = session_set_save_handler($handler,false);
if(! $x) if(! $x)
logger('Session save handler initialisation failed.',LOGGER_NORMAL,LOG_ERR); logger('Session save handler initialisation failed.',LOGGER_NORMAL,LOG_ERR);
@ -46,6 +46,9 @@ class Session {
((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false), ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false),
((isset($arr['httponly'])) ? $arr['httponly'] : true) ((isset($arr['httponly'])) ? $arr['httponly'] : true)
); );
register_shutdown_function('session_write_close');
} }
function start() { function start() {

View File

@ -1633,7 +1633,16 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) {
* @brief Used to end the current process, after saving session state. * @brief Used to end the current process, after saving session state.
*/ */
function killme() { function killme() {
// register_shutdown_function('shutdown');
// Ensure that closing the database is the last function on the shutdown stack.
// If it is closed prematurely sessions might not get saved correctly.
// Note the second arg to PHP's session_set_save_handler() seems to order that shutdown
// procedure last despite our best efforts, so we don't use that and implictly
// call register_shutdown_function('session_write_close'); within Zotlabs\Web\Session::init()
// and then register the database close function here where nothing else can register
// after it.
register_shutdown_function('shutdown');
exit; exit;
} }