server/src/app/Console/Commands/ImportCocoonRDF.php
changeset 544 ad58d7627f70
parent 531 48f5380c26d0
equal deleted inserted replaced
543:aaaf9b0b09f6 544:ad58d7627f70
     7 use Illuminate\Console\Command;
     7 use Illuminate\Console\Command;
     8 use Symfony\Component\Console\Input\InputOption;
     8 use Symfony\Component\Console\Input\InputOption;
     9 use Symfony\Component\Console\Input\InputArgument;
     9 use Symfony\Component\Console\Input\InputArgument;
    10 use Phpoaipmh\Client;
    10 use Phpoaipmh\Client;
    11 use Phpoaipmh\Endpoint;
    11 use Phpoaipmh\Endpoint;
       
    12 use Phpoaipmh\HttpAdapter\GuzzleAdapter;
    12 use CorpusParole\Libraries\Sparql\GuzzleSparqlClient;
    13 use CorpusParole\Libraries\Sparql\GuzzleSparqlClient;
    13 
    14 
    14 class ImportCocoonRDF extends Command {
    15 class ImportCocoonRDF extends Command {
    15 
    16 
    16     const INSERT_TIMEOUT_RETRY = 5;
    17     const INSERT_TIMEOUT_RETRY = 5;
   231             'modified' => 0,
   232             'modified' => 0,
   232             'replaced' => 0
   233             'replaced' => 0
   233         ];
   234         ];
   234 
   235 
   235         if($raw) {
   236         if($raw) {
   236             $client = new Client(Config::get('corpusparole.cocoon_oaipmh_url'));
   237             $client = new Client(Config::get('corpusparole.cocoon_oaipmh_url'), new GuzzleAdapter($this->httpClient));
   237             $endpoint = new Endpoint($client);
   238             $endpoint = new Endpoint($client);
   238 
   239 
   239             $recs = $endpoint->listRecords('olac', null, null, 'LanguesDeFrance');
   240             $recs = $endpoint->listRecords('olac', null, null, 'LanguesDeFrance');
   240 
   241 
   241             $progressBar = $this->output->createProgressBar($recs->getTotalRecordsInCollection());
   242             $progressBar = $this->output->createProgressBar($recs->getTotalRecordsInCollection());