X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FimportSiteScripts.php;h=7fdb355a91aa88cb22f71b6d15fe7fd4f33056c8;hb=3302e11b23301ee55196b372c1cf5ff48a5ab6c3;hp=5dfd2a87954429a3372296832d8c060e989235c5;hpb=7436cd31a2dde6d8f7d5b4ede152b2869e3f3623;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/importSiteScripts.php b/maintenance/importSiteScripts.php index 5dfd2a8795..7fdb355a91 100644 --- a/maintenance/importSiteScripts.php +++ b/maintenance/importSiteScripts.php @@ -32,7 +32,7 @@ require_once __DIR__ . '/Maintenance.php'; class ImportSiteScripts extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = 'Import site scripts from a site'; + $this->addDescription( 'Import site scripts from a site' ); $this->addArg( 'api', 'API base url' ); $this->addArg( 'index', 'index.php base url' ); $this->addOption( 'username', 'User name of the script importer' ); @@ -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;