Extension:W4G Rating Bar

W4G Rating Bar provides a page rating system. The rating bar can be either manually included on pages, using a parser function, or automatically added at the bottom of all pages, by setting  to true. Various top-lists can then be generated. W4G Rating Bar is a total rewrite of Extension:Rating Bar, which it replaces.

Functionality overview
For your user's privacy, the $wgW4GRB_Settings['show-voter-names'] setting (boolean) can be used to enable or disable the functions which link a user to their ratings.
 * displays a rating bar for [page name], scaled from 0 to 100%.
 * displays the rating of [page name].
 *  can display many kinds of list:
 * Top rated pages (globally, for a category, during the last X days, among pages with at least Y votes)
 * Top voters (by amount of votes, within a category, during the last X days)
 * Latest votes for: a page, a category, or globally
 * Latest votes by a specific user

Features removed compared to the previous version

 * Anonymous voting.
 * Star-style bar.
 * Maximum rating configuration (always 100 now).

From scratch

 * 1. Create a new folder in your  folder.
 * 2. Download the source code archive and extract it in this new folder.
 * 3. Run the following SQL query to create additional tables in your wiki's database:

CREATE TABLE IF NOT EXISTS `wik_w4grb_votes` ( `uid` int(11) unsigned NOT NULL,  `pid` int(11) unsigned NOT NULL,  `vote` tinyint(4) unsigned NOT NULL,  `ip` varbinary(39) NOT NULL,  `time` int(11) unsigned NOT NULL,  PRIMARY KEY  (`uid`,`pid`) ) ENGINE=InnoDB DEFAULT CHARSET=binary;

CREATE TABLE IF NOT EXISTS `wik_w4grb_avg` ( `pid` int(10) unsigned NOT NULL,  `avg` float unsigned NOT NULL,  `n` int(10) unsigned NOT NULL,  PRIMARY KEY  (`pid`) ) ENGINE=InnoDB DEFAULT CHARSET=binary;
 * NB: don't forget to replace wik_ with your own table prefix. You might also want to change the storage engine and the charset (although the latest probably doesn't really matter since we only store numbers).
 * 4. Add the following code at the end of LocalSettings.php:
 * (replace, of course, with the proper path!)
 * (replace, of course, with the proper path!)
 * (replace, of course, with the proper path!)

Upgrading from Rating Bar v1.1
If you're currently using the old Rating Bar 1.1 extension, you'll need to convert the database to the new scheme. A migration tool is available in version 2.0-b2. This migration tool is not (and won't be) able to merge old data with new data. Also, since this version doesn't support anonymous voting, the tool won't import anonymous votes. To upgrade from Rating Bar v1.1:
 * 1. Follow the  instructions above.
 * 2. Go to the extension's folder and edit the parameters on lines 25-32 of.
 * 3. Add  in LocalSettings.php just after
 * 4. Go to your wiki's special page Special:W4GRBMigrate. The migration will run automatically.
 * 5. Remove  from LocalSettings.php and (optionally and after checking everything worked fine) delete the old ratingbar table.

Configuration
You can edit the following settings in LocalSettings.php (add them after the line which includes the extension): Example: $wgW4GRB_Settings['ajax-fresh-data']=true; $wgW4GRB_Settings['allow-unoptimized-queries']=true; $wgW4GRB_Settings['auto-include']=false; $wgW4GRB_Settings['fix-spaces']=true; $wgW4GRB_Settings['max-bars-per-page']=1; $wgW4GRB_Settings['max-items-per-list']=200; $wgW4GRB_Settings['max-lists-per-page']=5; $wgW4GRB_Settings['show-voter-names']=false; Finally, you can also control who can vote with the  right. The default values are: $wgGroupPermissions['*']['w4g_rb-canvote'] = false; $wgGroupPermissions['user']['w4g_rb-canvote'] = true; $wgGroupPermissions['autoconfirmed']['w4g_rb-canvote'] = true; $wgGroupPermissions['bot']['w4g_rb-canvote'] = false; $wgGroupPermissions['sysop']['w4g_rb-canvote'] = true; $wgGroupPermissions['bureaucrat']['w4g_rb-canvote'] = true;
 * $wgW4GRB_Settings['ajax-fresh-data']: boolean, wether or not you want to use AJAX to display an uncached rating to visitor. Set to false if you need to restrict database queries (only affects slave databases). Default: true.
 * $wgW4GRB_Settings['auto-include']: boolean, wether or not to automatically include the rating bar at the bottom of every page. Default: false.
 * $wgW4GRB_Settings['allow-unoptimized-queries']: boolean, wether or not to allow queries which need some extra calculations in MySQL. They're not that terrible, this thing is just here as an emergency switch in case someone tries to run big queries on a very large database. Default: true.
 * $wgW4GRB_Settings['fix-spaces']: boolean, wether or not you want to enable auto replacing of spaces with underscore (and vice versa) when needed in page/category name input, so that spaces and underscores can be used indifferently (otherwise the user must sometimes write underscores, and sometimes not - a bit annoying indeed). Default: true.
 * $wgW4GRB_Settings['max-bars-per-page']: maximum amount of bars than can be included within one page (this doesn't count the auto-included bar). Default: not fixed yet, may change.
 * $wgW4GRB_Settings['max-items-per-list']: maximum amount of items than can be displayed in a top list. Default: not fixed yet, may change.
 * $wgW4GRB_Settings['max-lists-per-page']: maximum amount of pages than can be displayed in a single page. Default: not fixed yet, may change.
 * $wgW4GRB_Settings['show-voter-names']: boolean, wether or not it's possible to publicly link user names to their ratings. Default: false.

Usage
A list of functions and parameters as well as syntax examples are available here: http://www.wiki4games.com/Wiki4Games:W4G_Rating_Bar/syntax.

Who's using it?
(Please add your URL to the bottom of the list.)
 * Wiki4Games.com, the video game wiki