MediaWiki 1.22-会话存储 [英] MediaWiki 1.22 - Session Storage

查看:113
本文介绍了MediaWiki 1.22-会话存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用MySQL作为MediaWiki的会话存储.

I am trying to use MySQL as session storage for MediaWiki.

我添加了:

$wgSessionHandler = 'session_mysql';

到"LocalSettings.php",但我在关联的MySQL DB中找不到任何会话表.

to "LocalSettings.php", but I can't find any session table in associated MySQL DB.

推荐答案

如果设置$wgSessionHandler = 'session_mysql';,则要求PHP在内部使用MySQL后端(而不是默认文件后端)管理会话.在这种情况下,您必须自己安装和配置此MySQL后端(通过快速搜索我发现

If you set $wgSessionHandler = 'session_mysql';, you ask PHP to internally manage the sessions with a MySQL backend instead of the default file backend. In this case, you have to install and configure this MySQL backend yourself (by quickly searching I found https://github.com/repoforge/rpms/blob/master/specs/php-pecl-session_mysql/php-pecl-session_mysql.spec but this package seems quite old). In particular, you will have to choose the host, user, database and table to store your sessions.

相反,应您的要求,我建议将MediaWiki会话缓存管理器与MySQL后端一起使用.这将执行与先前解决方案相同的操作,但是已正确地集成到MediaWiki中.要实现此行为,请在您的LocalSettings.php中编写:

Instead, for your request, I suggest using the MediaWiki session cache manager with the MySQL backend. This will do the same thing as the previous solution, but this is properly integrated in MediaWiki. To achieve this behaviour, write in your LocalSettings.php:

$wgSessionsInObjectCache = true; # MW internal session cache management
                                 # takes precedence over PHP management
$wgSessionCacheType = CACHE_DB; # See documentation for other backends
$wgObjectCacheSessionExpiry = 3600; # Default lifetime of the sessions

似乎它不适用于SQLite,但适用于MySQL.在此缓存中,您可以检查表objectcache,其中其他可能的缓存对象中还有名为wikiID:session:sessionsID的键.

It seems it doesn’t work with SQLite, but it works well with MySQL. In this cache, you can inspect the table objectcache where there are keys named wikiID:session:sessionsID among other possible cached objects.

这篇关于MediaWiki 1.22-会话存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