2007-01-05 18:08:29 +00:00
|
|
|
<?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 );
|
2007-01-07 11:21:41 +00:00
|
|
|
$wgUser->addGroup( 'bot' );
|
|
|
|
|
|
2007-01-22 23:50:42 +00:00
|
|
|
$dbr = wfGetDB( DB_SLAVE );
|
2007-01-05 18:08:29 +00:00
|
|
|
$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',
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
2007-01-22 23:50:42 +00:00
|
|
|
$dbw = wfGetDB( DB_MASTER );
|
2007-01-05 18:08:29 +00:00
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|