Thread: Integration with vBulletin - MediaWiki Latest Additions & Changes
View Single Post
  #44  
Old 05-20-2009, 11:33 AM
ReCom ReCom is offline
 
Join Date: Mar 2008
Posts: 97
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:

Code:
// 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/
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01264 seconds
  • Memory Usage 1,773KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete