Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ CHANGELOG ----- - Suppression du ConsoleController utilisé par une seule appli pour lancer une ligne SQL. - Suppression de la dépendance avec unicaen/console. 6.0.10 ----- Loading Module.php +6 −11 Original line number Diff line number Diff line Loading @@ -17,13 +17,10 @@ use Laminas\Validator\AbstractValidator; use Laminas\View\Helper\Navigation; use Laminas\View\HelperPluginManager; use Locale; use Unicaen\Console\Console; use Unicaen\Console\View\ExceptionStrategy as ConsoleExceptionStrategy; use UnicaenApp\Controller\Plugin\MessengerPluginFactory; use UnicaenApp\Controller\Plugin\Upload\UploaderPluginFactory; use UnicaenApp\Mvc\Listener\MaintenanceListener; use UnicaenApp\Mvc\Listener\ModalListener; use UnicaenApp\Mvc\View\Http\ExceptionStrategy; use UnicaenApp\Mvc\View\Http\ExceptionStrategy as HttpExceptionStrategy; use UnicaenApp\Options\ModuleOptions; Loading Loading @@ -93,15 +90,13 @@ class Module implements $eventManager = $application->getEventManager(); /** @var HttpExceptionStrategy|ConsoleExceptionStrategy $baseExceptionStrategy */ if ($e->getRequest() instanceof HttpRequest) { /** @var HttpExceptionStrategy $baseExceptionStrategy */ $baseExceptionStrategy = $services->get('HttpExceptionStrategy'); } else { $baseExceptionStrategy = $services->get('ConsoleExceptionStrategy'); } $exceptionStrategy = new ExceptionStrategy(); $exceptionStrategy = new HttpExceptionStrategy(); $exceptionStrategy->setDisplayExceptions($baseExceptionStrategy->displayExceptions()); $exceptionStrategy->attach($eventManager); } /* Démarrage des mouchards en fonction de la configuration... */ $services->get('MouchardService')->createMouchardsFromConfig(); Loading Loading @@ -148,7 +143,7 @@ class Module implements */ public function bootstrapSession($e) { if (Console::isConsole()) { if (Util::isConsole()) { return; } Loading @@ -174,7 +169,7 @@ class Module implements */ public function appendSessionRefreshJs(EventInterface $e) { if (Console::isConsole()) { if (Util::isConsole()) { return; } Loading src/UnicaenApp/Mvc/View/Http/ExceptionStrategy.php +2 −2 Original line number Diff line number Diff line Loading @@ -8,8 +8,8 @@ use Laminas\Mvc\Application; use Laminas\Mvc\MvcEvent; use Laminas\Stdlib\ResponseInterface as Response; use Laminas\View\Model\ViewModel; use Unicaen\Console\Console; use UnicaenApp\Exception\ExceptionInterface; use UnicaenApp\Util; /** * Stratégie permettant d'afficher proprement un message d'erreur lorsqu'une exception est levée Loading Loading @@ -61,7 +61,7 @@ class ExceptionStrategy extends \Laminas\Mvc\View\Http\ExceptionStrategy } // Do nothing if the request is console type if (Console::isConsole()) { if (Util::isConsole()) { return; } Loading src/UnicaenApp/Util.php +17 −8 Original line number Diff line number Diff line Loading @@ -23,7 +23,12 @@ class Util */ static protected $microtime; /** * Allow overriding whether or not we're in a console env. If set, and * boolean, returns that value from isConsole(). * @var bool */ protected static $isConsole; /** * Transforme en tableau simple une collection d'objets spécifiée sous forme d'un itérateur. Loading Loading @@ -776,15 +781,19 @@ class Util return $content; } /** * Détermine si on est en mode console ou non * Check if running in a console environment (CLI) * * By default, returns value of PHP_SAPI global constant. If $isConsole is * set, and a boolean value, that value will be returned. * * @return bool */ static public function isConsole(): bool public static function isConsole() { return PHP_SAPI == 'cli'; if (null === static::$isConsole) { static::$isConsole = (PHP_SAPI == 'cli'); } return static::$isConsole; } } src/UnicaenApp/View/Helper/AppLinkFactory.php +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ namespace UnicaenApp\View\Helper; use Psr\Container\ContainerInterface; use Laminas\ServiceManager\FactoryInterface; use Laminas\ServiceManager\ServiceLocatorInterface; use Unicaen\Console\Console; use UnicaenApp\Util; /** * Description of AppLinkFactory Loading @@ -22,7 +22,7 @@ class AppLinkFactory implements FactoryInterface public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $sl = $container; $router = Console::isConsole() ? 'HttpRouter' : 'Router'; $router = Util::isConsole() ? 'HttpRouter' : 'Router'; $match = $sl->get('application')->getMvcEvent()->getRouteMatch(); $helper = new AppLink(); Loading Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ CHANGELOG ----- - Suppression du ConsoleController utilisé par une seule appli pour lancer une ligne SQL. - Suppression de la dépendance avec unicaen/console. 6.0.10 ----- Loading
Module.php +6 −11 Original line number Diff line number Diff line Loading @@ -17,13 +17,10 @@ use Laminas\Validator\AbstractValidator; use Laminas\View\Helper\Navigation; use Laminas\View\HelperPluginManager; use Locale; use Unicaen\Console\Console; use Unicaen\Console\View\ExceptionStrategy as ConsoleExceptionStrategy; use UnicaenApp\Controller\Plugin\MessengerPluginFactory; use UnicaenApp\Controller\Plugin\Upload\UploaderPluginFactory; use UnicaenApp\Mvc\Listener\MaintenanceListener; use UnicaenApp\Mvc\Listener\ModalListener; use UnicaenApp\Mvc\View\Http\ExceptionStrategy; use UnicaenApp\Mvc\View\Http\ExceptionStrategy as HttpExceptionStrategy; use UnicaenApp\Options\ModuleOptions; Loading Loading @@ -93,15 +90,13 @@ class Module implements $eventManager = $application->getEventManager(); /** @var HttpExceptionStrategy|ConsoleExceptionStrategy $baseExceptionStrategy */ if ($e->getRequest() instanceof HttpRequest) { /** @var HttpExceptionStrategy $baseExceptionStrategy */ $baseExceptionStrategy = $services->get('HttpExceptionStrategy'); } else { $baseExceptionStrategy = $services->get('ConsoleExceptionStrategy'); } $exceptionStrategy = new ExceptionStrategy(); $exceptionStrategy = new HttpExceptionStrategy(); $exceptionStrategy->setDisplayExceptions($baseExceptionStrategy->displayExceptions()); $exceptionStrategy->attach($eventManager); } /* Démarrage des mouchards en fonction de la configuration... */ $services->get('MouchardService')->createMouchardsFromConfig(); Loading Loading @@ -148,7 +143,7 @@ class Module implements */ public function bootstrapSession($e) { if (Console::isConsole()) { if (Util::isConsole()) { return; } Loading @@ -174,7 +169,7 @@ class Module implements */ public function appendSessionRefreshJs(EventInterface $e) { if (Console::isConsole()) { if (Util::isConsole()) { return; } Loading
src/UnicaenApp/Mvc/View/Http/ExceptionStrategy.php +2 −2 Original line number Diff line number Diff line Loading @@ -8,8 +8,8 @@ use Laminas\Mvc\Application; use Laminas\Mvc\MvcEvent; use Laminas\Stdlib\ResponseInterface as Response; use Laminas\View\Model\ViewModel; use Unicaen\Console\Console; use UnicaenApp\Exception\ExceptionInterface; use UnicaenApp\Util; /** * Stratégie permettant d'afficher proprement un message d'erreur lorsqu'une exception est levée Loading Loading @@ -61,7 +61,7 @@ class ExceptionStrategy extends \Laminas\Mvc\View\Http\ExceptionStrategy } // Do nothing if the request is console type if (Console::isConsole()) { if (Util::isConsole()) { return; } Loading
src/UnicaenApp/Util.php +17 −8 Original line number Diff line number Diff line Loading @@ -23,7 +23,12 @@ class Util */ static protected $microtime; /** * Allow overriding whether or not we're in a console env. If set, and * boolean, returns that value from isConsole(). * @var bool */ protected static $isConsole; /** * Transforme en tableau simple une collection d'objets spécifiée sous forme d'un itérateur. Loading Loading @@ -776,15 +781,19 @@ class Util return $content; } /** * Détermine si on est en mode console ou non * Check if running in a console environment (CLI) * * By default, returns value of PHP_SAPI global constant. If $isConsole is * set, and a boolean value, that value will be returned. * * @return bool */ static public function isConsole(): bool public static function isConsole() { return PHP_SAPI == 'cli'; if (null === static::$isConsole) { static::$isConsole = (PHP_SAPI == 'cli'); } return static::$isConsole; } }
src/UnicaenApp/View/Helper/AppLinkFactory.php +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ namespace UnicaenApp\View\Helper; use Psr\Container\ContainerInterface; use Laminas\ServiceManager\FactoryInterface; use Laminas\ServiceManager\ServiceLocatorInterface; use Unicaen\Console\Console; use UnicaenApp\Util; /** * Description of AppLinkFactory Loading @@ -22,7 +22,7 @@ class AppLinkFactory implements FactoryInterface public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $sl = $container; $router = Console::isConsole() ? 'HttpRouter' : 'Router'; $router = Util::isConsole() ? 'HttpRouter' : 'Router'; $match = $sl->get('application')->getMvcEvent()->getRouteMatch(); $helper = new AppLink(); Loading