PDA

View Full Version : Integration with vBulletin - MediaWiki Latest Additions & Changes


majorxp
03-18-2007, 10:00 PM
Last Updated Wiki pages block
Version 1.4

Purpose
This extension will list the last updated or new wiki entries.

It can be included as a vbAdvanced block or included wherever you desire. It was designed to be included in a vbAdvanced block for vBulletin. It also goes nicely with Nuhit's MediaWiki integration tool (https://vborg.vbsupport.ru/showthread.php?t=136242&highlight=nuhit) but is not required.


Requirements
This is only supported on MediaWiki 1.8.2 - 1.10. It might run on a lower version, but it hasn't been tested. It has been reported 1.12 not to function. If you are interested in updating this to support additional versions as they are released let me know and you can be a co-developer on this.

Warning
This is only designed for boards with less than 50 wiki page edits per minute. If you have more, it almost becomes a useless mod (and puts a senseless burden on the server).

No warranty other than this file will take up a few kb on your hard drive.


Instructions
Edit the setting where you want the created file (wikichanges.htm) placed
If you have a table prefix on your WIKI, then edit the sql to reflect your prefix
Place this file in the extensions directory in your wiki
add this line at the bottom of LocalSettings.php (before the "?>")

// Add last updates
require_once "$IP/extensions/makevbmodule.php";

Edit a wiki article
Browse to the file in your setting below to see if it worked
Add vbAdvanced block to include the file
Test links inside included page to ensure it works (you may have to edit depending upon your configuration)Upgrade Instuctions

