Commit fbb42fea authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Migration vers laminas

parent a57b2359
Pipeline #10446 passed with stage
in 21 seconds
......@@ -12,7 +12,7 @@
require __DIR__ . '/../vendor/autoload.php';
use Zend\Config\Writer\PhpArray;
use Laminas\Config\Writer\PhpArray;
$defaultConfig = [
'unicaen-app' => [
......
This diff is collapsed.
<?php
$modules = [
'Zend\Cache',
'Zend\Filter',
'Zend\Form',
'Zend\Hydrator',
'Zend\I18n',
'Zend\InputFilter',
'Zend\Log',
'Zend\Mail',
'Zend\Mvc\Console',
'Zend\Mvc\I18n',
// 'Zend\Mvc\Plugin\FilePrg',
'Zend\Mvc\Plugin\FlashMessenger',
// 'Zend\Mvc\Plugin\Identity',
'Zend\Mvc\Plugin\Prg',
'Zend\Navigation',
'Zend\Paginator',
'Zend\Router',
'Zend\Session',
'Zend\Validator',
'Laminas\Cache',
'Laminas\Filter',
'Laminas\Form',
'Laminas\Hydrator',
'Laminas\I18n',
'Laminas\InputFilter',
'Laminas\Log',
'Laminas\Mail',
'Laminas\Mvc\Console',
'Laminas\Mvc\I18n',
// 'Laminas\Mvc\Plugin\FilePrg',
'Laminas\Mvc\Plugin\FlashMessenger',
// 'Laminas\Mvc\Plugin\Identity',
'Laminas\Mvc\Plugin\Prg',
'Laminas\Navigation',
'Laminas\Paginator',
'Laminas\Router',
'Laminas\Session',
'Laminas\Validator',
'DoctrineModule',
'DoctrineORMModule',
......@@ -33,7 +33,7 @@ $modules = [
$applicationEnv = getenv('APPLICATION_ENV') ?: 'production';
if ('development' === $applicationEnv) {
$modules[] = 'ZendDeveloperTools';
$modules[] = 'Laminas\DeveloperTools';
// $modules[] = 'UnicaenCode';
}
......
......@@ -6,9 +6,9 @@
* enlevez l'extension ".dist" et adaptez son contenu à vos besoins.
*/
use Zend\Session\Storage\SessionArrayStorage;
use Zend\Session\Validator\HttpUserAgent;
use Zend\Session\Validator\RemoteAddr;
use Laminas\Session\Storage\SessionArrayStorage;
use Laminas\Session\Validator\HttpUserAgent;
use Laminas\Session\Validator\RemoteAddr;
return [
'unicaen-app' => [
......@@ -81,8 +81,8 @@ return [
RemoteAddr::class,
// Erreur rencontrée avec ce validateur lorsqu'on passe en "Version pour ordinateur" sur un téléphone Android :
// `Fatal error: Uncaught Zend\Session\Exception\RuntimeException: Session validation failed
// in /var/www/app/vendor/zendframework/zend-session/src/SessionManager.php on line 162`
// `Fatal error: Uncaught Laminas\Session\Exception\RuntimeException: Session validation failed
// in /var/www/app/vendor/laminas/laminas-session/src/SessionManager.php on line 162`
//HttpUserAgent::class,
]
],
......
......@@ -76,7 +76,7 @@ $config = [
/* role providers simply provide a list of roles that should be inserted
* into the Zend\Acl instance. the module comes with two providers, one
* to specify roles in a config file and one to load roles using a
* Zend\Db adapter.
* Laminas\Db adapter.
*/
'role_providers' => [
/**
......
......@@ -36,14 +36,14 @@ if ($zf2Path) {
$loader->add('Zend', $zf2Path);
} else {
include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array(
'Zend\Loader\StandardAutoloader' => array(
Laminas\Loader\AutoloaderFactory::factory(array(
'Laminas\Loader\StandardAutoloader' => array(
'autoregister_zf' => true
)
));
}
}
if (!class_exists('Zend\Loader\AutoloaderFactory')) {
if (!class_exists('Laminas\Loader\AutoloaderFactory')) {
throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');
}
......@@ -2,10 +2,10 @@
namespace Application;
use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;
use Zend\Http\Request as HttpRequest;
use Zend\Session\SessionManager;
use Laminas\Mvc\ModuleRouteListener;
use Laminas\Mvc\MvcEvent;
use Laminas\Http\Request as HttpRequest;
use Laminas\Session\SessionManager;
class Module
{
......@@ -19,7 +19,7 @@ class Module
$moduleRouteListener->attach($eventManager);
/* Active un layout spécial si la requête est de type AJAX. Valable pour TOUS les modules de l'application. */
$eventManager->getSharedManager()->attach('Zend\Mvc\Controller\AbstractActionController', 'dispatch',
$eventManager->getSharedManager()->attach('Laminas\Mvc\Controller\AbstractActionController', 'dispatch',
function (MvcEvent $e) {
$request = $e->getRequest();
if ($request instanceof HttpRequest && $request->isXmlHttpRequest()) {
......@@ -41,7 +41,7 @@ class Module
public function getAutoloaderConfig()
{
return [
'Zend\Loader\StandardAutoloader' => [
'Laminas\Loader\StandardAutoloader' => [
'namespaces' => [
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
],
......
......@@ -9,8 +9,8 @@
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;
class IndexController extends AbstractActionController
{
......
......@@ -9,8 +9,8 @@
namespace Demo;
use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;
use Laminas\Mvc\ModuleRouteListener;
use Laminas\Mvc\MvcEvent;
class Module
{
......@@ -22,7 +22,7 @@ class Module
$moduleRouteListener->attach($eventManager);
/* Active un layout spécial si la requête est de type AJAX. Valable pour TOUS les modules de l'application. */
$eventManager->getSharedManager()->attach('Zend\Mvc\Controller\AbstractActionController', 'dispatch',
$eventManager->getSharedManager()->attach('Laminas\Mvc\Controller\AbstractActionController', 'dispatch',
function (MvcEvent $e) {
$request = $e->getRequest();
if ($request instanceof HttpRequest && $request->isXmlHttpRequest()) {
......@@ -40,7 +40,7 @@ class Module
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'Laminas\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
......
......@@ -72,7 +72,7 @@ Interrogez la table `user` pour vérifier la présence de l'utilisateur `demo`,
1|demo|demo@mail.fr|Demo|$2y$10$GmGzPXsLK5Kts30ZrS9QnOLsNYDgZ62797Kitp4Z1nWHlB1g7DZma|1|
NB: l'utilisateur `admin` a pour mot de passe `admin`, chiffré avec Bcrypt comme ceci :
`php --run 'require "vendor/autoload.php"; $bcrypt = new Zend\Crypt\Password\Bcrypt(); var_dump($bcrypt->create("xxx"));'`
`php --run 'require "vendor/autoload.php"; $bcrypt = new Laminas\Crypt\Password\Bcrypt(); var_dump($bcrypt->create("xxx"));'`
## Configuration du module
......
......@@ -2,8 +2,8 @@
namespace Demo\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;
class IndexController extends AbstractActionController
{
......
......@@ -11,4 +11,4 @@ chdir(dirname(__DIR__));
require 'init_autoloader.php';
// Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')->run();
Laminas\Mvc\Application::init(require 'config/application.config.php')->run();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment