* Convert "$dbw =& wfGetDB( DB_MASTER );" --> "$dbw = wfGetDB( DB_MASTER );" * convert "$skin =& $wgUser->getSkin();" --> "$skin = $wgUser->getSkin();" For the time being have not changed the function definitions of wfGetDB() or User::getSkin() [i.e. they are still both return-by-ref], so as to ensure the interface does not change for extensions [some of which may still be trying to run on PHP4 environments]. However presumably at some point this can be changed too. Also includes tiny tweak to newlines in parserTests - will show 1 rather than 2 newlines between the "Reading tests from" strings when in quiet mode.
45 lines
1,005 B
PHP
45 lines
1,005 B
PHP
<?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();
|
|
}
|
|
}
|
|
?>
|