News:

Wondering if this will always be free?  See why free is better.

Main Menu

SMF MediaWiki integration released

Started by SleePy, December 05, 2011, 11:40:48 PM

Previous topic - Next topic

Shadra

You are right, the SMF doesn't know something about the wiki, I add a new Tab and it's okay.

I tested the thing with subdomain cookies and I can login at my SMF without any error. But the MW give me new warnings: "session_name() [function.session-name.php]: hxxp:session.name [nonactive] cannot be numeric or empty " in /home/restofthepath/folder/wiki/extensions/Auth_SMF.php on line 333" and "session_destroy () [function.session-destroy.php]: Trying to destroy uninitialized session in /home/restofthepath/folder/wiki/extensions/Auth_SMF.php on line 334"

This is the function
function UserLogoutSMF (&$user)
{
global $wgCookiePrefix, $wgSessionName;

// Log them out of wiki first.
$user->doLogout();

// Destory their session.
$wgCookiePrefix = strtr($wgCookiePrefix, "=,; +.\"'\\[", "__________");
$old_session = session_name(isset($wgSessionName) ? $wgSessionName : $wgCookiePrefix . '_session');
session_destroy();

// Destroy the cookie!
    $params = session_get_cookie_params();
    setcookie(session_name(), '', time() - 42000, $params['path'], $params['domain'], $params['secure'], $params['httponly']);

// Back to whatever we had (we hope mediawiki).
session_name($old_session);

// Now SMFs turn.
smf_sessionSetup();

// This means we have no SMF session data or unable to find it.
if (empty($_SESSION['session_var']))
return true;

smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['session_value']);
}


Line 333 and 334 are
   $old_session = session_name(isset($wgSessionName) ? $wgSessionName : $wgCookiePrefix . '_session');
   session_destroy();


I changed in the localsettings.php the domain cookie from ".mydomain.com" to "mydomain.com" and after reload the wiki I got only the first warning with line 333.

Shadra

Sorry for double post, but I tried some other things and they work. Actually I've the same problem like ekynox a few months earlier.

Quote from: eKyNoX on March 09, 2015, 09:46:06 AM
...cut from shadra...

Used another smf account (not admin), it still do not redirect back to wiki, but I'm logged with that account inside mediawiki.

So ... why my main smf admin account is not accepted ?
...cut from shadra...

So all members of my board can now start spaming the wiki, without me as admin/sysop.
I uncommented in the localsettings.php this two values:
$wgSMFGroupID = array(2);
$wgSMFAdminGroupID = array(1, 3);

But nothing works, my latin is at the end :(
But one thing is now clear: it's no longer a cookie problem, but something else is wrong or so.

cody

Has anybody been able to get this to work on mediawiki 1.25.x?

I'm getting the same session.name [nofollow] cannot be numeric or empty  error and not being able to logon

Shadra

As I wrote a post before yours:
I uncommented in the localsettings.php this two values:
$wgSMFGroupID = array(2);
$wgSMFAdminGroupID = array(1, 3);

And only "not administrator's" can use the mediawiki. I couldn't fix it, that I - as admin - can use the bridge as well and nobody from the SMF team cares about the broken bridge (very sad). eKyNoX had the problem as well and wrote about it in march 2015. Nobody has done something so far and I don't think it will happen any time soon.
You see, since august - my last post - nobody respond. Hopefully this will help you a little bit, but maybe you can fix it and publish it to the community. :)

cheers Shadra

SleePy

Shadra,
If you use $wgSMFGroupID, you need to specify all group ids that can access the wiki.  In SMF by default groups that have to exist:
1 = Administrators
2 = Global Moderators
3 = Moderators (pseudo type group that is only autofilled when viewing a board though)
After that you have the groups it creates by default with IDs 4 to 8 for some post based groups.

In the example, $wgSMFGroupID uses group ID 2, which are Global Moderators.  So only those who are Global Moderators will be able to use the wiki if you follow the example.

We don't make use of $wgSMFGroupID here, we actually use $wgSMFDenyGroupID and use the same group id provided in the example (4).  This prevents users with less than 10 posts from being able to login/modify the wiki and we do this as it offers us the best spam control on our wiki.  We usually can find and stop a spammer on the forums before they reach 10 posts, legit users usually can get past this in a short time and then are free to modify the wiki.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Shadra

