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