Quick hacky script to initialize site_stats row where missing.
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 29 Aug 2005 10:22:03 +0000 (10:22 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 29 Aug 2005 10:22:03 +0000 (10:22 +0000)
Note: the good pages count is probably wrong, since this is no longer
easy to count content on 1.5 schema. It may overcount some pages which
don't actually contain a '[' character.

maintenance/initStats.php [new file with mode: 0644]

diff --git a/maintenance/initStats.php b/maintenance/initStats.php
new file mode 100644 (file)
index 0000000..8580459
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+require_once( 'commandLine.inc' );
+
+$dbr =& wfGetDB( DB_SLAVE );
+
+$edits = $dbr->selectField( 'revision', 'COUNT(rev_id)', '' );
+$pages = $dbr->selectField( 'page', 'COUNT(page_id)',
+       array(
+               'page_namespace' => 0,
+               'page_is_redirect' => 0,
+               'page_len > 0',
+       )
+); // HACK APPROXIMATION
+
+echo "$wgDBname: setting edits $edits, pages $pages\n";
+
+$dbw =& wfGetDB( DB_MASTER );
+$dbw->insert( 'site_stats',
+       array( 'ss_row_id'=> 1,
+              'ss_total_views'   => 0,
+              'ss_total_edits'   => $edits,
+              'ss_good_articles' => $pages ) );
+
+?>
\ No newline at end of file