'img_name' => $this->name
), $fname
);
+ } else {
+ # This is a new image
+ # Update the image count
+ $site_stats = $dbw->tableName( 'site_stats' );
+ $dbw->query( "UPDATE $site_stats SET ss_images=ss_images+1", $fname );
}
$article = new Article( $descTitle );
return;
}
$dbw->delete( 'image', array( 'img_name' => $image ) );
+
+ if ( $dbw->affectedRows() ) {
+ # Update site_stats
+ $site_stats = $dbw->tableName( 'site_stats' );
+ $dbw->query( "UPDATE $site_stats SET ss_images=ss_images-1", $fname );
+ }
+
+
$res = $dbw->select( 'oldimage', array( 'oi_archive_name' ), array( 'oi_name' => $image ) );
# Purge archive URLs from the squid
/* Delete thumbnails and refresh image metadata cache */
$this->img->purgeCache();
-
$deleted = $image;
}
* Return the number of files
*/
function wfNumberOfFiles() {
- $fname = 'Parser::wfNumberOfFiles';
+ $fname = 'wfNumberOfFiles';
wfProfileIn( $fname );
$dbr =& wfGetDB( DB_SLAVE );
- $res = $dbr->selectField('image', 'COUNT(*)', array(), $fname );
+ $numImages = $dbr->selectField('site_stats', 'ss_images', array(), $fname );
wfProfileOut( $fname );
- return $res;
+ return $numImages;
}
/**
$views = $row->ss_total_views;
$edits = $row->ss_total_edits;
$good = $row->ss_good_articles;
+ $images = $row->ss_images;
# This code is somewhat schema-agnostic, because I'm changing it in a minor release -- TS
if ( isset( $row->ss_total_pages ) && $row->ss_total_pages == -1 ) {
$admins = $dbr->selectField( 'user_groups', 'COUNT(*)', array( 'ug_group' => 'sysop' ), $fname );
$numJobs = $dbr->selectField( 'job', 'COUNT(*)', '', $fname );
- $numFiles = $dbr->selectField( 'image', 'COUNT(*)', '', $fname );
if ($action == 'raw') {
$wgOut->disable();
header( 'Pragma: nocache' );
- echo "total=$total;good=$good;views=$views;edits=$edits;users=$users;admins=$admins;files=$numFiles\n";
+ echo "total=$total;good=$good;views=$views;edits=$edits;users=$users;admins=$admins;images=$images\n";
return;
} else {
$text = '==' . wfMsg( 'sitestats' ) . "==\n" ;
$wgLang->formatNum( sprintf( '%.2f', $total ? $edits / $total : 0 ) ),
$wgLang->formatNum( sprintf( '%.2f', $edits ? $views / $edits : 0 ) ),
$wgLang->formatNum( $numJobs ),
- $wgLang->formatNum( $numFiles )
+ $wgLang->formatNum( $images )
);
$text .= "\n==" . wfMsg( 'userstats' ) . "==\n";
This includes \"talk\" pages, pages about {{SITENAME}}, minimal \"stub\"
pages, redirects, and others that probably don't qualify as content pages.
Excluding those, there are '''$2''' pages that are probably legitimate
-content pages. We have '''$8''' files uploaded.
+content pages.
+
+'''$8''' files have been uploaded.
There have been a total of '''$3''' page views, and '''$4''' page edits
since the wiki was setup.
--- /dev/null
+-- More statistics, for version 1.6
+
+ALTER TABLE /*$wgDBprefix*/site_stats ADD ss_images int(10) default '0';
+SELECT @images := COUNT(*) FROM /*$wgDBprefix*/image;
+UPDATE site_stats SET ss_images=@images;
-- Deprecated, no longer updated as of 1.5
ss_admins int(10) default '-1',
+ -- Number of images, equivalent to SELECT COUNT(*) FROM image
+ ss_images int(10) default '0',
+
UNIQUE KEY ss_row_id (ss_row_id)
) ENGINE=InnoDB;
-- Deprecated, no longer updated as of 1.5
ss_admins int(10) default '-1',
+ -- Number of images, equivalent to SELECT COUNT(*) FROM image
+ ss_images int(10) default '0',
+
UNIQUE KEY ss_row_id (ss_row_id)
) ENGINE=InnoDB;
array( 'site_stats', 'ss_total_pages', 'patch-ss_total_articles.sql' ),
array( 'interwiki', 'iw_trans', 'patch-interwiki-trans.sql' ),
array( 'ipblocks', 'ipb_range_start', 'patch-ipb_range_start.sql' ),
+ array( 'site_stats', 'ss_images', 'patch-ss_images.sql' ),
);
function rename_table( $from, $to, $patch ) {