blob: b7b7df979e3a6b48bb4b8ae1cb481732ce62a362 (
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
34
35
36
37
38
39
|
<?php
/**
* Undelete a page by fetching it from the archive table
*
* @file
* @ingroup Maintenance
*/
$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";
|