diff options
Diffstat (limited to 'maintenance/undelete.php')
-rw-r--r-- | maintenance/undelete.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/maintenance/undelete.php b/maintenance/undelete.php new file mode 100644 index 00000000..c9a2f9ed --- /dev/null +++ b/maintenance/undelete.php @@ -0,0 +1,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"; + + |