User:Produnis/WikiMilestone
Appearance
I wrote this script for my wikiproject PflegeWiki, for having a look which page was created first, second, third.... thousandth...
If you run the script, it will create a HTML-file, which outputs the page-creation-history of your wiki
Set it up
[edit]To run this script:
- dump your database (only tables "page" and "revision" needed)
- and copy data to your local MySQL-Server
- create a php-page namend "milestone.php" in a folder of your choice
- insert into "milestone.php" the code, written for your Mediawiki-Version (see below)
- as browser won't run the whole procedure, you have to start the script via shell
- open shell, and type in:
$> cd (PATH TO milestone.php) $> php milestone.php > milestone.html
Open milestone.html with your browser.
Mediawiki 1.6
[edit]<?php #### Database-Connect ### $dbname = ""; #fill up with your database-name $dbuser = ""; #fill up with your username $dbpass = ""; #fill up with username's password $dbhost = "127.0.0.1"; # could be "localhost", too... but i can't run # the script from shell if it is set to "localhost" $db = @mysql_connect($dbhost, $dbuser, $dbpass); if ($db) { mysql_select_db($dbname, $db); } ################ from this point, you don't need to change anything ########################### $font1 = <font face=\"Arial,Helvetica,Geneva,Swiss,SunSans-Regular\" size=\"1\" color=\"black\">"; $font2 = <font face=\"Arial,Helvetica,Geneva,Swiss,SunSans-Regular\" size=\"1\" color=\"blue\">"; echo "<big><b>Wiki-Milestones</b></big><hr><br>"; $spruch = "SELECT * FROM page"; $spruch .= " WHERE page_namespace=0 and page_is_redirect=0 AND page_title not like 'Main Page'"; $result = mysql_query($spruch, $db) or die("GetData failed: " . mysql_error() . "<br><br>" . $spruch); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $pageid = $row['page_id']; $titel = $row['page_title']; $spruch2 = "SELECT * FROM revision"; $spruch2 .= " WHERE rev_page='$pageid'"; $spruch2 .= " ORDER BY rev_timestamp ASC"; $result2 = mysql_query($spruch2, $db) or die("GetData failed: " . mysql_error() . "<br><br>" . $spruch2); $row2 = mysql_fetch_array($result2, MYSQL_ASSOC); $user = $row2['rev_user_text']; $zeit = $row2['rev_timestamp']; $artikel_name[] = $titel; $artikel_date[] = $zeit; $artikel_user[] = $user; } array_multisort ($artikel_date, SORT_ASC, SORT_NUMERIC, $artikel_name, $artikel_user); for ($o=0;$o<count($artikel_date);$o++) { $der_artikel = $artikel_name[$o]; $der_user = $artikel_user[$o]; $erstellt = $artikel_date[$o]; $erstellt_am = $erstellt[6] . $erstellt[7] . "." . $erstellt[4] . $erstellt[5] . "." . $erstellt[0] . $erstellt[1] . $erstellt[2] . $erstellt[3]; $apm = $erstellt[0] . $erstellt[1] . $erstellt[2] . $erstellt[3] . $erstellt[4] . $erstellt[5]; if ( ($oldapm != '') AND ($oldapm < $apm)) { echo "Number of articles at end of month " . $oldapm . ": " . $o . "<br><br>"; $apm_artikel[] = $o; $apm_monat[] = $oldapm; } $dummy = ($o +1); echo $font1 . $dummy . ": $font2 " . $der_artikel; echo " (by User " . $der_user . ") - " . $erstellt_am . "<br>"; $oldapm= $apm; } ?>