wiki.techinc.nl/includes/SpecialStatistics.php
Alexandre Emsenhuber 087a9f70c5 WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>

Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage

One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00

93 lines
2.7 KiB
PHP

<?php
/**
* Special page lists various statistics, including the contents of
* `site_stats`, plus page view details if enabled
*
* @file
* @ingroup SpecialPage
*/
/**
* Show the special page
*
* @param mixed $par (not used)
*/
function wfSpecialStatistics( $par = '' ) {
global $wgOut, $wgLang, $wgRequest;
$dbr = wfGetDB( DB_SLAVE );
$views = SiteStats::views();
$edits = SiteStats::edits();
$good = SiteStats::articles();
$images = SiteStats::images();
$total = SiteStats::pages();
$users = SiteStats::users();
$admins = SiteStats::admins();
$numJobs = SiteStats::jobs();
if( $wgRequest->getVal( 'action' ) == 'raw' ) {
$wgOut->disable();
header( 'Pragma: nocache' );
echo "total=$total;good=$good;views=$views;edits=$edits;users=$users;admins=$admins;images=$images;jobs=$numJobs\n";
return;
} else {
$text = "__NOTOC__\n";
$text .= '==' . wfMsgNoTrans( 'sitestats' ) . "==\n";
$text .= wfMsgExt( 'sitestatstext', array( 'parsemag' ),
$wgLang->formatNum( $total ),
$wgLang->formatNum( $good ),
$wgLang->formatNum( $views ),
$wgLang->formatNum( $edits ),
$wgLang->formatNum( sprintf( '%.2f', $total ? $edits / $total : 0 ) ),
$wgLang->formatNum( sprintf( '%.2f', $edits ? $views / $edits : 0 ) ),
$wgLang->formatNum( $numJobs ),
$wgLang->formatNum( $images )
)."\n";
$text .= "==" . wfMsgNoTrans( 'userstats' ) . "==\n";
$text .= wfMsgExt( 'userstatstext', array ( 'parsemag' ),
$wgLang->formatNum( $users ),
$wgLang->formatNum( $admins ),
'[[' . wfMsgForContent( 'grouppage-sysop' ) . ']]', # TODO somehow remove, kept for backwards compatibility
$wgLang->formatNum( @sprintf( '%.2f', $admins / $users * 100 ) ),
User::makeGroupLinkWiki( 'sysop' )
)."\n";
global $wgDisableCounters, $wgMiserMode, $wgUser, $wgLang, $wgContLang;
if( !$wgDisableCounters && !$wgMiserMode ) {
$res = $dbr->select(
'page',
array(
'page_namespace',
'page_title',
'page_counter',
),
array(
'page_is_redirect' => 0,
'page_counter > 0',
),
__METHOD__,
array(
'ORDER BY' => 'page_counter DESC',
'LIMIT' => 10,
)
);
if( $res->numRows() > 0 ) {
$text .= "==" . wfMsgNoTrans( 'statistics-mostpopular' ) . "==\n";
while( $row = $res->fetchObject() ) {
$title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
if( $title instanceof Title )
$text .= '* [[:' . $title->getPrefixedText() . ']] (' . $wgLang->formatNum( $row->page_counter ) . ")\n";
}
$res->free();
}
}
$footer = wfMsgNoTrans( 'statistics-footer' );
if( !wfEmptyMsg( 'statistics-footer', $footer ) && $footer != '' )
$text .= "\n" . $footer;
$wgOut->addWikiText( $text );
}
}