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 @@ ...@@ -12,7 +12,7 @@
require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../vendor/autoload.php';
use Zend\Config\Writer\PhpArray; use Laminas\Config\Writer\PhpArray;
$defaultConfig = [ $defaultConfig = [
'unicaen-app' => [ 'unicaen-app' => [
......
...@@ -8,16 +8,17 @@ ...@@ -8,16 +8,17 @@
} }
], ],
"require": { "require": {
"unicaen/app": "^3.0", "unicaen/app": "^3.0",
"unicaen/auth": "^3.0", "unicaen/auth": "^3.0",
"unicaen/bjy-authorize": "^3.0", "unicaen/bjy-authorize": "^3.0",
"unicaen/faq": "^3.0", "unicaen/faq": "^3.0",
"unicaen/ldap": "^3.0" "unicaen/ldap": "^3.0",
"laminas/laminas-dependency-plugin": "^2.1"
}, },
"require-dev": { "require-dev": {
"zendframework/zend-test": "^3.2", "laminas/laminas-test": "^3.2",
"phpunit/phpunit": ">=3.7", "phpunit/phpunit": ">=3.7",
"zendframework/zend-developer-tools": ">=1.0" "laminas/laminas-developer-tools": ">=1.0"
}, },
"scripts": { "scripts": {
"post-install-cmd": [ "post-install-cmd": [
......
This diff is collapsed.
<?php <?php
$modules = [ $modules = [
'Zend\Cache', 'Laminas\Cache',
'Zend\Filter', 'Laminas\Filter',
'Zend\Form', 'Laminas\Form',
'Zend\Hydrator', 'Laminas\Hydrator',
'Zend\I18n', 'Laminas\I18n',
'Zend\InputFilter', 'Laminas\InputFilter',
'Zend\Log', 'Laminas\Log',
'Zend\Mail', 'Laminas\Mail',
'Zend\Mvc\Console', 'Laminas\Mvc\Console',
'Zend\Mvc\I18n', 'Laminas\Mvc\I18n',
// 'Zend\Mvc\Plugin\FilePrg', // 'Laminas\Mvc\Plugin\FilePrg',
'Zend\Mvc\Plugin\FlashMessenger', 'Laminas\Mvc\Plugin\FlashMessenger',
// 'Zend\Mvc\Plugin\Identity', // 'Laminas\Mvc\Plugin\Identity',
'Zend\Mvc\Plugin\Prg', 'Laminas\Mvc\Plugin\Prg',
'Zend\Navigation', 'Laminas\Navigation',
'Zend\Paginator', 'Laminas\Paginator',
'Zend\Router', 'Laminas\Router',
'Zend\Session', 'Laminas\Session',
'Zend\Validator', 'Laminas\Validator',
'DoctrineModule', 'DoctrineModule',
'DoctrineORMModule', 'DoctrineORMModule',
...@@ -33,7 +33,7 @@ $modules = [ ...@@ -33,7 +33,7 @@ $modules = [
$applicationEnv = getenv('APPLICATION_ENV') ?: 'production'; $applicationEnv = getenv('APPLICATION_ENV') ?: 'production';
if ('development' === $applicationEnv) { if ('development' === $applicationEnv) {
$modules[] = 'ZendDeveloperTools'; $modules[] = 'Laminas\DeveloperTools';
// $modules[] = 'UnicaenCode'; // $modules[] = 'UnicaenCode';
} }
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
* enlevez l'extension ".dist" et adaptez son contenu à vos besoins. * enlevez l'extension ".dist" et adaptez son contenu à vos besoins.
*/ */
use Zend\Session\Storage\SessionArrayStorage; use Laminas\Session\Storage\SessionArrayStorage;
use Zend\Session\Validator\HttpUserAgent; use Laminas\Session\Validator\HttpUserAgent;
use Zend\Session\Validator\RemoteAddr; use Laminas\Session\Validator\RemoteAddr;
return [ return [
'unicaen-app' => [ 'unicaen-app' => [
...@@ -81,8 +81,8 @@ return [ ...@@ -81,8 +81,8 @@ return [
RemoteAddr::class, RemoteAddr::class,
// Erreur rencontrée avec ce validateur lorsqu'on passe en "Version pour ordinateur" sur un téléphone Android : // 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 // `Fatal error: Uncaught Laminas\Session\Exception\RuntimeException: Session validation failed
// in /var/www/app/vendor/zendframework/zend-session/src/SessionManager.php on line 162` // in /var/www/app/vendor/laminas/laminas-session/src/SessionManager.php on line 162`
//HttpUserAgent::class, //HttpUserAgent::class,
] ]
], ],
......
...@@ -76,7 +76,7 @@ $config = [ ...@@ -76,7 +76,7 @@ $config = [
/* role providers simply provide a list of roles that should be inserted /* role providers simply provide a list of roles that should be inserted
* into the Zend\Acl instance. the module comes with two providers, one * 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 * to specify roles in a config file and one to load roles using a
* Zend\Db adapter. * Laminas\Db adapter.
*/ */
'role_providers' => [ 'role_providers' => [
/** /**
......
...@@ -36,14 +36,14 @@ if ($zf2Path) { ...@@ -36,14 +36,14 @@ if ($zf2Path) {
$loader->add('Zend', $zf2Path); $loader->add('Zend', $zf2Path);
} else { } else {
include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array( Laminas\Loader\AutoloaderFactory::factory(array(
'Zend\Loader\StandardAutoloader' => array( 'Laminas\Loader\StandardAutoloader' => array(
'autoregister_zf' => true '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.'); throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');
} }
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
namespace Application; namespace Application;
use Zend\Mvc\ModuleRouteListener; use Laminas\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent; use Laminas\Mvc\MvcEvent;
use Zend\Http\Request as HttpRequest; use Laminas\Http\Request as HttpRequest;
use Zend\Session\SessionManager; use Laminas\Session\SessionManager;
class Module class Module
{ {
...@@ -19,7 +19,7 @@ class Module ...@@ -19,7 +19,7 @@ class Module
$moduleRouteListener->attach($eventManager); $moduleRouteListener->attach($eventManager);
/* Active un layout spécial si la requête est de type AJAX. Valable pour TOUS les modules de l'application. */ /* 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) { function (MvcEvent $e) {
$request = $e->getRequest(); $request = $e->getRequest();
if ($request instanceof HttpRequest && $request->isXmlHttpRequest()) { if ($request instanceof HttpRequest && $request->isXmlHttpRequest()) {
...@@ -41,7 +41,7 @@ class Module ...@@ -41,7 +41,7 @@ class Module
public function getAutoloaderConfig() public function getAutoloaderConfig()
{ {
return [ return [
'Zend\Loader\StandardAutoloader' => [ 'Laminas\Loader\StandardAutoloader' => [
'namespaces' => [ 'namespaces' => [
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
], ],
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
namespace Application\Controller; namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel; use Laminas\View\Model\ViewModel;
class IndexController extends AbstractActionController class IndexController extends AbstractActionController
{ {
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
namespace Demo; namespace Demo;
use Zend\Mvc\ModuleRouteListener; use Laminas\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent; use Laminas\Mvc\MvcEvent;
class Module class Module
{ {
...@@ -22,7 +22,7 @@ class Module ...@@ -22,7 +22,7 @@ class Module
$moduleRouteListener->attach($eventManager); $moduleRouteListener->attach($eventManager);
/* Active un layout spécial si la requête est de type AJAX. Valable pour TOUS les modules de l'application. */ /* 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) { function (MvcEvent $e) {
$request = $e->getRequest(); $request = $e->getRequest();
if ($request instanceof HttpRequest && $request->isXmlHttpRequest()) { if ($request instanceof HttpRequest && $request->isXmlHttpRequest()) {
...@@ -40,7 +40,7 @@ class Module ...@@ -40,7 +40,7 @@ class Module
public function getAutoloaderConfig() public function getAutoloaderConfig()
{ {
return array( return array(
'Zend\Loader\StandardAutoloader' => array( 'Laminas\Loader\StandardAutoloader' => array(
'namespaces' => array( 'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
), ),
......
...@@ -72,7 +72,7 @@ Interrogez la table `user` pour vérifier la présence de l'utilisateur `demo`, ...@@ -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| 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 : 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 ## Configuration du module
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
namespace Demo\Controller; namespace Demo\Controller;
use Zend\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel; use Laminas\View\Model\ViewModel;
class IndexController extends AbstractActionController class IndexController extends AbstractActionController
{ {
......
...@@ -11,4 +11,4 @@ chdir(dirname(__DIR__)); ...@@ -11,4 +11,4 @@ chdir(dirname(__DIR__));
require 'init_autoloader.php'; require 'init_autoloader.php';
// Run the application! // 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