Extension:OnlyRecentRecentChanges

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
OnlyRecentRecentChanges

Release status: experimental

Implementation User interface
Description Recent changes list only the latest change of a page, suppress older
Author(s) Wikinaut
Last version 1.1 (2010-02-18)
MediaWiki 1.15+
License free
Download No link
Hooks used
SpecialRecentChangesQuery

Check usage (experimental)

Contents

[edit] What can this extension do ?

The behaviour of the recent changes view is changed so that any changed article is only listed once, older changes are not listed any longer. The current version also suppresses log events (delete, upload ...) because I don't know how to avoid this unwanted side effect.


Note: MediaWiki 1.15.1

The "What links here" view of related changes is affected accordingly but only if you apply this patch in $IP/includes/specials/SpecialRecentchangeslinked.php: remove the commenting slashes on the wfRunHook line; see also Bugzilla:22514

  // XXX: parent class does this, should we too?
  // wfRunHooks('SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts ) );


[edit] Version incompatibilities

This problem has been filed as Potential MySQL syntax error in function tableNamesWithUseIndexOrJOIN (bug 22613).

MySQL PHP (apachehandler) MediaWiki
4.1.13 5.2.12 1.15.1 ok
5.0.45 5.2.11 1.15.1 not working

JOIN syntax changed[1][2] in MySQL 5.0.12.
changes not yet done in $IP/includes/database/db.php (Bugzilla needed) solution: add parentheses around tables FROM (recentchanges .., page)

The changed JOIN ON MySQL syntax problem is only apparent when adding tables to the $tables[] array like in the present extension.

[edit] Planned improvements

A per-user option for the full standard view or this compact view is not yet implemented, but it is on my to-do list. --Wikinaut 08:37, 14 February 2010 (UTC)

[edit] Installation

Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
  1. Create a file $IP/extensions/OnlyRecentRecentChanges.php with the code below
  2. Add require_once( "$IP/extensions/OnlyRecentRecentChanges.php" ); to LocalSettings.php

[edit] Code

<?php
#
# OnlyRecentRecentChanges extension for MediaWiki
# From http://www.mediawiki.org/wiki/Extension:OnlyRecentRecentChanges
#
# Installation:
#   create a file $IP/extensions/OnlyRecentRecentChanges.php with this code
#   add the following to LocalSettings.php:
#   require_once( "$IP/extensions/OnlyRecentRecentChanges.php" );

if(! defined('MEDIAWIKI')) {
  die("This is a MediaWiki extension and cannot be used standalone.\n");
}
 
$wgExtensionCredits['other'][] = array(
  'name' => 'OnlyRecentRecentChanges',
  'description' => 'Recent changes list only the latest change of a page, suppress older',
  'version' => '1.1 20100215',
  'author' => 'Wikinaut',
  'url' => 'http://www.mediawiki.org/wiki/Extension:OnlyRecentRecentChanges',
);
 
$wgHooks['SpecialRecentChangesQuery'][] = 'onlyRecentRecentChanges';
 
// see http://www.mediawiki.org/wiki/Manual:Hooks/SpecialRecentChangesQuery
function onlyRecentRecentChanges( &$conds, &$tables, &$join_conds, $opts, &$query_options = array() ) {
  if ( !in_array( 'page', $tables) ) $tables[] = 'page';
  $conds[] = 'rc_this_oldid=page_latest';
  return true;
}

[edit] references

  1. JOIN syntax changed
    SELECT * FROM t1, t2 JOIN t3 ON (t1.i1 = t3.i3);
     
    
          Previously, the SELECT was legal due to the implicit grouping of t1,t2 as (t1,t2).
    Now the JOIN takes precedence, so the operands for the ON clause are t2 and t3. Because
    t1.i1 is not a column in either of the operands, the result is an Unknown column 't1.i1'
    in 'on clause' error. To allow the join to be processed, group the first two tables
    explicitly with parentheses so that the operands for the ON clause are (t1,t2) and t3:
    
          SELECT * FROM (t1, t2) JOIN t3 ON (t1.i1 = t3.i3);
              
    
          Alternatively, avoid the use of the comma operator and use JOIN instead:
    
          SELECT * FROM t1 JOIN t2 JOIN t3 ON (t1.i1 = t3.i3);
    
  2. JOIN and Join Processing Changes in MySQL 5.0.12:
    Beginning with MySQL 5.0.12, natural joins and joins with USING, including outer join variants, 
    are processed according to the SQL:2003 standard. The goal was to align the syntax and semantics
    of MySQL with respect to NATURAL JOIN and JOIN ... USING according to SQL:2003.
    However, these changes in join processing can result in different output columns for some joins.
    
    Also, some queries that appeared to work correctly in older versions must be rewritten to comply with the standard.</span>
    </li></ol>
    
Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox