* Deprecated OutputPage::readOnlyPage() and OutputPage::rateLimited().
Also, the former will now throw an MWException if called with one or more
arguments.
+* Removed hitcounters and associated code.
== Compatibility ==
'SiteStatsUpdate' => 'includes/deferred/SiteStatsUpdate.php',
'SqlDataUpdate' => 'includes/deferred/SqlDataUpdate.php',
'SquidUpdate' => 'includes/deferred/SquidUpdate.php',
- 'ViewCountUpdate' => 'includes/deferred/ViewCountUpdate.php',
# includes/diff
'DiffEngine' => 'includes/diff/DairikiDiff.php',
'NewFilesPager' => 'includes/specials/SpecialNewimages.php',
'NewPagesPager' => 'includes/specials/SpecialNewpages.php',
'PageArchive' => 'includes/specials/SpecialUndelete.php',
- 'PopularPagesPage' => 'includes/specials/SpecialPopularpages.php',
'ProtectedPagesPager' => 'includes/specials/SpecialProtectedpages.php',
'ProtectedTitlesPager' => 'includes/specials/SpecialProtectedtitles.php',
'RandomPage' => 'includes/specials/SpecialRandompage.php',
*/
$wgArticleCountMethod = 'link';
-/**
- * wgHitcounterUpdateFreq sets how often page counters should be updated, higher
- * values are easier on the database. A value of 1 causes the counters to be
- * updated on every hit, any higher value n cause them to update *on average*
- * every n hits. Should be set to either 1 or something largish, eg 1000, for
- * maximum efficiency.
- */
-$wgHitcounterUpdateFreq = 1;
-
/**
* How many days user must be idle before he is considered inactive. Will affect
* the number shown on Special:Statistics, Special:ActiveUsers, and the
*/
$wgStatsFormatString = "stats/%s - %s 1 1 1 1 %s\n";
-/**
- * Whereas to count the number of time an article is viewed.
- * Does not work if pages are cached (for example with squid).
- */
-$wgDisableCounters = false;
-
/**
* InfoAction retrieves a list of transclusion links (both to and from).
* This number puts a limit on that query in the case of highly transcluded
'directionmark',
'contentlanguage',
'numberofadmins',
- 'numberofviews',
'cascadingsources',
);
'localtimestamp' => 3600,
'pagesinnamespace' => 3600,
'numberofadmins' => 3600,
- 'numberofviews' => 3600,
'numberingroup' => 3600,
);
wfProfileOut( $fname . '-tempDir' );
}
+// We don't use counters anymore. Left here for extensions still
+// expecting this to exist. Should be removed sometime 1.26 or later.
+$wgDisableCounters = true;
+
wfProfileOut( $fname . '-defaults2' );
wfProfileIn( $fname . '-misc1' );
static function doLoad( $db ) {
return $db->selectRow( 'site_stats', array(
'ss_row_id',
- 'ss_total_views',
'ss_total_edits',
'ss_good_articles',
'ss_total_pages',
}
/**
+ * Return the total number of page views. Except we don't track those anymore.
+ * Stop calling this function, it will be removed some time in the future. It's
+ * kept here simply to prevent fatal errors.
+ *
+ * @deprecated since 1.25
* @return int
*/
static function views() {
- self::load();
- return self::$row->ss_total_views;
+ wfDeprecated( __METHOD__, '1.25' );
+ return 0;
}
/**
}
// Now check for underflow/overflow
foreach ( array(
- 'ss_total_views',
'ss_total_edits',
'ss_good_articles',
'ss_total_pages',
// Various stats
private $mEdits = null, $mArticles = null, $mPages = null;
- private $mUsers = null, $mViews = null, $mFiles = null;
+ private $mUsers = null, $mFiles = null;
/**
* Constructor
return $this->mUsers;
}
- /**
- * Count views
- * @return int
- */
- public function views() {
- $this->mViews = $this->db->selectField( 'page', 'SUM(page_counter)', '', __METHOD__ );
- return $this->mViews;
- }
-
/**
* Count total files
* @return int
* - Boolean: whether to use the master DB
* - DatabaseBase: database connection to use
* @param array $options Array of options, may contain the following values
- * - views Boolean: when true, do not update the number of page views (default: true)
* - activeUsers Boolean: whether to update the number of active users (default: false)
*/
public static function doAllAndCommit( $database, array $options = array() ) {
- $options += array( 'update' => false, 'views' => true, 'activeUsers' => false );
+ $options += array( 'update' => false, 'activeUsers' => false );
// Grab the object and count everything
$counter = new SiteStatsInit( $database );
$counter->users();
$counter->files();
- // Only do views if we don't want to not count them
- if ( $options['views'] ) {
- $counter->views();
- }
-
$counter->refresh();
// Count active users if need be
}
/**
- * Refresh site_stats. If you want ss_total_views to be updated, be sure to
- * call views() first.
+ * Refresh site_stats
*/
public function refresh() {
$values = array(
'ss_total_pages' => ( $this->mPages === null ? $this->pages() : $this->mPages ),
'ss_users' => ( $this->mUsers === null ? $this->users() : $this->mUsers ),
'ss_images' => ( $this->mFiles === null ? $this->files() : $this->mFiles ),
- ) + (
- $this->mViews ? array( 'ss_total_views' => $this->mViews ) : array()
);
$dbw = wfGetDB( DB_MASTER );
$this->msg( 'pageinfo-robot-policy' ), $this->msg( "pageinfo-robot-${policy['index']}" )
);
- if ( isset( $pageCounts['views'] ) ) {
- // Number of views
- $pageInfo['header-basic'][] = array(
- $this->msg( 'pageinfo-views' ), $lang->formatNum( $pageCounts['views'] )
- );
- }
-
$unwatchedPageThreshold = $config->get( 'UnwatchedPageThreshold' );
if (
$user->isAllowed( 'unwatchedpages' ) ||
$dbr = wfGetDB( DB_SLAVE );
$result = array();
- if ( !$config->get( 'DisableCounters' ) ) {
- // Number of views
- $views = (int)$dbr->selectField(
- 'page',
- 'page_counter',
- array( 'page_id' => $id ),
- __METHOD__
- );
- $result['views'] = $views;
- }
-
// Number of page watchers
$watchers = (int)$dbr->selectField(
'watchlist',
}
$pageSet->requestField( 'page_is_new' );
$config = $this->getConfig();
- if ( !$config->get( 'DisableCounters' ) ) {
- $pageSet->requestField( 'page_counter' );
- }
$pageSet->requestField( 'page_touched' );
$pageSet->requestField( 'page_latest' );
$pageSet->requestField( 'page_len' );
: array();
$this->pageIsNew = $pageSet->getCustomField( 'page_is_new' );
- if ( !$this->getConfig()->get( 'DisableCounters' ) ) {
- $this->pageCounter = $pageSet->getCustomField( 'page_counter' );
- }
$this->pageTouched = $pageSet->getCustomField( 'page_touched' );
$this->pageLatest = $pageSet->getCustomField( 'page_latest' );
$this->pageLength = $pageSet->getCustomField( 'page_len' );
if ( $titleExists ) {
$pageInfo['touched'] = wfTimestamp( TS_ISO_8601, $this->pageTouched[$pageid] );
$pageInfo['lastrevid'] = intval( $this->pageLatest[$pageid] );
- $pageInfo['counter'] = $this->getConfig()->get( 'DisableCounters' )
- ? ''
- : intval( $this->pageCounter[$pageid] );
$pageInfo['length'] = intval( $this->pageLength[$pageid] );
if ( isset( $this->pageIsRedir[$pageid] ) && $this->pageIsRedir[$pageid] ) {
$data = array();
$data['pages'] = intval( SiteStats::pages() );
$data['articles'] = intval( SiteStats::articles() );
- if ( !$this->getConfig()->get( 'DisableCounters' ) ) {
- $data['views'] = intval( SiteStats::views() );
- }
$data['edits'] = intval( SiteStats::edits() );
$data['images'] = intval( SiteStats::images() );
$data['users'] = intval( SiteStats::users() );
* Class for handling updates to the site_stats table
*/
class SiteStatsUpdate implements DeferrableUpdate {
- /** @var int */
- protected $views = 0;
-
/** @var int */
protected $edits = 0;
// @todo deprecate this constructor
function __construct( $views, $edits, $good, $pages = 0, $users = 0 ) {
- $this->views = $views;
$this->edits = $edits;
$this->articles = $good;
$this->pages = $pages;
}
$pd = $this->getPendingDeltas();
// Piggy-back the async deltas onto those of this stats update....
- $this->views += ( $pd['ss_total_views']['+'] - $pd['ss_total_views']['-'] );
$this->edits += ( $pd['ss_total_edits']['+'] - $pd['ss_total_edits']['-'] );
$this->articles += ( $pd['ss_good_articles']['+'] - $pd['ss_good_articles']['-'] );
$this->pages += ( $pd['ss_total_pages']['+'] - $pd['ss_total_pages']['-'] );
// Build up an SQL query of deltas and apply them...
$updates = '';
- $this->appendUpdate( $updates, 'ss_total_views', $this->views );
$this->appendUpdate( $updates, 'ss_total_edits', $this->edits );
$this->appendUpdate( $updates, 'ss_good_articles', $this->articles );
$this->appendUpdate( $updates, 'ss_total_pages', $this->pages );
}
protected function doUpdatePendingDeltas() {
- $this->adjustPending( 'ss_total_views', $this->views );
$this->adjustPending( 'ss_total_edits', $this->edits );
$this->adjustPending( 'ss_good_articles', $this->articles );
$this->adjustPending( 'ss_total_pages', $this->pages );
global $wgMemc;
$pending = array();
- foreach ( array( 'ss_total_views', 'ss_total_edits',
+ foreach ( array( 'ss_total_edits',
'ss_good_articles', 'ss_total_pages', 'ss_users', 'ss_images' ) as $type
) {
// Get pending increments and pending decrements
+++ /dev/null
-<?php
-/**
- * Update for the 'page_counter' field
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * Update for the 'page_counter' field, when $wgDisableCounters is false.
- *
- * Depending on $wgHitcounterUpdateFreq, this will directly increment the
- * 'page_counter' field or use the 'hitcounter' table and then collect the data
- * from that table to update the 'page_counter' field in a batch operation.
- */
-class ViewCountUpdate implements DeferrableUpdate {
- /** @var int Page ID to increment the view count */
- protected $id;
-
- /**
- * Constructor
- *
- * @param int $id Page ID to increment the view count
- */
- public function __construct( $id ) {
- $this->id = intval( $id );
- }
-
- /**
- * Run the update
- */
- public function doUpdate() {
- global $wgHitcounterUpdateFreq;
-
- $dbw = wfGetDB( DB_MASTER );
-
- if ( $wgHitcounterUpdateFreq <= 1 || $dbw->getType() == 'sqlite' ) {
- $id = $this->id;
- $method = __METHOD__;
- $dbw->onTransactionIdle( function () use ( $dbw, $id, $method ) {
- try {
- $dbw->update( 'page',
- array( 'page_counter = page_counter + 1' ),
- array( 'page_id' => $id ),
- $method
- );
- } catch ( DBError $e ) {
- MWExceptionHandler::logException( $e );
- }
- } );
- return;
- }
-
- # Not important enough to warrant an error page in case of failure
- try {
- // Since `hitcounter` is non-transactional, the contention is minimal
- $dbw->insert( 'hitcounter', array( 'hc_id' => $this->id ), __METHOD__ );
- $checkfreq = intval( $wgHitcounterUpdateFreq / 25 + 1 );
- if ( rand() % $checkfreq == 0 && $dbw->lastErrno() == 0 ) {
- $this->collect();
- }
- } catch ( DBError $e ) {
- MWExceptionHandler::logException( $e );
- }
- }
-
- protected function collect() {
- global $wgHitcounterUpdateFreq;
-
- $dbw = wfGetDB( DB_MASTER );
-
- $rown = $dbw->selectField( 'hitcounter', 'COUNT(*)', array(), __METHOD__ );
- if ( $rown < $wgHitcounterUpdateFreq ) {
- return;
- }
-
- wfProfileIn( __METHOD__ . '-collect' );
- $old_user_abort = ignore_user_abort( true );
-
- $dbType = $dbw->getType();
- $tabletype = $dbType == 'mysql' ? "ENGINE=HEAP " : '';
- $hitcounterTable = $dbw->tableName( 'hitcounter' );
- $acchitsTable = $dbw->tableName( 'acchits' );
- $pageTable = $dbw->tableName( 'page' );
-
- $dbw->lockTables( array(), array( 'hitcounter' ), __METHOD__, false );
- $dbw->query( "CREATE TEMPORARY TABLE $acchitsTable $tabletype AS " .
- "SELECT hc_id,COUNT(*) AS hc_n FROM $hitcounterTable " .
- 'GROUP BY hc_id', __METHOD__ );
- $dbw->delete( 'hitcounter', '*', __METHOD__ );
- $dbw->unlockTables( __METHOD__ );
-
- if ( $dbType == 'mysql' ) {
- $dbw->query( "UPDATE $pageTable,$acchitsTable SET page_counter=page_counter + hc_n " .
- 'WHERE page_id = hc_id', __METHOD__ );
- } else {
- $dbw->query( "UPDATE $pageTable SET page_counter=page_counter + hc_n " .
- "FROM $acchitsTable WHERE page_id = hc_id", __METHOD__ );
- }
- $dbw->query( "DROP TABLE $acchitsTable", __METHOD__ );
-
- ignore_user_abort( $old_user_abort );
- wfProfileOut( __METHOD__ . '-collect' );
- }
-}
*/
protected $mLinksUpdated = '19700101000000';
- /**
- * @var int|null
- */
- protected $mCounter = null;
-
/**
* Constructor and clear the article
* @param Title $title Reference to a Title object.
*/
protected function clearCacheFields() {
$this->mId = null;
- $this->mCounter = null;
$this->mRedirectTarget = null; // Title object if set
$this->mLastRevision = null; // Latest revision
$this->mTouched = '19700101000000';
$this->mTitle->loadRestrictions( $data->page_restrictions );
$this->mId = intval( $data->page_id );
- $this->mCounter = intval( $data->page_counter );
$this->mTouched = wfTimestamp( TS_MW, $data->page_touched );
$this->mLinksUpdated = wfTimestampOrNull( TS_MW, $data->page_links_updated );
$this->mIsRedirect = intval( $data->page_is_redirect );
return $this->exists() || $this->mTitle->isAlwaysKnown();
}
- /**
- * @return int The view count for the page
- */
- public function getCount() {
- if ( !$this->mDataLoaded ) {
- $this->loadPageData();
- }
-
- return $this->mCounter;
- }
-
/**
* Tests if the article content represents a redirect
*
* @param int $oldid The revision id being viewed. If not given or 0, latest revision is assumed.
*/
public function doViewUpdates( User $user, $oldid = 0 ) {
- global $wgDisableCounters;
if ( wfReadOnly() ) {
return;
}
- // Don't update page view counters on views from bot users (bug 14044)
- if ( !$wgDisableCounters && !$user->isAllowed( 'bot' ) && $this->exists() ) {
- DeferredUpdates::addUpdate( new ViewCountUpdate( $this->getId() ) );
- DeferredUpdates::addUpdate( new SiteStatsUpdate( 1, 0, 0 ) );
- }
-
// Update newtalk / watchlist notification status
$user->clearNotification( $this->mTitle, $oldid );
}
'page_id' => $page_id,
'page_namespace' => $this->mTitle->getNamespace(),
'page_title' => $this->mTitle->getDBkey(),
- 'page_counter' => 0,
'page_restrictions' => '',
'page_is_redirect' => 0, // Will set this shortly...
'page_is_new' => 1,
'canonicalurle', 'formatnum', 'grammar', 'gender', 'plural',
'numberofpages', 'numberofusers', 'numberofactiveusers',
'numberofarticles', 'numberoffiles', 'numberofadmins',
- 'numberingroup', 'numberofedits', 'numberofviews', 'language',
+ 'numberingroup', 'numberofedits', 'language',
'padleft', 'padright', 'anchorencode', 'defaultsort', 'filepath',
'pagesincategory', 'pagesize', 'protectionlevel',
'namespacee', 'namespacenumber', 'talkspace', 'talkspacee',
public static function numberofedits( $parser, $raw = null ) {
return self::formatRaw( SiteStats::edits(), $raw );
}
- public static function numberofviews( $parser, $raw = null ) {
- global $wgDisableCounters;
- return !$wgDisableCounters ? self::formatRaw( SiteStats::views(), $raw ) : '';
- }
public static function pagesinnamespace( $parser, $namespace = 0, $raw = null ) {
return self::formatRaw( SiteStats::pagesInNs( intval( $namespace ) ), $raw );
}
case 'numberofedits':
$value = $pageLang->formatNum( SiteStats::edits() );
break;
- case 'numberofviews':
- global $wgDisableCounters;
- $value = !$wgDisableCounters ? $pageLang->formatNum( SiteStats::views() ) : '';
- break;
case 'currenttimestamp':
$value = wfTimestamp( TS_MW, $ts );
break;
*/
protected function prepareQuickTemplate() {
global $wgContLang, $wgScript, $wgStylePath, $wgMimeType, $wgJsMimeType,
- $wgDisableCounters, $wgSitename, $wgLogo, $wgMaxCredits,
+ $wgSitename, $wgLogo, $wgMaxCredits,
$wgShowCreditsIfMax, $wgArticlePath,
$wgScriptPath, $wgServer;
$tpl->set( 'logo', $this->logoText() );
$tpl->set( 'copyright', false );
+ // No longer used
$tpl->set( 'viewcount', false );
$tpl->set( 'lastmod', false );
$tpl->set( 'credits', false );
$tpl->set( 'numberofwatchingusers', false );
if ( $out->isArticle() && $title->exists() ) {
if ( $this->isRevisionCurrent() ) {
- if ( !$wgDisableCounters ) {
- $viewcount = $this->getWikiPage()->getCount();
- if ( $viewcount ) {
- $tpl->set( 'viewcount', $this->msg( 'viewcount' )->numParams( $viewcount )->parse() );
- }
- }
-
if ( $wgMaxCredits != 0 ) {
$tpl->set( 'credits', Action::factory( 'credits', $this->getWikiPage(),
$this->getContext() )->getCredits( $wgMaxCredits, $wgShowCreditsIfMax ) );
$tpl->set( 'footerlinks', array(
'info' => array(
'lastmod',
- 'viewcount',
'numberofwatchingusers',
'credits',
'copyright',
* @return array
*/
public static function getPages() {
- global $wgDisableCounters;
static $qp = null;
if ( $qp === null ) {
array( 'WithoutInterwikiPage', 'Withoutinterwiki' ),
);
wfRunHooks( 'wgQueryPages', array( &$qp ) );
-
- if ( !$wgDisableCounters ) {
- $qp[] = array( 'PopularPagesPage', 'Popularpages' );
- }
}
return $qp;
*/
private static function getPageList() {
global $wgSpecialPages;
- global $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication;
+ global $wgDisableInternalSearch, $wgEmailAuthentication;
global $wgEnableEmail, $wgEnableJavaScriptTest;
global $wgPageLanguageUseDB;
self::$list = self::$coreList;
- if ( !$wgDisableCounters ) {
- self::$list['Popularpages'] = 'PopularPagesPage';
- }
-
if ( !$wgDisableInternalSearch ) {
self::$list['Search'] = 'SpecialSearch';
}
+++ /dev/null
-<?php
-/**
- * Implements Special:PopularPages
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup SpecialPage
- */
-
-/**
- * A special page that list most viewed pages
- *
- * @ingroup SpecialPage
- */
-class PopularPagesPage extends QueryPage {
- function __construct( $name = 'Popularpages' ) {
- parent::__construct( $name );
- }
-
- function isExpensive() {
- # page_counter is not indexed
- return true;
- }
-
- function isSyndicated() {
- return false;
- }
-
- function getQueryInfo() {
- return array(
- 'tables' => array( 'page' ),
- 'fields' => array(
- 'namespace' => 'page_namespace',
- 'title' => 'page_title',
- 'value' => 'page_counter' ),
- 'conds' => array(
- 'page_is_redirect' => 0,
- 'page_namespace' => MWNamespace::getContentNamespaces()
- )
- );
- }
-
- /**
- * @param Skin $skin
- * @param object $result Result row
- * @return string
- */
- function formatResult( $skin, $result ) {
- global $wgContLang;
-
- $title = Title::makeTitleSafe( $result->namespace, $result->title );
- if ( !$title ) {
- return Html::element(
- 'span',
- array( 'class' => 'mw-invalidtitle' ),
- Linker::getInvalidTitleDescription(
- $this->getContext(),
- $result->namespace,
- $result->title )
- );
- }
-
- $link = Linker::linkKnown(
- $title,
- htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) )
- );
- $nv = $this->msg( 'nviews' )->numParams( $result->value )->escaped();
-
- return $this->getLanguage()->specialList( $link, $nv );
- }
-
- protected function getGroupName() {
- return 'wiki';
- }
-}
* @ingroup SpecialPage
*/
class SpecialStatistics extends SpecialPage {
- private $views, $edits, $good, $images, $total, $users,
+ private $edits, $good, $images, $total, $users,
$activeUsers = 0;
public function __construct() {
public function execute( $par ) {
global $wgMemc;
- $disableCounters = $this->getConfig()->get( 'DisableCounters' );
$miserMode = $this->getConfig()->get( 'MiserMode' );
$this->setHeaders();
$this->getOutput()->addModuleStyles( 'mediawiki.special' );
- $this->views = SiteStats::views();
$this->edits = SiteStats::edits();
$this->good = SiteStats::articles();
$this->images = SiteStats::images();
$this->activeUsers = SiteStats::activeUsers();
$this->hook = '';
- # Staticic - views
- $viewsStats = '';
- if ( !$disableCounters ) {
- $viewsStats = $this->getViewsStats();
- }
-
# Set active user count
if ( !$miserMode ) {
$key = wfMemcKey( 'sitestats', 'activeusers-updated' );
# Statistic - usergroups
$text .= $this->getGroupStats();
- $text .= $viewsStats;
-
- # Statistic - popular pages
- if ( !$disableCounters && !$miserMode ) {
- $text .= $this->getMostViewedPages();
- }
# Statistic - other
$extraStats = array();
return $text;
}
- private function getViewsStats() {
- return Xml::openElement( 'tr' ) .
- Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-header-views' )->parse() ) .
- Xml::closeElement( 'tr' ) .
- $this->formatRow( $this->msg( 'statistics-views-total' )->parse(),
- $this->getLanguage()->formatNum( $this->views ),
- array( 'class' => 'mw-statistics-views-total' ), 'statistics-views-total-desc' ) .
- $this->formatRow( $this->msg( 'statistics-views-peredit' )->parse(),
- $this->getLanguage()->formatNum( sprintf( '%.2f', $this->edits ?
- $this->views / $this->edits : 0 ) ),
- array( 'class' => 'mw-statistics-views-peredit' ) );
- }
-
- private function getMostViewedPages() {
- $text = '';
- $dbr = wfGetDB( DB_SLAVE );
- $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 .= Xml::openElement( 'tr' );
- $text .= Xml::tags(
- 'th',
- array( 'colspan' => '2' ),
- $this->msg( 'statistics-mostpopular' )->parse()
- );
- $text .= Xml::closeElement( 'tr' );
-
- foreach ( $res as $row ) {
- $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
-
- if ( $title instanceof Title ) {
- $text .= $this->formatRow( Linker::link( $title ),
- $this->getLanguage()->formatNum( $row->page_counter ) );
- }
- }
- $res->free();
- }
-
- return $text;
- }
-
/**
* Conversion of external statistics into an internal representation
* Following a ([<header-message>][<item-message>] = number) pattern
"statistics-summary": "",
"statistics-header-pages": "Page statistics",
"statistics-header-edits": "Edit statistics",
- "statistics-header-views": "View statistics",
"statistics-header-users": "User statistics",
"statistics-header-hooks": "Other statistics",
"statistics-articles": "Content pages",
"statistics-files": "Uploaded files",
"statistics-edits": "Page edits since {{SITENAME}} was set up",
"statistics-edits-average": "Average edits per page",
- "statistics-views-total": "Views total",
- "statistics-views-total-desc": "Views to non-existing pages and special pages are not included",
- "statistics-views-peredit": "Views per edit",
"statistics-users": "Registered [[Special:ListUsers|users]]",
"statistics-users-active": "Active users",
"statistics-users-active-desc": "Users who have performed an action in the last {{PLURAL:$1|day|$1 days}}",
- "statistics-mostpopular": "Most viewed pages",
"statistics-footer": "",
"pageswithprop": "Pages with a page property",
"pageswithprop-summary": "",
"unusedcategories-summary": "",
"unusedimages": "Unused files",
"unusedimages-summary": "",
- "popularpages": "Popular pages",
- "popularpages-summary": "",
"wantedcategories": "Wanted categories",
"wantedcategories-summary": "",
"wantedpages": "Wanted pages",
"pageinfo-robot-policy": "Indexing by robots",
"pageinfo-robot-index": "Allowed",
"pageinfo-robot-noindex": "Disallowed",
- "pageinfo-views": "Number of views",
"pageinfo-watchers": "Number of page watchers",
"pageinfo-few-watchers": "Fewer than $1 {{PLURAL:$1|watcher|watchers}}",
"pageinfo-redirects-name": "Number of redirects to this page",
"statistics-summary": "{{doc-specialpagesummary|statistics}}",
"statistics-header-pages": "Used in [[Special:Statistics]]",
"statistics-header-edits": "Used in [[Special:Statistics]]",
- "statistics-header-views": "Used in [[Special:Statistics]]",
"statistics-header-users": "Used in [[Special:Statistics]].\n{{Identical|User statistics}}",
"statistics-header-hooks": "Header of a section on [[Special:Statistics]] containing data provided by MediaWiki extensions",
"statistics-articles": "Used in [[Special:Statistics]].\n\nA 'content page' is a page that forms part of the purpose of the wiki. It includes the main page and pages in the main namespace and any other namespaces that are included when the wiki is customised. For example on Wikimedia Commons 'content pages' include pages in the file and category namespaces. On Wikinews 'content pages' include pages in the Portal namespace. For technical definition of 'content namespaces' see [[mw:Manual:Using_custom_namespaces#Content_namespaces|MediaWiki]].\n\nPossible alternatives to the word 'content' are 'subject matter' or 'wiki subject' or 'wiki purpose'.\n\n{{Identical|Content page}}",
"statistics-files": "Used in [[Special:Statistics]].\n{{Identical|Uploaded file}}",
"statistics-edits": "Used in [[Special:Statistics]]",
"statistics-edits-average": "Used in [[Special:Statistics]]",
- "statistics-views-total": "Used in [[Special:Statistics]]",
- "statistics-views-total-desc": "This message follows the message {{msg-mw|statistics-views-total}}, in [[Special:Statistics]].",
- "statistics-views-peredit": "Used in [[Special:Statistics]]",
"statistics-users": "{{doc-important|Do not translate \"Special:ListUsers\"}}\nUsed in [[Special:Statistics]].",
"statistics-users-active": "Used in [[Special:Statistics]]",
"statistics-users-active-desc": "Description shown beneath ''Active users'' in [[Special:Statistics]]. Parameters:\n* $1 - Value of <code>$wgRCMaxAge</code> in days",
- "statistics-mostpopular": "Used in [[Special:Statistics]]",
"statistics-footer": "{{notranslate}}",
"pageswithprop": "{{doc-special|PagesWithProp}}\n{{Identical|Page with page property}}",
"pageswithprop-summary": "{{doc-specialpagesummary|pageswithprop}}",
"unusedcategories-summary": "{{doc-specialpagesummary|unusedcategories}}",
"unusedimages": "{{doc-special|UnusedImages}}",
"unusedimages-summary": "{{doc-specialpagesummary|unusedimages}}",
- "popularpages": "{{doc-special|PopularPages}}",
- "popularpages-summary": "{{doc-specialpagesummary|popularpages}}",
"wantedcategories": "{{doc-special|WantedCategories}}",
"wantedcategories-summary": "{{doc-specialpagesummary|wantedcategories}}",
"wantedpages": "{{doc-special|WantedPages}}\n{{Identical|Wanted page}}",
"pageinfo-robot-policy": "The search engine status of the page.\n\nUsed as label. Followed by any one of the following messages:\n*{{msg-mw|Pageinfo-robot-index}}\n*{{msg-mw|Pageinfo-robot-noindex}}",
"pageinfo-robot-index": "An indication that the page is indexable by search engines, that is listed in their search results.\n\nPreceded by the label {{msg-mw|Pageinfo-robot-policy}}.",
"pageinfo-robot-noindex": "An indication that the page is not indexable (that is, is not listed on the results page of a search engine).\n\nPreceded by the label {{msg-mw|Pageinfo-robot-policy}}.",
- "pageinfo-views": "The number of times the page has been viewed.",
"pageinfo-watchers": "Header of the row in the first table of the info action.",
"pageinfo-few-watchers": "Message displayed when there are fewer than $wgUnwatchedPageThreshold watchers. $1 is the value of $wgUnwatchedPageThreshold.",
"pageinfo-redirects-name": "Header of the row in the first table of the info action.\n\nFollowed by {{msg-mw|Pageinfo-redirects-value}}.\n\nUsed as link text. The link points to \"{{int:Whatlinkshere-title}}\" page ([[Special:WhatLinksHere]]).\n\nSee example: [{{canonicalurl:Main page|action=info}} Main page?action=info]",
'numberofusers' => array( 1, 'NUMBEROFUSERS' ),
'numberofactiveusers' => array( 1, 'NUMBEROFACTIVEUSERS' ),
'numberofedits' => array( 1, 'NUMBEROFEDITS' ),
- 'numberofviews' => array( 1, 'NUMBEROFVIEWS' ),
'pagename' => array( 1, 'PAGENAME' ),
'pagenamee' => array( 1, 'PAGENAMEE' ),
'namespace' => array( 1, 'NAMESPACE' ),
numberoffiles
numberofpages
numberofusers
-numberofviews
numberofwatchingusers
numedits
numentries
public function __construct() {
parent::__construct();
$this->mDescription = "Re-initialise the site statistics tables";
- $this->addOption(
- 'update',
- 'Update the existing statistics (preserves the ss_total_views field)'
- );
- $this->addOption( 'noviews', "Don't update the page view counter" );
+ $this->addOption( 'update', 'Update the existing statistics' );
$this->addOption( 'active', 'Also update active users count' );
$this->addOption( 'use-master', 'Count using the master database' );
}
$image = $counter->files();
$this->output( "{$image}\n" );
- if ( !$this->hasOption( 'noviews' ) ) {
- $this->output( "Counting total page views..." );
- $views = $counter->views();
- $this->output( "{$views}\n" );
- }
-
if ( $this->hasOption( 'update' ) ) {
$this->output( "\nUpdating site statistics..." );
$counter->refresh();
public function execute() {
$fields = array(
- 'ss_total_views' => 'Total views',
'ss_total_edits' => 'Total edits',
'ss_good_articles' => 'Number of articles',
'ss_total_pages' => 'Total pages',
#toc.tochidden,
div#f-poweredbyico,
div#f-copyrightico,
-li#viewcount,
li#about,
li#disclaimer,
li#mobileview,
$tables = array( 'user', 'user_properties', 'user_former_groups', 'page', 'page_restrictions',
'protected_titles', 'revision', 'text', 'pagelinks', 'imagelinks',
'categorylinks', 'templatelinks', 'externallinks', 'langlinks', 'iwlinks',
- 'site_stats', 'hitcounter', 'ipblocks', 'image', 'oldimage',
+ 'site_stats', 'ipblocks', 'image', 'oldimage',
'recentchanges', 'watchlist', 'interwiki', 'logging',
'querycache', 'objectcache', 'job', 'l10n_cache', 'redirect', 'querycachetwo',
'archive', 'user_groups', 'page_props', 'category', 'msg_resource', 'msg_resource_links'
'page_namespace' => 0,
'page_title' => ' ',
'page_restrictions' => null,
- 'page_counter' => 0,
'page_is_redirect' => 0,
'page_is_new' => 0,
'page_random' => 0,