From 14303bfea4fd441c9912acf920be4676a102c133 Mon Sep 17 00:00:00 2001 From: withoutaname Date: Sat, 19 Jul 2014 21:09:26 -0700 Subject: [PATCH] Remove old maintenance script importTextFile.php Functionality is largely redundant to edit.php script. Change-Id: Idca2d0e3c38dc000618be9176072dd13757920b2 --- RELEASE-NOTES-1.24 | 1 + maintenance/importTextFile.php | 106 --------------------------------- 2 files changed, 1 insertion(+), 106 deletions(-) delete mode 100644 maintenance/importTextFile.php diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index 36795170d1..c077156127 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -259,6 +259,7 @@ changes to languages because of Bugzilla reports. * Removed global function wfViewPrevNext(). (deprecated since 1.19) * Removed global function xmlsafe() from Export.php. (moved to OAIRepo extension) * Removed Title::userCanRead(). (deprecated since 1.19) +* Removed maintenance script importTextFile.php. Use edit.php script instead. ==== Renamed classes ==== * CLDRPluralRuleConverter_Expression to CLDRPluralRuleConverterExpression diff --git a/maintenance/importTextFile.php b/maintenance/importTextFile.php deleted file mode 100644 index f73dd1c254..0000000000 --- a/maintenance/importTextFile.php +++ /dev/null @@ -1,106 +0,0 @@ - - */ - -$options = array( 'help', 'nooverwrite', 'norc' ); -$optionsWithArgs = array( 'title', 'user', 'comment' ); -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}..."; - if ( is_file( $filename ) ) { - - $title = isset( $options['title'] ) ? $options['title'] : titleFromFilename( $filename ); - $title = Title::newFromText( $title ); - - if ( is_object( $title ) ) { - - echo "\nUsing title '" . $title->getPrefixedText() . "'..."; - if ( !$title->exists() || !isset( $options['nooverwrite'] ) ) { - RequestContext::getMain()->setTitle( $title ); - - $text = file_get_contents( $filename ); - $user = isset( $options['user'] ) ? $options['user'] : 'Maintenance script'; - $user = User::newFromName( $user ); - - if ( is_object( $user ) ) { - - 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..."; - $page = WikiPage::factory( $title ); - $content = ContentHandler::makeContent( $text, $title ); - $page->doEditContent( $content, $comment, $flags, false, $user ); - echo "done.\n"; - } else { - echo "invalid username.\n"; - } - } else { - echo "page exists.\n"; - } - } else { - echo "invalid title.\n"; - } - } else { - echo "does not exist.\n"; - } -} - -function titleFromFilename( $filename ) { - $parts = explode( '/', $filename ); - $parts = explode( '.', $parts[count( $parts ) - 1] ); - - return $parts[0]; -} - -function showHelp() { - print << - - : Path to the file containing page content to import - -Options: - ---title - Title for the new page; default is to use the filename as a base ---user <user> - User to be associated with the edit ---comment <comment> - Edit summary ---nooverwrite - Don't overwrite existing content ---norc - Don't update recent changes ---help - Show this information - -EOF; -} -- 2.20.1