mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
changed api call to flush before call the api using response callback.
This commit is contained in:
parent
ab96e75968
commit
d1c97227f0
3 changed files with 26 additions and 8 deletions
|
@ -34,6 +34,7 @@ class Session
|
||||||
static::setNamespace(static::NAMESPACE_DEFAULT, $oldSession);
|
static::setNamespace(static::NAMESPACE_DEFAULT, $oldSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Response::addPostRenderCallback(function(){
|
||||||
$site_visitor_id = key_exists(static::USER_ID, $_SESSION) ? $_SESSION[static::USER_ID] : '';
|
$site_visitor_id = key_exists(static::USER_ID, $_SESSION) ? $_SESSION[static::USER_ID] : '';
|
||||||
$response = LBRY::logWebVisitor(static::SITE_ID, $site_visitor_id, $_SERVER['REMOTE_ADDR']);
|
$response = LBRY::logWebVisitor(static::SITE_ID, $site_visitor_id, $_SERVER['REMOTE_ADDR']);
|
||||||
if (!is_null($response)
|
if (!is_null($response)
|
||||||
|
@ -43,7 +44,7 @@ class Session
|
||||||
} else {
|
} else {
|
||||||
$_SESSION[static::USER_ID] = '';
|
$_SESSION[static::USER_ID] = '';
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
static::initFlashes();
|
static::initFlashes();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ class Response
|
||||||
protected static $metaImages = [];
|
protected static $metaImages = [];
|
||||||
protected static $facebookAnalyticsType = "PageView";
|
protected static $facebookAnalyticsType = "PageView";
|
||||||
|
|
||||||
|
private static $PostRenderCallbacks = array();
|
||||||
|
|
||||||
public static function setMetaDescription($description)
|
public static function setMetaDescription($description)
|
||||||
{
|
{
|
||||||
static::$metaDescription = $description;
|
static::$metaDescription = $description;
|
||||||
|
@ -369,6 +371,19 @@ class Response
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function addPostRenderCallback( $cb )
|
||||||
|
{
|
||||||
|
array_push(static::$PostRenderCallbacks, $cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function invokePostRenderCallbacks()
|
||||||
|
{
|
||||||
|
foreach(static::$PostRenderCallbacks as &$cb )
|
||||||
|
{
|
||||||
|
$cb();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// public static function addBodyCssClass($classOrClasses)
|
// public static function addBodyCssClass($classOrClasses)
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -28,6 +28,8 @@ try {
|
||||||
View::compileCss();
|
View::compileCss();
|
||||||
}
|
}
|
||||||
Controller::dispatch(Request::getRoutingUri());
|
Controller::dispatch(Request::getRoutingUri());
|
||||||
|
flush();
|
||||||
|
Response::invokePostRenderCallbacks();
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
if (IS_PRODUCTION) {
|
if (IS_PRODUCTION) {
|
||||||
Slack::sendErrorIfProd($e);
|
Slack::sendErrorIfProd($e);
|
||||||
|
|
Loading…
Add table
Reference in a new issue