Difference between revisions of "Wikisimpsons talk:The Golden Homer Award"
Line 146: | Line 146: | ||
</nowiki></pre> | </nowiki></pre> | ||
+ | And how would one use this script?--[[User:Zhen lin|Zhen lin]] 23:16, January 22, 2010 (UTC) |
Revision as of 18:16, January 22, 2010
This is a talk page, where you can leave messages and comments about the The Golden Homer Award project page. | |||
---|---|---|---|
|
Other awards
Maybe we could have more awards --Zhen lin 22:52, January 22, 2010 (UTC)
- Like...--Smiley12 was here at 22:54, January 22, 2010 (UTC)
- When other projects are made, then we can have more awards related to them.--Sgtcook (My Talk Page) 22:56, January 22, 2010 (UTC)
Either use their contributions page and count how many they have had or write the edit count before and after the month and workout the amount in between.--Sgtcook (My Talk Page) 23:05, January 22, 2010 (UTC)
- It would be impossible to do that for every user--Zhen lin 23:06, January 22, 2010 (UTC)
<?php header('Content-Type: text/html; charset=utf-8'); $db = mysql_connect('localhost', ' username ', ' password'); mysql_select_db(' database '); if (!$db) { trigger_error('MySQL error #' . mysql_errno() . ': ' . mysql_error(), E_USER_ERROR); } mysql_query("SET NAMES 'utf8'"); function requestVar($name, $default = '') { if (isset($_GET[$name])) { return $_GET[$name]; } if (isset($_POST[$name])) { return $_POST[$name]; } return $default; } $starttime = requestVar('starttime', '00000000000000'); // HINT: set here, for example: requestVar('starttime', mktime (0,0,0, $month, 1, 2008) ); $endtime = requestVar('endtime', '99999999999999'); $limit = requestVar('limit', 100); $query = 'SELECT COUNT(*) AS x FROM page LEFT JOIN revision ON rev_page = page_id LEFT JOIN user ON rev_user = user_id WHERE page_namespace = 0 AND page_is_redirect = 0 AND rev_timestamp >= ' . "'${starttime}'" . ' AND rev_timestamp <= ' . "'${endtime}'"; $result = mysql_query($query); $row = mysql_fetch_row($result); $totaledits = $row[0]; print '<p>There have been ' . number_format($totaledits) . ' edits to the main namespace, excluding the pages which are currently redirects.</p>'; flush(); $query = 'SELECT COUNT(*) AS x, user_name FROM page LEFT JOIN revision ON rev_page = page_id LEFT JOIN user ON rev_user = user_id WHERE page_namespace = 0 AND page_is_redirect = 0 AND rev_timestamp >= ' . "'${starttime}'" . ' AND rev_timestamp <= ' . "'${endtime}'" . ' GROUP BY user_id ORDER BY x DESC, user_id ASC'; if ($limit > 0) $query .= ' LIMIT 0, ' . $limit; $result = mysql_query($query); $topeditlist = array(); while ($row = mysql_fetch_row($result)) { $topeditlist[] = array($row[1], intval($row[0])); } $cumulative = 0.0; if ($topeditlist[0][0] == 'BulbaBot') echo '<ol start="0">'; else echo '<ol>'; foreach($topeditlist as $data) { $user = $data[0]; $user1 = htmlspecialchars(urlencode(str_replace(' ', '_', $user))); $count = $data[1]; $fraction = floatval($count) / $totaledits; $cumulative += $fraction; echo '<li>'; echo '<a href="http://bulbapedia.bulbagarden.net/wiki/User:' . $user1 .'">'; echo $user; echo '</a> has made '; echo '<a href="http://bulbapedia.bulbagarden.net/w/index.php?title=Special:Contributions&target=' . $user1 .'">'; echo $count; if ($count == 1) echo ' edit</a>. <small>('; else echo ' edits</a>. <small>('; echo round($fraction, 3) * 100.0; echo '%, '; echo round($cumulative, 3) * 100.0; echo '% cumulative)</small></li>'; echo "\n"; } echo '</ol>'; $cutoff = 21; echo '<pre>'; foreach($topeditlist as $data) { $user = $data[0]; $count = $data[1]; if ($cutoff == 0) break; $cutoff--; if ($count < $minedits) break; echo '# '; echo '{{u|' . $user . '}}'; echo ' <small>('; echo $count; if ($count == 1) echo ' Edit'; else echo ' Edits'; echo ")</small>\n"; } ?>
And how would one use this script?--Zhen lin 23:16, January 22, 2010 (UTC)