diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
commit | d9022f63880ce039446fba8364f68e656b7bf4cb (patch) | |
tree | 16b40fbf17bf7c9ee6f4ead25b16dd192378050a /maintenance/importSiteScripts.php | |
parent | 27cf83d177256813e2e802241085fce5dd0f3fb9 (diff) |
Update to MediaWiki 1.19.0
Diffstat (limited to 'maintenance/importSiteScripts.php')
-rw-r--r-- | maintenance/importSiteScripts.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/maintenance/importSiteScripts.php b/maintenance/importSiteScripts.php index 849c7b1b..0dc200ec 100644 --- a/maintenance/importSiteScripts.php +++ b/maintenance/importSiteScripts.php @@ -1,8 +1,11 @@ <?php /** - * Maintenance script to import all scripts in the MediaWiki namespace from a + * Maintenance script to import all scripts in the MediaWiki namespace from a * local site. + * @file + * @ingroup Maintenance */ + require_once( dirname( __FILE__ ) . '/Maintenance.php' ); class ImportSiteScripts extends Maintenance { @@ -16,22 +19,29 @@ class ImportSiteScripts extends Maintenance { public function execute() { global $wgUser; - $wgUser = User::newFromName( $this->getOption( 'username', 'ScriptImporter' ) ); + + $user = User::newFromName( $this->getOption( 'username', 'ScriptImporter' ) ); + $wgUser = $user; $baseUrl = $this->getArg( 1 ); $pageList = $this->fetchScriptList(); $this->output( 'Importing ' . count( $pageList ) . " pages\n" ); foreach ( $pageList as $page ) { + $title = Title::makeTitleSafe( NS_MEDIAWIKI, $page ); + if ( !$title ) { + $this->error( "$page is an invalid title; it will not be imported\n" ); + continue; + } + $this->output( "Importing $page\n" ); $url = wfAppendQuery( $baseUrl, array( 'action' => 'raw', 'title' => "MediaWiki:{$page}" ) ); $text = Http::get( $url ); - - $title = Title::makeTitleSafe( NS_MEDIAWIKI, $page ); - $article = new Article( $title ); - $article->doEdit( $text, "Importing from $url", 0 ); + + $wikiPage = WikiPage::factory( $title ); + $wikiPage->doEdit( $text, "Importing from $url", 0, false, $user ); } } |