Skip to content
Snippets Groups Projects
Commit c609e52f authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Adaptation php8.4

parent a9142609
No related branches found
No related tags found
No related merge requests found
Pipeline #38788 passed
Showing
with 797 additions and 772 deletions
......@@ -9,8 +9,9 @@
}
],
"require" : {
"php" : ">=8.2",
"php" : ">=8.4",
"laminas/laminas-cli" : "1.11.0",
"laminas/laminas-cache-storage-adapter-filesystem": 2.5.0,
"symfony/process" : "7.2.0",
"twbs/bootstrap" : "5.0.2",
......@@ -21,19 +22,20 @@
"datatables.net/datatables.net-bs5": "2.1.8",
"vakata/jstree" : "3.3.17",
"unicaen/app" : "7.1.0",
"unicaen/authentification" : "6.4.3",
"unicaen/privilege" : "6.2.1",
"unicaen/utilisateur" : "7.0.2",
"unicaen/code" : "6.5.0",
"unicaen/import" : "6.0.6",
"unicaen/tbl" : "6.2.5",
"unicaen/app" : "dev-php84",
"unicaen/authentification" : "dev-php84",
"unicaen/privilege" : "dev-php84",
"unicaen/utilisateur" : "dev-php84",
"unicaen/code" : "dev-master",
"unicaen/import" : "dev-php84",
"unicaen/tbl" : "dev-php84",
"unicaen/open-document" : "6.0.10",
"unicaen/siham" : "6.2.0",
"unicaen/mail" : "7.1.2",
"unicaen/mail" : "dev-php84",
"unicaen/vue" : "6.3.3",
"unicaen/bddadmin" : "1.4.2",
"unicaen/signature" : "1.0.6",
"unicaen/bddadmin" : "dev-main",
"unicaen/zfc-user": "dev-php84",
"unicaen/signature" : "dev-master",
"connecteur-ose/actul" : "dev-master",
"connecteur-ose/pegase" : "dev-master"
},
......
......
This diff is collapsed.
......@@ -111,4 +111,20 @@ return [
],
],
],
'caches' => [
'doctrinemodule.cache.filesystem' => [
'options' => [
'cache_dir' => 'cache/Doctrine',
],
],
/*'filesystem' => [
'class' => Laminas\Cache\Storage\Adapter\Filesystem::class,
//'options' => [
//],
//'cache_dir' => 'cache/Doctrine',
'directory' => 'cache/Doctrine',
'namespace' => 'DoctrineModule',
],*/
],
];
......@@ -2,6 +2,8 @@
$modules = [
'Laminas\Cache',
'Laminas\Cache\Storage\Adapter\Memory',
'Laminas\Cache\Storage\Adapter\Filesystem',
'Laminas\Filter',
'Laminas\Form',
'Laminas\Hydrator',
......@@ -9,7 +11,6 @@ $modules = [
'Laminas\InputFilter',
'Laminas\Mvc\I18n',
'Laminas\Mvc\Plugin\FlashMessenger',
'Laminas\Mvc\Plugin\Prg',
'Laminas\Navigation',
'Laminas\Paginator',
'Laminas\Router',
......
......
......@@ -20,7 +20,7 @@ class GestionAssertion extends AbstractAssertion
protected function assertController($controller, $action = null, $privilege = null)
protected function assertController($controller, $action = null, $privilege = null): bool
{
$role = $this->getRole();
......@@ -37,7 +37,7 @@ class GestionAssertion extends AbstractAssertion
protected function assertIntervenant( Role $role, $privilege )
protected function assertIntervenant( Role $role, $privilege ): bool
{
return $this->asserts([
!$privilege || $role->hasPrivilege($privilege), // pareil si le rôle ne possède pas le privilège adéquat
......
......
......@@ -33,7 +33,7 @@ class AgrementAssertion extends AbstractAssertion
protected function assertEntity(ResourceInterface $entity = null, $privilege = null)
protected function assertEntity(?ResourceInterface $entity = null, $privilege = null): bool
{
$role = $this->getRole();
......@@ -81,7 +81,7 @@ class AgrementAssertion extends AbstractAssertion
protected function assertController($controller, $action = null, $privilege = null)
protected function assertController($controller, $action = null, $privilege = null): bool
{
$role = $this->getRole();
$intervenant = $this->getMvcEvent()->getParam('intervenant');
......@@ -137,7 +137,7 @@ class AgrementAssertion extends AbstractAssertion
protected function assertPage(array $page)
protected function assertPage(array $page): bool
{
$role = $this->getRole();
$intervenant = $this->getMvcEvent()->getParam('intervenant');
......@@ -166,7 +166,7 @@ class AgrementAssertion extends AbstractAssertion
protected function assertTblAgrementSaisie(Role $role, TblAgrement $entity)
protected function assertTblAgrementSaisie(Role $role, TblAgrement $entity): bool
{
/* Si c'est pour agréer et que le workflow l'interdit alors non! */
if (!$entity->getAgrement() && !$this->isAllowed($entity->getResourceWorkflow())) {
......@@ -182,14 +182,14 @@ class AgrementAssertion extends AbstractAssertion
protected function assertTypeAgrementVisualisation(TypeAgrement $typeAgrement, Intervenant $intervenant)
protected function assertTypeAgrementVisualisation(TypeAgrement $typeAgrement, Intervenant $intervenant): bool
{
return $this->isAllowed(WorkflowResource::create($typeAgrement->getCode(), $intervenant));
}
protected function assertAgrementSaisie(Role $role, Agrement $entity)
protected function assertAgrementSaisie(Role $role, Agrement $entity): bool
{
if (!$this->isAllowed($entity->getResourceWorkflow())) {
return false;
......@@ -204,7 +204,7 @@ class AgrementAssertion extends AbstractAssertion
protected function assertStructureSaisie(Role $role, Structure $entity)
protected function assertStructureSaisie(Role $role, Structure $entity): bool
{
if ($roleStructure = $role->getStructure()) {
if (!$entity->inStructure($roleStructure)) return false; // pas d'édition pour les copains
......@@ -215,7 +215,7 @@ class AgrementAssertion extends AbstractAssertion
private function assertTblAgrementSuppression(Role $role, TblAgrement $entity)
private function assertTblAgrementSuppression(Role $role, TblAgrement $entity): bool
{
/* Si c'est pour agréer et que le workflow l'interdit alors non! */
......@@ -240,7 +240,7 @@ class AgrementAssertion extends AbstractAssertion
private function assertAgrementSuppression(Role $role, Agrement $entity)
private function assertAgrementSuppression(Role $role, Agrement $entity): bool
{
if (!$this->isAllowed($entity->getResourceWorkflow())) {
......
......
......@@ -71,7 +71,7 @@ class AgrementService extends AbstractEntityService
*
* @return QueryBuilder
*/
public function orderBy(QueryBuilder $qb = null, $alias = null)
public function orderBy(?QueryBuilder $qb = null, $alias = null)
{
[$qb, $alias] = $this->initQuery($qb, $alias);
$qb->addOrderBy("$alias.id");
......
......
......@@ -53,7 +53,7 @@ class TblAgrementService extends AbstractEntityService
*
* @return QueryBuilder
*/
public function orderBy(QueryBuilder $qb = null, $alias = null)
public function orderBy(?QueryBuilder $qb = null, $alias = null)
{
[$qb, $alias] = $this->initQuery($qb, $alias);
$qb->addOrderBy("$alias.intervenant,$alias.structure");
......
......
......@@ -71,7 +71,7 @@ class TypeAgrementService extends AbstractEntityService
*
* @return QueryBuilder
*/
public function orderBy(QueryBuilder $qb = null, $alias = null)
public function orderBy(?QueryBuilder $qb = null, $alias = null)
{
[$qb, $alias] = $this->initQuery($qb, $alias);
$qb->addOrderBy("$alias.id");
......
......
......@@ -2,8 +2,7 @@
namespace Application\Cache;
use Doctrine\Common\Cache\FileCache;
use Doctrine\Common\Cache\CacheProvider;
use function fclose;
use function fgets;
use function fopen;
......@@ -14,18 +13,62 @@ use function unserialize;
use const PHP_EOL;
class FilesystemCache extends FileCache
class FilesystemCache extends CacheProvider
{
public const EXTENSION = '.doctrinecache.data';
/** @var int */
private int $umask = 0000;
/**
* {@inheritdoc}
*/
public function __construct($directory = 'cache/Doctrine', $extension = self::EXTENSION, $umask = 0000)
{
parent::__construct($directory, $extension, $umask);
}
public function getFilename(string $id): string
{
return base64_encode($id);
}
/**
* {@inheritDoc}
*/
protected function doDelete($id): bool
{
$filename = $this->getFilename($id);
unset($filename);
return true;
}
/**
* {@inheritDoc}
*/
protected function doFlush()
{
return false;
}
/**
* {@inheritDoc}
*/
protected function doGetStats()
{
$storage = $this->storage;
return [
];
}
/**
* {@inheritdoc}
*/
......@@ -99,4 +142,59 @@ class FilesystemCache extends FileCache
return $this->writeFile($filename, $lifeTime . PHP_EOL . $data);
}
/**
* Writes a string content to file in an atomic way.
*
* @param string $filename Path to the file where to write the data.
* @param string $content The content to write
*
* @return bool TRUE on success, FALSE if path cannot be created, if path is not writable or an any other error.
*/
protected function writeFile(string $filename, string $content): bool
{
$filepath = pathinfo($filename, PATHINFO_DIRNAME);
if (! $this->createPathIfNeeded($filepath)) {
return false;
}
if (! is_writable($filepath)) {
return false;
}
$tmpFile = tempnam($filepath, 'swap');
@chmod($tmpFile, 0666 & (~$this->umask));
if (file_put_contents($tmpFile, $content) !== false) {
@chmod($tmpFile, 0666 & (~$this->umask));
if (@rename($tmpFile, $filename)) {
return true;
}
@unlink($tmpFile);
}
return false;
}
/**
* Create path if needed.
*
* @return bool TRUE on success or if path already exists, FALSE if path cannot be created.
*/
private function createPathIfNeeded(string $path): bool
{
if (! is_dir($path)) {
if (@mkdir($path, 0777 & (~$this->umask), true) === false && ! is_dir($path)) {
return false;
}
}
return true;
}
}
......@@ -13,7 +13,7 @@ use Psr\Container\ContainerInterface;
class ContextFactory
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
$context = new Context();
......
......
......@@ -6,7 +6,7 @@ use Psr\Container\ContainerInterface;
class HostLocalizationOseFactory
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
$hl = new HostLocalizationOse();
......
......
......@@ -21,7 +21,7 @@ class IdentityProviderFactory
*
* @return object
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
$identityProvider = new IdentityProvider;
......
......
......@@ -13,7 +13,7 @@ use Psr\Container\ContainerInterface;
class ResourceProviderFactory
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
$em = $container->get(EntityManager::class);
/* @var $em \Doctrine\ORM\EntityManager */
......
......
......@@ -19,7 +19,7 @@ class RoleProviderFactory
use ContextServiceAwareTrait;
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
$roleProvider = new RoleProvider();
$roleProvider
......
......
......@@ -132,7 +132,7 @@ abstract class AbstractEntityService extends AbstractService
*
* @return array
*/
public function initQuery(QueryBuilder $qb = null, $alias = null, array $fields = []): array
public function initQuery(?QueryBuilder $qb = null, $alias = null, array $fields = []): array
{
if (null === $alias) $alias = $this->getAlias();
if (empty($qb)) {
......@@ -279,7 +279,7 @@ abstract class AbstractEntityService extends AbstractService
* @param QueryBuilder|null $qb
* @param string|null $alias
*/
public function orderBy(QueryBuilder $qb = null, $alias = null)
public function orderBy(?QueryBuilder $qb = null, $alias = null)
{
[$qb, $alias] = $this->initQuery($qb, $alias);
......@@ -301,7 +301,7 @@ abstract class AbstractEntityService extends AbstractService
*
* @return Statut[]|array
*/
public function getList(QueryBuilder $qb = null, $alias = null)
public function getList(?QueryBuilder $qb = null, $alias = null)
{
[$qb, $alias] = $this->initQuery($qb, $alias);
$this->orderBy($qb);
......@@ -322,7 +322,7 @@ abstract class AbstractEntityService extends AbstractService
/**
* Retourne le nombre d'entités trouvé
*/
public function count(QueryBuilder $qb = null, ?string $alias = null): int
public function count(?QueryBuilder $qb = null, ?string $alias = null): int
{
[$qb, $alias] = $this->initQuery($qb, $alias);
$entities = $qb->getQuery()->execute();
......@@ -438,7 +438,7 @@ abstract class AbstractEntityService extends AbstractService
*
* @return QueryBuilder Retourne le QueryBuilder, pour chaîner les filtres au besoin
*/
public function finderByFilterObject($object, HydratorInterface $hydrator = null, QueryBuilder $qb = null, $alias = null, $exclude = [])
public function finderByFilterObject($object, ?HydratorInterface $hydrator = null, ?QueryBuilder $qb = null, ?string $alias = null, array $exclude = []): QueryBuilder
{
[$qb, $alias] = $this->initQuery($qb, $alias);
if (null === $object) return $qb;
......@@ -464,7 +464,7 @@ abstract class AbstractEntityService extends AbstractService
*
* @return QueryBuilder Retourne le QueryBuilder, pour chaîner les filtres au besoin
*/
public function finderByFilterArray(array $properties, QueryBuilder $qb = null, $alias = null, $exclude = [])
public function finderByFilterArray(array $properties, ?QueryBuilder $qb = null, ?string $alias = null, array $exclude = []): QueryBuilder
{
[$qb, $alias] = $this->initQuery($qb, $alias);
foreach ($properties as $property => $value) {
......@@ -490,7 +490,7 @@ abstract class AbstractEntityService extends AbstractService
*
* @return QueryBuilder
*/
public function finderByHistorique(QueryBuilder $qb = null, $alias = null)
public function finderByHistorique(?QueryBuilder $qb = null, $alias = null)
{
[$qb, $alias] = $this->initQuery($qb, $alias);
......@@ -507,7 +507,7 @@ abstract class AbstractEntityService extends AbstractService
/**
* Hack pour gérer le finder de structure différent des autres compte tenu de la hiérarchisation des structures
*/
public function finderByStructure(?Structure $structure, ?QueryBuilder $qb = null, $alias = null): QueryBuilder
public function finderByStructure(?Structure $structure, ?QueryBuilder $qb = null, ?string $alias = null): QueryBuilder
{
/** @var $qb QueryBuilder */
[$qb, $alias] = $this->initQuery($qb, $alias);
......@@ -535,7 +535,7 @@ abstract class AbstractEntityService extends AbstractService
*
* @return \Doctrine\ORM\QueryBuilder Retourne le QueryBuilder, pour chaîner les filtres au besoin
*/
public function finderByProperty($property, $value, QueryBuilder $qb = null, $alias = null)
public function finderByProperty($property, $value, ?QueryBuilder $qb = null, ?string $alias = null)
{
[$qb, $alias] = $this->initQuery($qb, $alias);
if ($value === null) {
......
......
......@@ -157,7 +157,7 @@ class AnneeService extends AbstractEntityService
* @param QueryBuilder|null $qb
* @param string|null $alias
*/
public function orderBy(QueryBuilder $qb = null, $alias = null)
public function orderBy(?QueryBuilder $qb = null, $alias = null)
{
[$qb, $alias] = $this->initQuery($qb, $alias);
$qb->addOrderBy("$alias.id");
......
......
......@@ -155,7 +155,7 @@ class LocalContextService extends AbstractService
*
* @return self
*/
public function setIntervenant(Intervenant $intervenant = null)
public function setIntervenant(?Intervenant $intervenant = null)
{
$this->intervenant = $intervenant;
$this->getSessionContainer()->intervenant = $intervenant ? $intervenant->getId() : null;
......@@ -171,7 +171,7 @@ class LocalContextService extends AbstractService
*
* @return self
*/
public function setStructure(Structure $structure = null)
public function setStructure(?Structure $structure = null)
{
$this->structure = $structure;
$this->getSessionContainer()->structure = $structure ? $structure->getId() : null;
......@@ -187,7 +187,7 @@ class LocalContextService extends AbstractService
*
* @return self
*/
public function setNiveau(NiveauEtape $niveau = null)
public function setNiveau(?NiveauEtape $niveau = null)
{
$this->niveau = $niveau;
$this->getSessionContainer()->niveau = $niveau ? $niveau->getId() : null;
......@@ -219,7 +219,7 @@ class LocalContextService extends AbstractService
*
* @return self
*/
public function setElementPedagogique(ElementPedagogique $elementPedagogique = null)
public function setElementPedagogique(?ElementPedagogique $elementPedagogique = null)
{
$this->elementPedagogique = $elementPedagogique;
$this->getSessionContainer()->elementPedagogique = $elementPedagogique ? $elementPedagogique->getId() : null;
......
......
......@@ -38,7 +38,7 @@ class PerimetreService extends AbstractEntityService
* @param QueryBuilder|null $queryBuilder
* @return Application\Entity\Db\Perimetre[]
*/
public function getList( QueryBuilder $qb=null, $alias=null )
public function getList( ?QueryBuilder $qb = null, $alias=null )
{
return parent::getList($qb, $alias);
}
......
......
......@@ -119,7 +119,7 @@ class PeriodeService extends AbstractEntityService
public function finderByMiseEnPaiement(Structure $structure = null, QueryBuilder $qb = null, $alias = null)
public function finderByMiseEnPaiement(Structure $structure = null, ?QueryBuilder $qb = null, $alias = null)
{
$serviceMIS = $this->getServiceMiseEnPaiementIntervenantStructure();
......@@ -145,7 +145,7 @@ class PeriodeService extends AbstractEntityService
* @param QueryBuilder|null $qb
* @param string|null $alias
*/
public function orderBy(QueryBuilder $qb = null, $alias = null)
public function orderBy(?QueryBuilder $qb = null, $alias = null)
{
[$qb, $alias] = $this->initQuery($qb, $alias);
......@@ -179,7 +179,7 @@ class PeriodeService extends AbstractEntityService
*
* @return QueryBuilder
*/
public function finderByEnseignement(QueryBuilder $qb = null, $alias = null)
public function finderByEnseignement(?QueryBuilder $qb = null, $alias = null)
{
[$qb, $alias] = $this->initQuery($qb, $alias);
$qb->andWhere("$alias.enseignement = 1");
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment