X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FimportTextFile.php;h=dadc84a4a95087dd7820a5f292520bef60330a6d;hb=d966178eadf6f5e30f4049c844fdb6afe827501f;hp=c04989c0a7bfd3a5c50bb6cd3ddbdf4e8b6fbfd2;hpb=dc102a6b425ea2ca864a2c313d3b13bd641505ef;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/importTextFile.php b/maintenance/importTextFile.php index c04989c0a7..dadc84a4a9 100644 --- a/maintenance/importTextFile.php +++ b/maintenance/importTextFile.php @@ -24,23 +24,23 @@ $options = array( 'help', 'nooverwrite', 'norc' ); $optionsWithArgs = array( 'title', 'user', 'comment' ); -require_once( __DIR__ . '/commandLine.inc' ); -echo( "Import Text File\n\n" ); +require_once __DIR__ . '/commandLine.inc'; +echo "Import Text File\n\n"; if ( count( $args ) < 1 || isset( $options['help'] ) ) { showHelp(); } else { $filename = $args[0]; - echo( "Using {$filename}..." ); + echo "Using {$filename}..."; if ( is_file( $filename ) ) { $title = isset( $options['title'] ) ? $options['title'] : titleFromFilename( $filename ); - $title = Title::newFromURL( $title ); + $title = Title::newFromText( $title ); if ( is_object( $title ) ) { - echo( "\nUsing title '" . $title->getPrefixedText() . "'..." ); + echo "\nUsing title '" . $title->getPrefixedText() . "'..."; if ( !$title->exists() || !isset( $options['nooverwrite'] ) ) { $text = file_get_contents( $filename ); @@ -49,31 +49,31 @@ if ( count( $args ) < 1 || isset( $options['help'] ) ) { if ( is_object( $user ) ) { - echo( "\nUsing username '" . $user->getName() . "'..." ); + echo "\nUsing username '" . $user->getName() . "'..."; $wgUser =& $user; $comment = isset( $options['comment'] ) ? $options['comment'] : 'Importing text file'; $flags = 0 | ( isset( $options['norc'] ) ? EDIT_SUPPRESS_RC : 0 ); - echo( "\nPerforming edit..." ); + echo "\nPerforming edit..."; $page = WikiPage::factory( $title ); $content = ContentHandler::makeContent( $text, $title ); $page->doEditContent( $content, $comment, $flags, false, $user ); - echo( "done.\n" ); + echo "done.\n"; } else { - echo( "invalid username.\n" ); + echo "invalid username.\n"; } } else { - echo( "page exists.\n" ); + echo "page exists.\n"; } } else { - echo( "invalid title.\n" ); + echo "invalid title.\n"; } } else { - echo( "does not exist.\n" ); + echo "does not exist.\n"; } }