Backup your old version
Edit the current version's settings locally
Replace the old version with the updated version with your settings
Edit a wiki article (to generate a new wikichanges.htm file)
Confirm new file generation
Demos
Here are some demos of the plugin. If you would like yours to be included, just post your url in the thread.
www.golegend.com (http://www.golegend.com/)
www.euro-chimaera.co.uk (http://www.euro-chimaera.co.uk/index.php)
PinataIsland.info (http://pinataisland.info/central.php)


Support
Support is limited to this forum and to those who click install (yes I can see who did). If you have any questions or find a bug, post it here. I spend time with my family on the weekends, so expect long waits then.


Versions
1.4 - Important bug fix. This fixes two issues:

Links to namespaces were not being included in links

Special or other undesirable pages being listed when updatedThis version correctly generates links and will only show updated articles, user pages, images, and categories.

1.3 -Added namespace for User pages (thanks jimmcq (https://vborg.vbsupport.ru/member.php?u=191339))
1.2 - Removed some personal code references
1.1 - Update with table prefix setting (thanks jimmcq (https://vborg.vbsupport.ru/member.php?u=191339))
1.0 - Initial Release

Keywords: MediaWiki, Wiki, vbAdvanced, vbWiki, Nuhit

Jon_Simmonds
03-19-2007, 04:54 PM
Thanks, this could prove usefull for me :)

jimmcq
03-19-2007, 08:49 PM
Nice work!

It looks like you need a make a couple of small updates though... You didn't add anything to put the prefix in front of the database table name (if there is a prefix), and you appear to the your own filepath (/legend/wiki/) hardcoded into the output.

After I changed those then it seemed to work just fine.

majorxp
03-19-2007, 09:57 PM
Thanks Jimmcq!

(don't forget to hit install)

jimmcq
03-19-2007, 10:01 PM
I'm new to vbAdvanced... How would I add wikichanges.htm to vbAdvanced?

majorxp
03-19-2007, 10:11 PM
Add a new module and choose wikichanges.htm from the drop-down box in "File to Include". Also make sure you choose "Yes" in "Clean File Output". Once you have the module added, simply choose what pages you want it to show up.

If the file doesn't show up under the drop-down, change the directory that the file is created in makevbmodule.php settings.

jimmcq
03-19-2007, 10:35 PM
That worked! Thanks! One other small change is that you appear to be missing the namespace in the title. What I mean is that a user page titled "User:majorxp" is just being linked as "majorxp".

Also (and this may not apply to everyone) but you may want to utf8_decode the title names for that special characters like ñ come out correctly.

majorxp
03-19-2007, 11:11 PM
added....I guess I have to manually add all the namespaces that would be used....

jimmcq
03-19-2007, 11:11 PM
I think you're going to need to do an actual db lookup of the namespaces... There are quite a few others that you haven't included such as Talk, User talk, Help, Image, {SITENAME}, MediaWiki, Template, etc.

I think the ordering could change and custom ones could be added, etc. so that's why they can't really be hardcoded.

majorxp
03-20-2007, 07:00 PM
updated instructions............

jimmcq
03-20-2007, 09:56 PM
for the namespace stuff, take a look at the 'makeTitle' function in the file includes/Title.php of MediaWiki

Pottsy
03-22-2007, 08:18 AM
Hi,

This looks good, but it only seems to pick up some changes (and not others) and I can't see why it's not picking up all.

I tried editing a page, and the change isn't shown. The earliest changes in the list are from a few days ago. I am using mw 1.6.8 - will that make any difference?

hinch
03-22-2007, 10:27 AM
installed and working perfectly thanks alot

http://www.euro-chimaera.co.uk/index.php

majorxp
03-22-2007, 02:27 PM
I tried editing a page, and the change isn't shown. The earliest changes in the list are from a few days ago. I am using mw 1.6.8 - will that make any difference?You bring up a good point about version compatibility. I haven't tested it on 1.6.8, so I don't know. I'm going to list 1.8.2 as the minimum version since that is the oldest version I have tested with.

Pottsy
03-22-2007, 10:07 PM
You bring up a good point about version compatibility. I haven't tested it on 1.6.8, so I don't know. I'm going to list 1.8.2 as the minimum version since that is the oldest version I have tested with.

Maybe... but your new ver 1.4 works well with 1.6.8. Thank you!

Atakan KOC
03-25-2007, 05:49 PM
Thanks....

majorxp
03-25-2007, 06:54 PM
Don't forget to click install! :)

jimmcq
04-01-2007, 06:55 PM
I'm using it at PinataIsland.info (http://pinataisland.info/central.php)

vprp
04-04-2007, 01:26 PM
When you add the following line at LocalSettings.php

// Add last updates
require_once "$IP/extensions/makevbmodule.php";

Do you add it after the <?php or before? Also, should I replace $IP and put the path?

ElfMage
04-05-2007, 12:49 PM
vprp, you should add the line

require_once "$IP/extensions/makevbmodule.php";

towards the end of the LocalSettings.php, before the ?>. Example:


// Add last updates
require_once "$IP/extensions/makevbmodule.php";
?>


You don't need to replace $IP, since MediaWiki defines it with the correct path to your wiki installation.

klaush
06-26-2007, 04:05 PM
Great stuff!

Please give me a hint, when the mediawiki is not located in the forum location and has another domain name...

For example the wiki is located under: www.mywiki.de and the url for the forum is www.myforum.de.

Any idea?

BlackxRam
07-31-2007, 05:44 PM
I have the same question. Can this be used to pull info from my Wiki or a Partner Wiki on a different domain? What would be needed to make that work?

Warlord
07-20-2008, 08:44 PM
Nice hack. Couple questions though...

If I want to edit the appearance of the file it generates, how do I do that?

I want to make the font smaller, the background a diff color and I want to put a line break in between the article and the username.

Also, when making is a module for vbadvanced, did you just put it in an iframe or something?

rwoscott
07-22-2008, 02:13 AM
This is beautiful.
Works FANTASTIC.

I have been contemplating how to do this for a while, but it's always been in the far too hard out of my league.

So thanks again.

majorxp
07-23-2008, 05:23 PM
Great stuff!

Please give me a hint, when the mediawiki is not located in the forum location and has another domain name...

For example the wiki is located under: www.mywiki.de (http://www.mywiki.de/) and the url for the forum is www.myforum.de (http://www.myforum.de/).

Any idea?Just update the vbadvanced to include the file at that location.



Nice hack. Couple questions though...

If I want to edit the appearance of the file it generates, how do I do that?

I want to make the font smaller, the background a diff color and I want to put a line break in between the article and the username.

Also, when making is a module for vbadvanced, did you just put it in an iframe or something?You would have to edit the code of the mod to change the appearance.

In vbadvanced, you can include the output file.





This is beautiful.
Works FANTASTIC.

I have been contemplating how to do this for a while, but it's always been in the far too hard out of my league.

So thanks again.My pleasure.

Warlord
07-24-2008, 03:59 PM
You would have to edit the code of the mod to change the appearance.

In vbadvanced, you can include the output file.


Yeah, I tried that, figured it would be no big deal, I just add the html code to make it appear the way I wanted, but kept getting errors no matter what I did. :( Guess I need to brush up on coding, it didn't like a lot of the characters I was using. I'm sure I'll figure it out though given enough time. Thought maybe there might just be an easy fix somewhere. Thanks

jimmcq
08-26-2008, 08:56 PM
Has this been updated to work with more recent versions of Mediawiki? Mediawiki 1.12.0 gave an "Internal Error" until I disabled this Add-on.

majorxp
08-26-2008, 09:12 PM
No. I'm using this with Nuhit's MediaWiki integration too, (https://vborg.vbsupport.ru/showthread.php?t=136242&highlight=nuhit) and that hasn't been updated so I have to stay for support on 1.8 only. If someone wants to take this on to update it to support 1.12, I would be happy to help, but I cannot take on a new project at this time.

I'll update the project notes to reflect this.

Jrain157
01-14-2009, 03:37 PM
Does this work if you're running the NuHIT Wiki 1.3 RC5 and no mediawiki?

majorxp
01-16-2009, 06:53 PM
Does this work if you're running the NuHIT Wiki 1.3 RC5 and no mediawiki?Nope. This uses a mediawiki hook to grab the data.

KrisP
01-22-2009, 05:55 AM
Major, I was hoping you could take a look at this error with mediawiki 1.13.3:

Detected bug in an extension! Hook UpdateBlock failed to return a value; should return true to continue hook processing or false to abort.

Backtrace:

#0 /var/www/vhosts/mydomain.com/httpdocs/wiki/includes/Article.php(1564): wfRunHooks('ArticleSaveComp...', Array)
#1 /var/www/vhosts/mydomain.com/httpdocs/wiki/includes/Article.php(1317): Article->doEdit('test5?gr?fe', '', 98)
#2 /var/www/vhosts/mydomain.com/httpdocs/wiki/includes/EditPage.php(997): Article->updateArticle('test5?gr?fe', '', false, false, false, '')
#3 /var/www/vhosts/mydomain.com/httpdocs/wiki/includes/EditPage.php(2274): EditPage->internalAttemptSave(false, false)
#4 /var/www/vhosts/mydomain.com/httpdocs/wiki/includes/EditPage.php(464): EditPage->attemptSave()
#5 /var/www/vhosts/mydomain.com/httpdocs/wiki/includes/EditPage.php(349): EditPage->edit()
#6 /var/www/vhosts/mydomain.com/httpdocs/wiki/includes/Wiki.php(492): EditPage->submit()
#7 /var/www/vhosts/mydomain.com/httpdocs/wiki/includes/Wiki.php(59): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
#8 /var/www/vhosts/mydomain.com/httpdocs/wiki/index.php(93): MediaWiki->initialize(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
#9 {main}

KrisP
01-22-2009, 08:20 AM
Isent it possible to make a bug trace on a finer level to see what actually goes wrong inside the Updateblock ?

KrisP
01-22-2009, 08:34 AM
The wikichanges.htm actully gets data on the following form:

<tr class="alt2"><td colspan="7"><span class="smallfont"><a href="/wiki/index.php?title=Test5" title="Test5">Test5</a> - by Euroman<BR></span></td></tr>

<tr class="alt1"><td colspan="7"><span class="smallfont"><a href="/wiki/index.php?title=Test3" title="Test3">Test3</a> - by Euroman<BR></span></td></tr>

<tr class="alt2"><td colspan="7"><span class="smallfont"><a href="/wiki/index.php?title=Teset1" title="Teset1">Teset1</a> - by Euroman<BR></span></td></tr><tr class="alt1">

etc.

KrisP
01-22-2009, 08:54 AM
Conclusion so far:

Mod is actully working as far as:

1. Output gets produced correctly in: wikichanges.htm
2. Also I can se page actully gets correctly updated with saved change

Only problem:
Error message after saving because updateblock is not "true".

Possible solution: Can we somehow define/set updateblock to "true" so we wont get the error message? It that is possible then mod is working 100 pt.

KrisP
01-22-2009, 09:47 AM
Here is the patch to mediawiki 1.13.3:

In makevbmodule.php:

After:

$wik = $wik . '</span>';
$fh = fopen($myFile, 'w') or die("Can't open file.");
fwrite($fh, $wik);
fclose($fh);


Add:


return true;



:D

KrisP
01-22-2009, 10:35 AM
Could anybody help me rewrite links to piniata style: http://pinataisland.info/index.php?title=Swanana&diff=24451&oldid=prev ? http://pinataisland.info/index.php?title=Swanana&diff=24451&oldid=prev

I believe the diff parameter can be fetched from recent changes as o.rc_this_oldid and refered to as $row['rc_this_oldid'] in url. Should be pretty easy, but I cant seem to get syntax right and I am not sure I understand conventions for use of ' vs. " ...

majorxp
01-23-2009, 02:12 AM
KrisP -

Looks like you found your answer!

I'm not really sure what exactly you are asking in post 36 though.

KrisP
01-23-2009, 07:55 PM
Well, if you look at the demo website http://pinataisland.info/central.php their recent wiki links are different. They point to a page where you can see the change of the article on the top of the page and the article itself on the bottom. I would like that too on my site.

majorxp
01-25-2009, 03:50 AM
most interesting idea........

I like that.

You can edit that by the code you found above...

KrisP
01-25-2009, 04:13 PM
Here is the code:

$query = "SELECT o.rc_this_oldid, ...

$wik = $wik . '<a href="/wiki/index.php?title=' . $row['rc_title'] . '&diff=' . $row['rc_this_oldid'] . '&oldid=prev' . '">' . $row['rc_title']. '</a>' . $new . ' - by ' . $row['rc_user_text'] . '<BR>';

optrex
01-27-2009, 03:35 AM
works great on 3.8 vb and 1.13.3 wiki with 3.1.0 vba

majorxp
02-19-2009, 06:22 PM
Thanks for the confirmation Optrex

ReCom
05-20-2009, 11:33 AM
Thanks for this mod.

I've modified your SQL query into this:

$query = "SELECT o.rc_title, o.rc_user_text, o.rc_new, o.rc_namespace, o.rc_timestamp FROM " . $prefix . "recentchanges o, (SELECT max(rc_timestamp) as xtimestamp, rc_title, rc_namespace FROM " . $prefix . "recentchanges WHERE ABS(rc_old_len - rc_new_len) > 20 AND rc_namespace IN (0,2,6,14) GROUP BY rc_title, rc_namespace) n WHERE o.rc_title = n.rc_title AND o.rc_namespace = n.rc_namespace AND o.rc_timestamp = n.xtimestamp ORDER BY rc_timestamp DESC LIMIT " . $results;

Improvements:

Namespace filtering is done in the nested SELECT
Articles with same titles but in different namespaces are not lumped together ("Category:Vehicles" and "Vehicles" are two different articles, are they not?)
filter out minute changes (detected by difference in articles length -- ABS(rc_old_len - rc_new_len) > 20 -- change 20 to minimum length difference)



.. and here is how I made the output list into more than one column:


// set $count = 0 outside this WHILE loop
// also set $columns to the number of columns you want
// owh and you need to set $wikiUrl to be your wiki url

if ($count % $columns == 0) $wik = $wik . '<tr>';
$wik = $wik .'<td class="alt'. (($count%$columns+intval($count/$columns))%2+1) .'" style="width:'. intval(100 / $columns) .'%">';
$wik = $wik . '<a href="' . $wikiUrl . $wTitle . '" title="' . $wTitleName . '"><strong>' . $wTitleName . '</strong></a><span class="smallfont">' . $new . 'by <a href="'. $wikiUrl .'User:'. $row['rc_user_text'] .'">' . $row['rc_user_text'] . '</a>';
$wik = $wik . "</span></td>";
if ($count % $columns == $columns - 1) $wik = $wik . '</tr>';
$count++;


Make sure you set the $results variable to be a multiple of the $columns (e.g. if $columns = 3 then $results = 3 or 6 or 9 or 12 or 15 etc

Sample @ http://www.recom.org/

Bernd
05-26-2009, 09:49 AM
Recom, could you share that file? I have no idea at what line your code has to be implemented and what has to be removed. I did change the sql, which did not result in any errors.

AfterWorldForum
11-02-2009, 04:39 PM
Never mind me, I am daft.

Just as a note, works fine on 3.8.4, using MediaWiki 1.15.1.

Thank you for the mod :)

majorxp
11-07-2009, 01:44 AM
Glad that worked out for ya...and yes I'm still watching. :)

rwoscott
03-13-2010, 02:16 AM
Works on VB4 and 1.10.1

Just needed to make a couple of small chgs to makevbmodule.php
find this
while($row = @mysql_fetch_array($result, MYSQL_ASSOC))

And add the bit in red
$wik = $wik .'<div class="blockrow"><table>';
while($row = @mysql_fetch_array($result, MYSQL_ASSOC))

And find this
$wik = $wik . '</span>';
Replace with

$wik = $wik . '</table></div>';