summaryrefslogtreecommitdiff
path: root/maintenance/updateArticleCount.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2006-10-11 18:12:39 +0000
committerPierre Schmitz <pierre@archlinux.de>2006-10-11 18:12:39 +0000
commit183851b06bd6c52f3cae5375f433da720d410447 (patch)
treea477257decbf3360127f6739c2f9d0ec57a03d39 /maintenance/updateArticleCount.php
MediaWiki 1.7.1 wiederhergestellt
Diffstat (limited to 'maintenance/updateArticleCount.php')
-rw-r--r--maintenance/updateArticleCount.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/maintenance/updateArticleCount.php b/maintenance/updateArticleCount.php
new file mode 100644
index 00000000..112274d2
--- /dev/null
+++ b/maintenance/updateArticleCount.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Maintenance script to provide a better count of the number of articles
+ * and update the site statistics table, if desired
+ *
+ * @package MediaWiki
+ * @subpackage Maintenance
+ * @author Rob Church <robchur@gmail.com>
+ */
+
+$options = array( 'update', 'help' );
+require_once( 'commandLine.inc' );
+require_once( 'updateArticleCount.inc.php' );
+echo( "Update Article Count\n\n" );
+
+if( isset( $options['help'] ) && $options['help'] ) {
+ echo( "Usage: php updateArticleCount.php [--update]\n\n" );
+ echo( "--update : Update site statistics table\n" );
+ exit( 0 );
+}
+
+echo( "Counting articles..." );
+$counter = new ArticleCounter();
+$result = $counter->count();
+
+if( $result !== false ) {
+ echo( "found {$result}.\n" );
+ if( isset( $options['update'] ) && $options['update'] ) {
+ echo( "Updating site statistics table... " );
+ $dbw =& wfGetDB( DB_MASTER );
+ $dbw->update( 'site_stats', array( 'ss_good_articles' => $result ), array( 'ss_row_id' => 1 ), __METHOD__ );
+ echo( "done.\n" );
+ } else {
+ echo( "To update the site statistics table, run the script with the --update option.\n" );
+ }
+} else {
+ echo( "failed.\n" );
+}
+echo( "\n" );
+
+?> \ No newline at end of file