Index: trunk/phase3/maintenance/importTextFile.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * @author Rob Church <robchur@gmail.com> |
11 | 11 | */ |
12 | 12 | |
13 | | -$options = array( 'help', 'nooverwrite', 'norc' ); |
| 13 | +$options = array( 'help', 'nooverwrite', 'norc' ); |
14 | 14 | $optionsWithArgs = array( 'title', 'user', 'comment' ); |
15 | 15 | require_once( 'commandLine.inc' ); |
16 | 16 | echo( "Import Text File\n\n" ); |
— | — | @@ -21,43 +21,43 @@ |
22 | 22 | $filename = $args[0]; |
23 | 23 | echo( "Using {$filename}..." ); |
24 | 24 | if( is_file( $filename ) ) { |
25 | | - |
| 25 | + |
26 | 26 | $title = isset( $options['title'] ) ? $options['title'] : titleFromFilename( $filename ); |
27 | 27 | $title = Title::newFromUrl( $title ); |
28 | | - |
| 28 | + |
29 | 29 | if( is_object( $title ) ) { |
30 | | - |
| 30 | + |
31 | 31 | echo( "\nUsing title '" . $title->getPrefixedText() . "'..." ); |
32 | 32 | if( !$title->exists() || !isset( $options['nooverwrite'] ) ) { |
33 | | - |
| 33 | + |
34 | 34 | $text = file_get_contents( $filename ); |
35 | 35 | $user = isset( $options['user'] ) ? $options['user'] : 'Maintenance script'; |
36 | 36 | $user = User::newFromName( $user ); |
37 | | - |
| 37 | + |
38 | 38 | if( is_object( $user ) ) { |
39 | | - |
| 39 | + |
40 | 40 | echo( "\nUsing username '" . $user->getName() . "'..." ); |
41 | 41 | $wgUser =& $user; |
42 | 42 | $comment = isset( $options['comment'] ) ? $options['comment'] : 'Importing text file'; |
43 | 43 | $flags = 0 | ( isset( $options['norc'] ) ? EDIT_SUPPRESS_RC : 0 ); |
44 | | - |
| 44 | + |
45 | 45 | echo( "\nPerforming edit..." ); |
46 | 46 | $article = new Article( $title ); |
47 | 47 | $article->doEdit( $text, $comment, $flags ); |
48 | 48 | echo( "done.\n" ); |
49 | | - |
| 49 | + |
50 | 50 | } else { |
51 | 51 | echo( "invalid username.\n" ); |
52 | 52 | } |
53 | | - |
| 53 | + |
54 | 54 | } else { |
55 | 55 | echo( "page exists.\n" ); |
56 | 56 | } |
57 | | - |
| 57 | + |
58 | 58 | } else { |
59 | 59 | echo( "invalid title.\n" ); |
60 | 60 | } |
61 | | - |
| 61 | + |
62 | 62 | } else { |
63 | 63 | echo( "does not exist.\n" ); |
64 | 64 | } |
— | — | @@ -71,16 +71,24 @@ |
72 | 72 | } |
73 | 73 | |
74 | 74 | function showHelp() { |
75 | | - echo( "Import the contents of a text file into a wiki page.\n" ); |
76 | | - echo( "USAGE: php importTextFile.php <options> <filename>\n\n" ); |
77 | | - echo( "<filename> : Path to the file containing page content to import\n\n" ); |
78 | | - echo( "Options:\n\n" ); |
79 | | - echo( "--title <title>\n\tTitle for the new page; default is to use the filename as a base\n" ); |
80 | | - echo( "--user <user>\n\tUser to be associated with the edit\n" ); |
81 | | - echo( "--comment <comment>\n\tEdit summary\n" ); |
82 | | - echo( "--nooverwrite\n\tDon't overwrite existing content\n" ); |
83 | | - echo( "--norc\n\tDon't update recent changes\n" ); |
84 | | - echo( "--help\n\tShow this information\n" ); |
85 | | - echo( "\n" ); |
| 75 | +print <<<EOF |
| 76 | +USAGE: php importTextFile.php <options> <filename> |
| 77 | + |
| 78 | +<filename> : Path to the file containing page content to import |
| 79 | + |
| 80 | +Options: |
| 81 | + |
| 82 | +--title <title> |
| 83 | + Title for the new page; default is to use the filename as a base |
| 84 | +--user <user> |
| 85 | + User to be associated with the edit |
| 86 | +--comment <comment> |
| 87 | + Edit summary |
| 88 | +--nooverwrite |
| 89 | + Don't overwrite existing content |
| 90 | +--norc |
| 91 | + Don't update recent changes |
| 92 | +--help |
| 93 | + Show this information |
| 94 | +EOF; |
86 | 95 | } |
87 | | - |
Index: trunk/phase3/CREDITS |
— | — | @@ -64,6 +64,7 @@ |
65 | 65 | * FunPika |
66 | 66 | * Happy-melon |
67 | 67 | * Jeremy Baron |
| 68 | +* Jidanni |
68 | 69 | * Juliano F. Ravasi |
69 | 70 | * Lucas Garczewski |
70 | 71 | * Louperivois |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -170,6 +170,7 @@ |
171 | 171 | * (bug 17478) Fixed a PHP Strict standards error in |
172 | 172 | maintenance/cleanupWatchlist.php |
173 | 173 | * (bug 17488) RSS/Atom links in left toolbar are now localized |
| 174 | +* (bug 17472) use print <<<EOF in maintenance/importTextFile.php |
174 | 175 | |
175 | 176 | == API changes in 1.15 == |
176 | 177 | * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions |