ListeActions
exemple:
http://overcrowded.anoptique.org/StatistiquesUsages
<?php
/*
stats.php
Copyright 2006 Yann LE GUENNEC
d'après
mychanges.php
Copyright (c) 2003, Carlo Zottmann
Copyright 2003 David DELON
Copyright 2003 Charles NEPOTE
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
$this->StopLinkTracking();
$tp = $this->config["table_prefix"]."pages";
$tu = $this->config["table_prefix"]."users";
echo "<p>Ces données n'ont qu'une valeur quantitative indicative et ce dans l'état actuel des choses. Ainsi, le travail effectué sur des pages désormais supprimées n'est pas pris en compte. Il faut également considérer le délai de purge des anciennes versions de pages actuellement fixé à ".$this->config["pages_purge_time"]." jours.</p>";
//-----------------
echo "<h3>Nombre de page du wiki</h3>";
echo "<p>";
if ($pages = $this->LoadAll("SELECT count(distinct tag) as nb FROM $tp"))
{
foreach ($pages as $page)
{
echo $page["nb"];
}
}
echo "</p>";
//-----------------
echo "<h3>Nombre d'utilisateurs inscrits sur le wiki</h3>";
echo "<p>";
if ($pages = $this->LoadAll("SELECT count(*) as nb FROM $tu"))
{
foreach ($pages as $page)
{
echo $page["nb"];
}
}
echo "</p>";
//-----------------
echo "<h3>Nombre total de modifications enregistrées</h3>";
echo "<p>";
if ($pages = $this->LoadAll("SELECT count(*) as nb FROM $tp"))
{
foreach ($pages as $page)
{
echo $page["nb"];
}
}
echo "</p>";
//-----------------
echo "<h3>10 pages les plus modifiées</h3>";
echo "<p>";
if ($pages = $this->LoadAll("SELECT tag, count(*) as nb FROM $tp GROUP BY tag ORDER BY nb DESC, tag ASC limit 10"))
{
foreach ($pages as $page)
{
echo $this->Link($page["tag"]) ." : ". $page["nb"]." | ";
}
}
echo "</p>";
//-----------------
/*
echo "<h3>Utilisateurs par pages</h3>";
if ($pages = $this->LoadAll("SELECT tag, user, count(dis) as nb FROM ".$this->config["table_prefix"]."pages GROUP BY user ORDER BY nb DESC limit 10"))
{
foreach ($pages as $page)
{
echo $this->Link($page["tag"]) ." : ". $page["nb"]." | ";
}
}
*/
//-----------------
echo "<h3>Interventions par utilisateurs</h3>";
echo "<p>";
if ($pages = $this->LoadAll("SELECT user, count(*) as nb FROM $tp GROUP BY user ORDER BY nb DESC, user ASC"))
{
foreach ($pages as $page)
{
echo $this->Link($page["user"]) ." : ". $page["nb"]." | ";
}
}
echo "</p>";
//-----------------
echo "<h3>Propriété des pages par utilisateurs</h3>";
echo "<p>";
if ($pages = $this->LoadAll("SELECT owner, count(*) as nb FROM $tp WHERE latest='Y' and owner != '' GROUP BY owner ORDER BY nb DESC, owner ASC"))
{
foreach ($pages as $page)
{
echo $this->Link($page["owner"]) ." : ". $page["nb"]." | ";
}
}
echo "</p>";
//-----------------
echo "<h3>Modifications de pages par utilisateurs et par pages</h3>";
echo "<p>";
if ($pages = $this->LoadAll("SELECT user, tag, count(*) as nb FROM $tp GROUP BY user, tag ORDER BY user ASC, nb DESC"))
{
foreach ($pages as $page)
{
echo $this->Link($page["user"]) ." : " . $this->Link($page["tag"]) . " : " . $page["nb"]." <br/> ";
}
}
echo "</p>";
$this->StartLinkTracking();
?>
Même si la forme serait à mon avis à revoir, je trouve que cette action est très intéressante pour un suivi sur le long terme. J'aime surtout les "10 pages les plus modifiées" et je trouve qu'il devrait d'ailleurs être poussé un peu plus loin avec quelque chose comme "10 pages les plus modifiées au cours des x derniers jours". Par contre je ne vois pas trop l'intérêt de la dernière section ("modifications de pages par utilisateurs et par pages") --
DidierLoiseau