Hi SleePy

I checked my MW Settings and set them to:
# Members in these SMF groups will not be allowed to sign into wiki.
# This is useful for denying access to wiki and a easy anti-spam
# method.  The group ID, which can be found in the url (;group=XXX)
# when viewing the group from the administrator control panel.
#$wgSMFDenyGroupID = array(4);

# Grant members of this SMF group(s) access to the wiki
# NOTE: The wgSMFDenyGroupID group supersedes this.
$wgSMFGroupID = array(4);

# Grant members of this SMF group(s) wiki sysop privileges
# NOTE: These members must be able to login to the wiki
$wgSMFAdminGroupID = array(1, 2);


So all users, including myself, should now have access to the wiki, but I've still the problem that my session don't work.

Warning: session_name() [function.session-name.php]: hxxp:session.name [nonactive] cannot be a numeric or empty '' /wiki/extensions/Auth_SMF.php on line 333
Warning: session_destroy() [function.session-destroy.php]: Trying to destroy uninitialized session in ' /wiki/extensions/Auth_SMF.php on line 333

function UserLogoutSMF (&$user)
{
global $wgCookiePrefix, $wgSessionName;

// Log them out of wiki first.
$user->doLogout();

// Destory their session.
$wgCookiePrefix = strtr($wgCookiePrefix, "=,; +.\"'\\[", "__________");
$old_session = session_name(isset($wgSessionName) ? $wgSessionName : $wgCookiePrefix . '_session');
session_destroy();

// Destroy the cookie!
    $params = session_get_cookie_params();
    setcookie(session_name(), '', time() - 42000, $params['path'], $params['domain'], $params['secure'], $params['httponly']);

// Back to whatever we had (we hope mediawiki).
session_name($old_session);

// Now SMFs turn.
smf_sessionSetup();

// This means we have no SMF session data or unable to find it.
if (empty($_SESSION['session_var']))
return true;

smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['session_value']);
}


I'm loged in on my board, but as user that doesn't matter, because I'm automaticly loged in on the wiki, too. But not as admin.

wintstar

I have a problem with this bridge. I have, I think, already tried all options. In the MediaWiki Forum members are not detected. It can not log any in the MediaWiki. There are only the standard groups of the Forum.
The Forum and the MediaWiki lying on the sub domain wwx.unterdomain.hauptdomain.dev.
The root of the MediaWiki is as subfolder of the root of the forum. Both use the same database.

smf-mw-auth from here => https://github.com/SimpleMachines/smf-mw-auth
SMF 2.0.11
MediaWiki 1.26.2
PHP     5.5.31 (cgi-fcgi)
MySQL     5.5.47-log

Setting of the Forum
Enable local storage of cookies = no active
HelpUse subdomain independent cookies = no active
Use database driven sessions = active

and tested with
Enable local storage of cookies = active
HelpUse subdomain independent cookies = no active
Use database driven sessions = active

and tested with
Enable local storage of cookies = no active
HelpUse subdomain independent cookies = active
Use database driven sessions = active

and tested with
Enable local storage of cookies = active
HelpUse subdomain independent cookies = active
Use database driven sessions = active 

Setting of the MediaWiki
# This requires a user be logged into the wiki to make changes.
$wgGroupPermissions['*']['edit'] = true; // MediaWiki Setting

and tested with
# This requires a user be logged into the wiki to make changes.
#$wgGroupPermissions['*']['edit'] = true; // MediaWiki Setting

# Use SMF's login system to automatically log you in/out of the wiki
# This works best if you are using SMF database sessions (default).
# Make sure "Use database driven sessions" is checked in the
# SMF Admin -> Server Settings -> Feature Configuration section
# NOTE: Make sure to configure the $wgCookieDomain below
#$wgSMFLogin = true;
$wgCookieDomain = 'hauptdomain.dev';
and tested it with
$wgCookieDomain = 'unterdomain.hauptdomain.dev';
Regards Stephan

,,In order for the possible to come into being, the impossible must be attempted again and again."
Hermann Hesse (1877-1962)

