Merge "Define $wgAlwaysUseTidy to false where needed in unit tests"
[lhc/web/wiklou.git] / maintenance / importSiteScripts.php
index b4a1bac..fabc6dc 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup Maintenance
  */
 
-require_once( dirname( __FILE__ ) . '/Maintenance.php' );
+require_once( __DIR__ . '/Maintenance.php' );
 
 /**
  * Maintenance script to import all scripts in the MediaWiki namespace from a
@@ -56,16 +56,14 @@ class ImportSiteScripts extends Maintenance {
                        }
 
                        $this->output( "Importing $page\n" );
-                       $uri = new Uri( $baseUrl );
-                       $uri->extendQuery( array(
+                       $url = wfAppendQuery( $baseUrl, array(
                                'action' => 'raw',
                                'title' => "MediaWiki:{$page}" ) );
-                       $url = $uri->toString();
-
                        $text = Http::get( $url );
 
                        $wikiPage = WikiPage::factory( $title );
-                       $wikiPage->doEdit( $text, "Importing from $url", 0, false, $user );
+                       $content = ContentHandler::makeContent( $text, $wikiPage->getTitle() );
+                       $wikiPage->doEditContent( $content, "Importing from $url", 0, false, $user );
                }
 
        }
@@ -82,9 +80,7 @@ class ImportSiteScripts extends Maintenance {
                $pages = array();
 
                do {
-                       $uri = new Uri( $baseUrl );
-                       $uri->extendQuery( $data );
-                       $url = $uri->toString();
+                       $url = wfAppendQuery( $baseUrl, $data );
                        $strResult = Http::get( $url );
                        //$result = FormatJson::decode( $strResult ); // Still broken
                        $result = unserialize( $strResult );