我想禁用我 Joomla 网站的所有访客 Cookie。
我找到了一些教程,但它们是针对 Joomla 版本:1.x 的。
有什么建议吗?
public function checkSession()
{
if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){ // added condition
$db = \JFactory::getDbo();
$session = \JFactory::getSession();
$user = \JFactory::getUser();
// ... rest of code
}
}
private function doSessionStart()
{
if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){ // added condition
// Register our function as shutdown method, so we can manipulate it
register_shutdown_function(array($this, 'save'));
// ... rest of code
}
}
这在Joomla 3.8.2中有效。
注意:每次Joomla更新后,您必须再次编辑这两个文件,并测试此解决方案是否仍然有效。
checkSession()
在3.8.8中有所不同。 - balpingFirst of all: Deactivate site statistics! Global configuration -> Statistics -> Statistics: No. This will stop the "mosvisitor" cookie.
Don't use the Template Chooser module, because it uses a cookie named "jos_user_template".
Be careful with components: Some might start their own PHP session.
Now to the main point: comment out line 697 of /includes/joomla.php like this:
// setcookie( $sessionCookieName, '-', false, '/' );
// session_start();
这似乎是旧版本的一个遗留问题。
Set-Cookie
HTTP头。此外,我还遵循了这个 ,虽然它本身并不能解决问题,但可以在一定程度上减少数据库负载。虽然我对此不太满意,但总比没有好。 - balping