×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    Wikistats: Difference between revisions

    Content added Content deleted
    imported>mutante
    imported>mutante
    Line 32: Line 32:
    == Display results ==
    == Display results ==


    --> [[Wikistats/Display scripts]]

    === html ===

    === wiki ===
    ==== Wikipedias ====

    <pre>
    <?php
    # Wikistats by mutante - 2006-02 - S23 Wiki - http://s23.org
    #
    require_once("config.php");

    mysql_connect("$dbhost", "$dbname", "$dbpass") or die(mysql_error());
    # echo "Connected to MySQL.<br />";

    mysql_select_db("wikistats") or die(mysql_error());
    # echo "Selected database 'wikistats'.<br />";

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

    $result = mysql_query("$query") or die(mysql_error());
    # echo "Sent query: '$query'.<br /><br />";
    ?>

    &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 "[[w:".$row['lang']." language|".$row['lang']."]]"; ?>
    | style="text-align: right; | <?php echo "[[w:".$row['lang']." language|".$row['loclang']."]]"; ?>

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

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

    | style="text-align: right;" | <?php echo "[http://".$row['prefix'].".wikipedia.org/wiki/Special:Recentchanges ".$row['edits']; ?>]
    | style="text-align: right;" | <?php echo "[http://".$row['prefix'].".wikipedia.org/wiki/Special:Listadmins ".$row['admins']; ?>]
    | style="text-align: right;" | <?php echo "[http://".$row['prefix'].".wikipedia.org/wiki/Special:Listusers ".$row['users']; ?>]
    <?php
    } else {
    if ($count>1) {
    echo "|} \n";
    }
    ?>
    === <?php echo $row['lang']; ?> ===
    {| border="1" cellpadding="2" cellspacing="0" style="width:75%; background: #f9f9f9; border: 1px solid #aaaaaa; border-collapse: collapse; white-space: nowrap; text-align: left"
    |-
    ! No.
    ! Language
    ! Language (local)
    ! Wiki
    ! Articles
    ! Total
    ! Edits
    ! Admins
    ! Users
    <?php
    }
    if ($row['prefix']!="") {
    $count++;
    }
    }
    mysql_close();
    ?>
    |}&lt;/pre&gt;
    </pre>

    === csv/ssv ===



    [[Category:Wiki]]
    [[Category:Wiki]]

    Revision as of 10:49, 5 March 2006

    How To Generate Automatic Wiki Statistics

    Create Database

    Table structures

    --> Wikistats/Table structures

    Fill it initally

    --> Wikistats/Wikipedia Languages

    Keep it updated

    script

    --> Wikistats/Update scripts


    cronjob

    Every 4 hours:

    crontab -l
    # m h  dom mon dow   command
    00 */4 * * * /usr/local/sbin/update_all.sh
    

    which calls (among others)

    php /var/www/wikistats/update_wikis.php
    

    Display results

    --> Wikistats/Display scripts

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.