Wikistats/Display scripts

-->Wikistats->Display scripts

Wikis
<?php
 * 1) Wikistats by mutante - 2006-02 - S23 Wiki - http://s23.org

$listname="List of largest Wikis"; $listtable="wikistats"; $wikioutput="wikis_wiki.php"; $wikipage="http://meta.wikimedia.org/wiki/List_of_largest_wikis";

require_once("config.php");

mysql_connect("$dbhost", "$dbname", "$dbpass") or die(mysql_error);

"; mysql_select_db("wikistats") or die(mysql_error); "; $query = "select * from $listtable order by good desc"; $result = mysql_query("$query") or die(mysql_error);
 * 1) echo "Connected to MySQL.
 * 1) echo "Selected database 'wikistats'.
 * 1) echo "Sent query: '$query'.

"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  \n \n\n \n \n\n \n\nTable in Wiki SyntaxIn use on: $wikipageBack to Index</ul>\n"; ?> created by <a class="foot" href="http://s23.org/wiki/User:mutante">mutante</a> of <a class="foot" href="http://s23.org/wiki/Main_Page">S23</a> - 2006-02-22 <a class="foot" href="http://validator.w3.org/check?uri=referer"> <img style="border:0;width:60px;" src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" /></a> <a class="foot" href="http://jigsaw.w3.org/css-validator/"> <img style="border:0;width:60px;" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /></a>

Wikipedias
<?php require_once("config.php");
 * 1) Wikistats by mutante - 2006-02 - S23 Wiki - http://s23.org

mysql_connect("$dbhost", "$dbname", "$dbpass") or die(mysql_error); ";
 * 1) echo "Connected to MySQL.

mysql_select_db("wikistats") or die(mysql_error); ";
 * 1) echo "Selected database 'wikistats'.

$query = "select * from wikipedias order by good desc,total desc,edits desc";

$result = mysql_query("$query") or die(mysql_error);
 * 1) echo "Sent query: '$query'.

"; ?>

&lt;pre&gt; <?php $count=1; while($row = mysql_fetch_array( $result )) { if ($row['prefix']!="") { ?>
 * style="text-align: right;" | <?php echo $count; ?>
 * style="text-align: right;" | <?php echo $count; ?>


 * style="text-align: right; | <?php echo "".$row['lang'].""; ?>
 * style="text-align: right; | <?php echo "".$row['loclang'].""; ?>


 * style="text-align: right; | <?php echo "".$row['prefix'].""; ?>


 * style="text-align: right;" | <?php echo ".".wikipedia.org/wiki/Special:Statistics?action=raw ".$row['good']; ?>]
 * style="text-align: right;" | <?php echo $row['total']; ?>

<?php } else { if ($count>1) { echo "|} \n"; } ?>
 * style="text-align: right;" | <?php echo ".".wikipedia.org/wiki/Special:Recentchanges ".$row['edits']; ?>]
 * style="text-align: right;" | <?php echo ".".wikipedia.org/wiki/Special:Listadmins ".$row['admins']; ?>]
 * style="text-align: right;" | <?php echo ".".wikipedia.org/wiki/Special:Listusers ".$row['users']; ?>]

Wikisources
<?php header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=wikisources.csv"); header("Pragma: no-cache"); header("Expires: 0"); require_once("config.php"); mysql_connect("$dbhost", "$dbname", "$dbpass") or die(mysql_error); mysql_select_db("wikistats") or die(mysql_error); $query = "select * from wikisources order by good desc,total desc"; $result = mysql_query("$query") or die(mysql_error); $count=1; $cr = "\n"; echo "rank,id,prefix,language,good,total,edits,views,admins,users,timestamp $cr"; while($row = mysql_fetch_array( $result )) { echo "$count,".$row['id'].",".$row['prefix'].",".$row['lang'].",".$row['good'].",".$row['total'].",".$row['edits'].",".$row['views'].",".$row['admins'].",".$row['users'].",".$row['ts']."$cr"; $count++; } mysql_close; ?>

Query for combined statistics
MySQL query for combined statistics from multiple tables:

mysql> (select prefix,good,"wikipedia" as type from wikipedias) union all (select prefix,good,"wikisource" as type from wikisources) union all (select prefix,good,"wiktionary" as type from wiktionaries) union all (select prefix,good,"wikiquote" as type from wikiquotes) union all (select prefix,good,"wikibooks" as type from wikibooks) union all (select prefix,good,"wikinews" as type from wikinews) order by good desc;

MySQL - Union Syntax

Back to Wikistats