Index: trunk/phase3/maintenance/deleteDefaultMessages.php |
— | — | @@ -31,10 +31,8 @@ |
32 | 32 | } |
33 | 33 | |
34 | 34 | public function execute() { |
| 35 | + global $wgUser; |
35 | 36 | |
36 | | - $user = 'MediaWiki default'; |
37 | | - $reason = 'No longer required'; |
38 | | - |
39 | 37 | $this->output( "Checking existence of old default messages..." ); |
40 | 38 | $dbr = wfGetDB( DB_SLAVE ); |
41 | 39 | $res = $dbr->select( array( 'page', 'revision' ), |
— | — | @@ -54,12 +52,12 @@ |
55 | 53 | |
56 | 54 | # Deletions will be made by $user temporarly added to the bot group |
57 | 55 | # in order to hide it in RecentChanges. |
58 | | - global $wgUser; |
59 | | - $wgUser = User::newFromName( $user ); |
60 | | - if ( !$wgUser ) { |
| 56 | + $user = User::newFromName( 'MediaWiki default' ); |
| 57 | + if ( !$user ) { |
61 | 58 | $this->error( "Invalid username", true ); |
62 | 59 | } |
63 | | - $wgUser->addGroup( 'bot' ); |
| 60 | + $user->addGroup( 'bot' ); |
| 61 | + $wgUser = $user; |
64 | 62 | |
65 | 63 | # Handle deletion |
66 | 64 | $this->output( "\n...deleting old default messages (this may take a long time!)...", 'msg' ); |
— | — | @@ -69,9 +67,10 @@ |
70 | 68 | wfWaitForSlaves(); |
71 | 69 | $dbw->ping(); |
72 | 70 | $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
73 | | - $article = new Article( $title ); |
| 71 | + $page = WikiPage::factory( $title ); |
74 | 72 | $dbw->begin(); |
75 | | - $article->doDeleteArticle( $reason ); |
| 73 | + $error = ''; // Passed by ref |
| 74 | + $page->doDeleteArticle( 'No longer required', false, 0, false, $error, $user ); |
76 | 75 | $dbw->commit(); |
77 | 76 | } |
78 | 77 | |