blob: c9a2f9ed36012cf43396af1e535b015d8093057b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?php
$usage = <<<EOT
Undelete a page
Usage: php undelete.php [-u <user>] [-r <reason>] <pagename>
EOT;
$optionsWithArgs = array( 'u', 'r' );
require_once( 'commandLine.inc' );
$user = 'Command line script';
$reason = '';
if ( isset( $options['u'] ) ) {
$user = $options['u'];
}
if ( isset( $options['r'] ) ) {
$reason = $options['r'];
}
$pageName = @$args[0];
$title = Title::newFromText( $pageName );
if ( !$title ) {
echo $usage;
exit( 1 );
}
$wgUser = User::newFromName( $user );
$archive = new PageArchive( $title );
echo "Undeleting " . $title->getPrefixedDBkey() . '...';
$archive->undelete( array(), $reason );
echo "done\n";
|