X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FimportSiteScripts.php;h=e60e776328badaa64b6eb07a75cbcd33d1d1f29d;hb=5bbace1a3667997a6ecc94c2d7259615bdc4176c;hp=366594d090eda6c394c6fdb48f1ececfb7d2506e;hpb=9a3a412f86ba2568bdf85f9c5def51bdb422032d;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/importSiteScripts.php b/maintenance/importSiteScripts.php index 366594d090..e60e776328 100644 --- a/maintenance/importSiteScripts.php +++ b/maintenance/importSiteScripts.php @@ -43,7 +43,7 @@ class ImportSiteScripts extends Maintenance { $username = $this->getOption( 'username', false ); if ( $username === false ) { - $user = User::newSystemUser( 'ScriptImporter', array( 'steal' => true ) ); + $user = User::newSystemUser( 'ScriptImporter', [ 'steal' => true ] ); } else { $user = User::newFromName( $username ); } @@ -61,10 +61,10 @@ class ImportSiteScripts extends Maintenance { } $this->output( "Importing $page\n" ); - $url = wfAppendQuery( $baseUrl, array( + $url = wfAppendQuery( $baseUrl, [ 'action' => 'raw', - 'title' => "MediaWiki:{$page}" ) ); - $text = Http::get( $url, array(), __METHOD__ ); + 'title' => "MediaWiki:{$page}" ] ); + $text = Http::get( $url, [], __METHOD__ ); $wikiPage = WikiPage::factory( $title ); $content = ContentHandler::makeContent( $text, $wikiPage->getTitle() ); @@ -73,20 +73,20 @@ class ImportSiteScripts extends Maintenance { } protected function fetchScriptList() { - $data = array( + $data = [ 'action' => 'query', 'format' => 'json', 'list' => 'allpages', 'apnamespace' => '8', 'aplimit' => '500', 'continue' => '', - ); + ]; $baseUrl = $this->getArg( 0 ); - $pages = array(); + $pages = []; while ( true ) { $url = wfAppendQuery( $baseUrl, $data ); - $strResult = Http::get( $url, array(), __METHOD__ ); + $strResult = Http::get( $url, [], __METHOD__ ); $result = FormatJson::decode( $strResult, true ); $page = null; @@ -114,5 +114,5 @@ class ImportSiteScripts extends Maintenance { } } -$maintClass = 'ImportSiteScripts'; +$maintClass = ImportSiteScripts::class; require_once RUN_MAINTENANCE_IF_MAIN;