summaryrefslogtreecommitdiff
path: root/maintenance/deleteDefaultMessages.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-01-11 19:06:07 +0000
committerPierre Schmitz <pierre@archlinux.de>2007-01-11 19:06:07 +0000
commita58285fd06c8113c45377c655dd43cef6337e815 (patch)
treedfe31d3d12652352fe44890b4811eda0728faefb /maintenance/deleteDefaultMessages.php
parent20194986f6638233732ba1fc3e838f117d3cc9ea (diff)
Aktualisierung auf MediaWiki 1.9.0
Diffstat (limited to 'maintenance/deleteDefaultMessages.php')
-rw-r--r--maintenance/deleteDefaultMessages.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/maintenance/deleteDefaultMessages.php b/maintenance/deleteDefaultMessages.php
new file mode 100644
index 00000000..76924002
--- /dev/null
+++ b/maintenance/deleteDefaultMessages.php
@@ -0,0 +1,45 @@
+<?php
+
+/**
+ * Deletes all pages in the MediaWiki namespace which were last edited by
+ * "MediaWiki default".
+ */
+
+if ( !defined( 'MEDIAWIKI' ) ) {
+ require_once( 'commandLine.inc' );
+ deleteDefaultMessages();
+}
+
+function deleteDefaultMessages() {
+ $user = 'MediaWiki default';
+ $reason = 'No longer required';
+
+ global $wgUser;
+ $wgUser = User::newFromName( $user );
+ $wgUser->addGroup( 'bot' );
+
+ $dbr =& wfGetDB( DB_SLAVE );
+ $res = $dbr->select( array( 'page', 'revision' ),
+ array( 'page_namespace', 'page_title' ),
+ array(
+ 'page_namespace' => NS_MEDIAWIKI,
+ 'page_latest=rev_id',
+ 'rev_user_text' => 'MediaWiki default',
+ )
+ );
+
+ $dbw =& wfGetDB( DB_MASTER );
+
+ while ( $row = $dbr->fetchObject( $res ) ) {
+ if ( function_exists( 'wfWaitForSlaves' ) ) {
+ wfWaitForSlaves( 5 );
+ }
+ $dbw->ping();
+ $title = Title::makeTitle( $row->page_namespace, $row->page_title );
+ $article = new Article( $title );
+ $dbw->begin();
+ $article->doDeleteArticle( $reason );
+ $dbw->commit();
+ }
+}
+?>