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>

All Wikimedia projects
<?php
 * 1) Wikistats by mutante - 2006-03 - S23 Wiki - http://s23.org

$listname="All Wikimedia Projects by Size"; $wikioutput="wikimedias_wiki.php"; $wikipage="none yet";

require_once("config.php");

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

"; mysql_select_db("wikistats") or die(mysql_error); "; $query = "(select prefix,good,lang,loclang,total,edits,admins,users,ts,'wikipedia' as type from wikipedias where prefix is not null) union all (select prefix,good,lang,loclang,total,edits,admins,users,ts,'wikisource' as type from wikisources) union all (select prefix,good,lang,loclang,total,edits,admins,users,ts,'wiktionary' as type from wiktionaries) union all (select prefix,good,lang,loclang,total,edits,admins,users,ts,'wikiquote' as type from wikiquotes) union all (select prefix,good,lang,loclang,total,edits,admins,users,ts,'wikibooks' as type from wikibooks) union all (select prefix,good,lang,loclang,total,edits,admins,users,ts,'wikinews' as type from wikinews) union all (select url,good,lang,loclang,total,edits,admins,users,ts,'special' as type from wmspecials) order by good desc;";
 * 1) echo "Connected to MySQL.
 * 1) echo "Selected database 'wikistats'.

$result = mysql_query("$query") or die(mysql_error); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <?php echo " WikiStats by S23 - $listname \n<meta name=\"author\" content=\"mutante@s23.org\" />\n \n\n \n \n\n<ul><a class=\"foot\" href=\"$wikioutput\">Table in Wiki Syntax</a></li>In use on: <a class=\"foot\" href=\"$wikipage\">$wikipage</a></li><a class=\"foot\" href=\"index.php\">Back to Index</a></li></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-03-08 <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:

$query = "(select prefix,good,lang,loclang,total,edits,admins,users,ts,'wikipedia' as type from wikipedias where prefix is not null) union all (select prefix,good,lang,loclang,total,edits,admins,users,ts,'wikisource' as type from wikisources) union all (select prefix,good,lang,loclang,total,edits,admins,users,ts,'wiktionary' as type from wiktionaries) union all (select prefix,good,lang,loclang,total,edits,admins,users,ts,'wikiquote' as type from wikiquotes) union all (select prefix,good,lang,loclang,total,edits,admins,users,ts,'wikibooks' as type from wikibooks) union all (select prefix,good,lang,loclang,total,edits,admins,users,ts,'wikinews' as type from wikinews) order by good desc;";

MySQL - Union Syntax

Back to Wikistats