Advertisement:

Author Topic: SMF MediaWiki integration released  (Read 275514 times)

Offline Shadra

  • Newbie
  • *
  • Posts: 7
Re: SMF MediaWiki integration released
« Reply #200 on: July 31, 2015, 05:15:49 AM »
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]: session.name 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
Code: [Select]
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.

Offline Shadra

  • Newbie
  • *
  • Posts: 7
Re: SMF MediaWiki integration released
« Reply #201 on: August 03, 2015, 07:12:51 AM »
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.

...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.

Offline cody

  • Semi-Newbie
  • *
  • Posts: 12
Re: SMF MediaWiki integration released
« Reply #202 on: December 07, 2015, 01:18:43 PM »
Has anybody been able to get this to work on mediawiki 1.25.x?

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

Offline Shadra

  • Newbie
  • *
  • Posts: 7
Re: SMF MediaWiki integration released
« Reply #203 on: December 14, 2015, 11:14:20 AM »
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

Offline SleePy

  • Site Team Lead
  • SMF Master
  • *
  • Posts: 29,771
  • Gender: Male
  • Thats his happy face.
    • jdarwood007 on GitHub
    • @jdarwood on Twitter
    • SleePy Code - My personal site
Re: SMF MediaWiki integration released
« Reply #204 on: December 24, 2015, 07:06:23 PM »
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
Support the SMF Support team!
Profiles:
GitHub
G+

Offline Shadra

  • Newbie
  • *
  • Posts: 7
Re: SMF MediaWiki integration released
« Reply #205 on: January 06, 2016, 04:50:00 AM »
Hi SleePy

I checked my MW Settings and set them to:
Code: [Select]
# 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]: session.name 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

Code: [Select]
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.

Offline wintstar

  • Semi-Newbie
  • *
  • Posts: 87
  • Carpe diem!
    • Scaricare Experiri
Re: SMF MediaWiki integration released
« Reply #206 on: February 13, 2016, 12:49:58 PM »
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';

Offline Stylus

  • SMF Hero
  • ******
  • Posts: 3,046
    • BiologyDiscussionForums on Facebook
    • @bioforumsblog on Twitter
    • Biology Forums - Master Your Courses
Re: SMF MediaWiki integration released
« Reply #207 on: July 07, 2017, 03:06:07 PM »
When installing mediawiki, does it have to be in the same database as SMF?

Offline SleePy

  • Site Team Lead
  • SMF Master
  • *
  • Posts: 29,771
  • Gender: Male
  • Thats his happy face.
    • jdarwood007 on GitHub
    • @jdarwood on Twitter
    • SleePy Code - My personal site
Re: SMF MediaWiki integration released
« Reply #208 on: July 07, 2017, 08:06:38 PM »
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
Support the SMF Support team!
Profiles:
GitHub
G+

Offline Stylus

  • SMF Hero
  • ******
  • Posts: 3,046
    • BiologyDiscussionForums on Facebook
    • @bioforumsblog on Twitter
    • Biology Forums - Master Your Courses
Re: SMF MediaWiki integration released
« Reply #209 on: July 09, 2017, 11:38:59 AM »
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.

Offline SleePy

  • Site Team Lead
  • SMF Master
  • *
  • Posts: 29,771
  • Gender: Male
  • Thats his happy face.
    • jdarwood007 on GitHub
    • @jdarwood on Twitter
    • SleePy Code - My personal site
Re: SMF MediaWiki integration released
« Reply #210 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.
Jeremy D — Site Team / SMF Developer
Support the SMF Support team!
Profiles:
GitHub
G+

Offline Stylus

  • SMF Hero
  • ******
  • Posts: 3,046
    • BiologyDiscussionForums on Facebook
    • @bioforumsblog on Twitter
    • Biology Forums - Master Your Courses
Re: SMF MediaWiki integration released
« Reply #211 on: July 09, 2017, 11:37:41 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

Offline SleePy

  • Site Team Lead
  • SMF Master
  • *
  • Posts: 29,771
  • Gender: Male
  • Thats his happy face.
    • jdarwood007 on GitHub
    • @jdarwood on Twitter
    • SleePy Code - My personal site
Re: SMF MediaWiki integration released
« Reply #212 on: July 11, 2017, 08:50:53 PM »
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
Support the SMF Support team!
Profiles:
GitHub
G+

Offline XanoKais

  • Newbie
  • *
  • Posts: 6
Re: SMF MediaWiki integration released
« Reply #213 on: Yesterday at 10:06:16 AM »
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.