My HomepageMy Board - My Atelier

Biology Forums

When installing mediawiki, does it have to be in the same database as SMF?

SleePy

It does not.  The auth will however use SMF's database credentials to authenticate a user.  Their is no need for cross database permissions.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Biology Forums

Thank you for clarifying. I tried installing mediawiki 1.26, but they have a different system for calling extensions. Where can I find the updated version, the json file, required to install this extension?

The old method of requiring a file via localsettings.php changed after 1.25, I believe.

SleePy

You can still use the old LocalSettings.php modifications.  I haven't had time to update it properly to use the json requirements.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Biology Forums

Quote from: SleePy on July 09, 2017, 09:36:18 PM
You can still use the old LocalSettings.php modifications.  I haven't had time to update it properly to use the json requirements.


Hi SleePy, you can't from when I tried. You'd need to create a new JSON file for the extension.

I went ahead and used the 1.24.6 version anyway. If you get a chance please let us know

SleePy

If you look at our wiki, we are using 1.27.3 and still loading the integration via LocalSettings.php modifications.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

XanoKais

Just a note to those who may be stumbling in getting the cookie to carry over (MediaWiki continuously showing log in).  I was able to resolve it by pulling down the July 2014 version of the Auth_SMF.php file and using that rather than the Fix #12 version from July 2017.

This was on SMF 2.0.14 and MW 1.27.3 LTS. 


nemwar

Hello,

i can't get the bridge to work,

I've installed the last version of SMF 2 (2.0.14) and the MediaWiki 1.29.1 (incl. the bluespice add-on).

After editing all files for the bridge i can't login into the wiki.
It didn't work for the admin and also for a new member i created for testing reason.

It would be great if somebody could help me.

Regards
NemWar

You like Guild Wars?
You still play Guild Wars?
Then you may like to visit my website:
Guild Wars Characters Reloaded

Marketing Hallo Welt!

Hello Nemwar,

BlueSpice doesn't support MediaWiki 1.29.
It supports the latest Long Term Support (LTS) version 1.27. That is most probably the reason.

You can find all system requirements at the BlueSpice Helpdesk (Setup Portal).

The next supported LTS version will be 1.31, which is announced by the Wikimedia Foundation for 2018.

Best regards!
Richard

grzeg8102

Hi guys,
This seems to be the right topic for me and I hope you can help.

Recently I installed MediaWiki 1.30 and wanted to integrate its users with SMF 2.0.15. So I basically want MW to use SMF user accounts for authentication, so no new accounts have to be created.

I tried SMF extensions listed in hte MW Extensions page: hxxp:www.mediawiki.org/wiki/Category:Simple_machines_forum_extensions [nonactive] but they are very old. Most of them are already not available (sites do not exist anymore) and the rest just doesn't work with SMF. I'm getting error after an error. Not even able to see the logon page. By the source code it seems the ones I found do not support SMF 2.0.

Does anyone from you have a MW extension for SMF 2.0 that just works? Like I download it, install it, configure e.g. in LocalSettings and job done? I'm not able to resolve all these incompatibility issues in PHP code by  myself.

Please help!

NoxiousNoxy

Quote from: emanuele on November 04, 2013, 09:34:31 AM
...
Quote from: SleePy on July 11, 2017, 08:50:53 PM
...

Hi all,
I have the same problem that a few previous have had in that I have setup the auth and local correctly (to my knowledge) and when i click on "login" in the wiki it redirects me to the SMF login, after login I redirect back to the wiki but I am not logged in at all.

I have posted a help topic within MW but that hasn't had any hits.
It does, however, have more information. So please refer to it.
mediawiki.org/wiki/Topic:Ud5w2egnyevk1r1o

I would really appreciate any help. I have gone through the code line by line, function by function, and created alerts to find out where it possibly drops out but with no luck. I'm still with the same original issue of not being able to actually use SMF to login to the wiki...


Mike Bobbitt

Hi all, sorry for the necropost, just checking to see if this extension still works with the current releases. I'm using mediawiki-1.33.4-1.fc32.noarch and SMF 2.0.17 but get HTTP 500 errors as soon as I enable the extension. Am I chasing a dead end?

Thanks

Advertisement: