Problem with module Omeka2Importer

Hi,
I wanted to test the use of the module Omeka2Importer, because we would like to migrate sites from Omeka Classic (V2.6.1) to Omeka S (V2.1.2)

On the first page of the importer, when I enter the Omeka 2 Api Endpoint (https://example.fr/api) , I get the following error :

Zend\Http\Client\Exception\InvalidArgumentException
Unable to locate adapter class “Zend\Http\Proxy”

Détails :

Zend\Http\Client\Exception\InvalidArgumentException: Unable to locate adapter class “Zend\Http\Proxy” in /applis/omeka/home/www/omeka-s/vendor/zendframework/zend-http/src/Client.php:194

Stack trace:

#0 /applis/omeka/home/www/omeka-s/vendor/zendframework/zend-http/src/Client.php(220): Zend\Http\Client->setAdapter(‘Zend\Http\Proxy’)

#1 /applis/omeka/home/www/omeka-s/vendor/zendframework/zend-http/src/Client.php(881): Zend\Http\Client->getAdapter()

#2 /applis/omeka/home/www/omeka-s/modules/Omeka2Importer/src/Service/Omeka2Client.php(172): Zend\Http\Client->send()

#3 [internal function]: Omeka2Importer\Service\Omeka2Client->get()

#4 /applis/omeka/home/www/omeka-s/modules/Omeka2Importer/src/Service/Omeka2Client.php(85): call_user_func_array(Array, Array)

#5 /applis/omeka/home/www/omeka-s/modules/Omeka2Importer/src/Controller/IndexController.php(96): Omeka2Importer\Service\Omeka2Client->__call(‘get’, Array)

#6 /applis/omeka/home/www/omeka-s/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(78): Omeka2Importer\Controller\IndexController->mapElementsAction()

#7 /applis/omeka/home/www/omeka-s/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))

#8 /applis/omeka/home/www/omeka-s/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))

#9 /applis/omeka/home/www/omeka-s/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(106): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))

#10 /applis/omeka/home/www/omeka-s/vendor/zendframework/zend-mvc/src/DispatchListener.php(138): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))

#11 /applis/omeka/home/www/omeka-s/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))

#12 /applis/omeka/home/www/omeka-s/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))

#13 /applis/omeka/home/www/omeka-s/vendor/zendframework/zend-mvc/src/Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))

#14 /applis/omeka/home/www/omeka-s/index.php(21): Zend\Mvc\Application->run()

However, we had changed Zend’s configuration to indicate to use the Proxy Adapter, as we have been doing for a long time on our Omeka Classic sites.

And it works on our Omeka S site for other types of external access.

And by the way, I access an item from the Omeka S site via the API :

https://example.com/api/items/965

Does anyone have any ideas ?

Thank you in advance

Can you share the part of your configuration that sets the Proxy adapter, and any other HTTP client local settings you may have?

This could simply be an issue in that configuration, I’m thinking.

Hi,

I had changed Zend’s configuration to indicate to use the Proxy Adapter like this :

  • File …/vendor/zendframework/zend-http/src/Client.php :

protected $config = [
‘maxredirects’ => 5,
‘strictredirects’ => false,
‘useragent’ => Client::class,
‘timeout’ => 10,
‘connecttimeout’ => null,
’adapter’ => Proxy::class,
‘httpversion’ => Request::VERSION_11,
‘storeresponse’ => true,
‘keepalive’ => false,
‘outputstream’ => false,
‘encodecookies’ => true,
‘argseparator’ => null,
‘rfc3986strict’ => false,
‘sslcafile’ => null,
‘sslcapath’ => null,
];

  • File …/vendor/zendframework/zend-http/src/Client/Adapter/Proxy.php :

protected $config = [
‘persistent’ => false,
‘ssltransport’ => ‘ssl’,
‘sslcert’ => null,
‘sslpassphrase’ => null,
‘sslverifypeer’ => false,
‘sslcafile’ => null,
‘sslcapath’ => null,
‘sslallowselfsigned’ => false,
‘sslusecontext’ => false,
‘sslverifypeername’ => false,
’proxy_host’ => ‘proxyout.x.fr’,
‘proxy_port’ => 8080,
‘proxy_user’ => ‘’,
‘proxy_pass’ => ‘’,
‘proxy_auth’ => Client::AUTH_BASIC,
];

I modified the following configuration file :

  • File module.config.php :

‘http_client’ => [
’adapter’ => \Zend\Http\Client\Adapter\Proxy::class,
‘sslcapath’ => null,
‘sslcafile’ => null,
],

On the other hand, in the php.ini file, I specified the name of a file that is automatically parsed before the main file :

  • File php.ini :

auto_prepend_file = “…/prepend.php”

  • File prepend.php :
    stream_context_set_default(
    array(
    ‘http’ => array(
    ‘proxy’ => ‘proxyout.x.fr:8080’,
    ‘request_fulluri’ => true,
    ),
    ‘https’ => array(
    ‘proxy’ => ‘proxyout.x.fr:8080’,
    ‘request_fulluri’ => true,
    )
    )
    );

I’m thinking the issue is in the change to the zend-http Client.php file. Proxy::class in that file without adding a use line would be Zend\Http\Proxy and not Zend\Http\Client\Adapter\Proxy as it should be.

A couple other notes: you don’t need to edit application/config/module.config.php directly: this is what config/local.config.php is for. Anything set in the local.config.php overrides settings in the main and module configs.

More broadly, you shouldn’t need to edit the zend-http source files at all. The reason you’re having to here, and the problem is only showing up for the Omeka 2 Importer and not other places, is that you actually have the correct adapter set in the config file, but the importer module isn’t written to pick up the settings from the config files. So it’s one of the few (maybe only) places where your direct change to the zend-http Client.php file is taking effect. We’ll make a change to the importer module to fix that issue.

Thank you for this information

While waiting for making change to the importer module to fix that issue, I added a use line Zend\Http\Client\Adapter\Proxy into the zend-http Client.php file.

I tried again and the results are as follows :

Endpoint https

This does not work.

Endpoint http

  • With Web accelerator, I go to the next step

  • Without Web accelerator, this does not work.

Thank you very much for your answers.

Hmm, I’m not super familiar with the workings of the proxy adapter. When you things don’t work, are you getting an error message? And if so, what is it?