Set $$wgPHPSessionHandling to false to disable mediawiki using php sessions.

This seems to resolve the issue of mediawiki and smf sessions colliding, as mediawiki will no longer touch smf's session. The "loss of session data" error seems to still not be present.
This commit is contained in:
Adrian Malacoda 2018-08-27 03:32:14 -05:00
parent 72b7638d11
commit dcdb8ea4db
2 changed files with 12 additions and 9 deletions

View File

@ -1,8 +1,9 @@
<?php
$smf_session_data = [];
function loadSMFAPI ()
{
global $maintenance, $wgSMFPathSSI, $wgSMFPathAPI;
if (!defined("MW_NO_SESSION")) {
// Fix for SMF's sanitization breaking mediawiki page titles.
// Let mediawiki do its own security
@ -24,12 +25,6 @@ if (!defined("MW_NO_SESSION")) {
die("Could not load the SMF API");
}
// Clear SMF session data before starting MW session
if (!empty($user_info) && $user_info['id']) {
$smf_session_data = $_SESSION;
session_destroy();
}
$_GET = $tempGet;
if (!empty($oldMaintenance)) {
@ -37,6 +32,10 @@ if (!defined("MW_NO_SESSION")) {
}
}
if (!defined("MW_NO_SESSION")) {
loadSMFAPI();
}
if(!empty($user_info)) {
$wgAuthRemoteuserUserName = $user_info['username'];
@ -46,6 +45,6 @@ if(!empty($user_info)) {
];
$wgAuthRemoteuserUserUrls = [
'logout' => $wgSMFPath."/index.php?action=logout;sesc=" . session_id()
'logout' => $wgSMFURL . "/index.php?action=logout;" . $_SESSION['session_var'] . '=' . $_SESSION['session_value']
];
}

View File

@ -224,10 +224,14 @@ $wgCachePages = false;
wfLoadExtension("Auth_remoteuser");
$wgGroupPermissions['*']['autocreateaccount'] = true;
# Disable MediaWiki's PHP session handling since it conflicts with SMF's
$wgPHPSessionHandling = "disable";
# This requires the link to SMF API.
$wgSMFPathAPI= "/application/forums/smf_api.php"; # The smf_api.php file can be download from SMF website and must be placed in rootdir of your forum)
$wgSMFPathSSI= "/application/forums/SSI.php"; # The SSI.php file (watch capitals!) (normally in your rootdir of your forum)
$wgSMFPath = "/application/forums";
$wgSMFURL = getenv("GCL_FORUMS_URL") ?: "https://forums.glitchcity.info";
require_once("{$IP}/extensions/Auth_SMF.php");
//$wgAuthRemoteuserUserName = "Abwayax";