gestion composer 1 & 2
This commit is contained in:
@@ -75,6 +75,9 @@
|
|||||||
"symfony/polyfill-php56": "*"
|
"symfony/polyfill-php56": "*"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"pre-install-cmd": [
|
||||||
|
"php scripts/checkcomposer.php"
|
||||||
|
],
|
||||||
"auto-scripts": {
|
"auto-scripts": {
|
||||||
"cache:clear": "symfony-cmd",
|
"cache:clear": "symfony-cmd",
|
||||||
"cache:clear --env=prod": "symfony-cmd",
|
"cache:clear --env=prod": "symfony-cmd",
|
||||||
|
13
src/schedule-2.0/scripts/checkcomposer.php
Normal file
13
src/schedule-2.0/scripts/checkcomposer.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$requiredVersion = 'version 1'; // La version interdite
|
||||||
|
|
||||||
|
$composerVersion = trim(shell_exec('COMPOSER_ALLOW_SUPERUSER=1 composer --version --no-ansi'));
|
||||||
|
echo $composerVersion."\n";
|
||||||
|
|
||||||
|
if (stripos($composerVersion,$requiredVersion)===false ) {
|
||||||
|
echo "La version de Composer $requiredVersion n'est pas autorisée" . PHP_EOL;
|
||||||
|
echo "Veuillez mettre à jour Composer avec 'composer self-update --1'." . PHP_EOL;
|
||||||
|
echo "Ou executez le scripts/reconfigure.sh" . PHP_EOL;
|
||||||
|
exit(1); // Quitte avec un code d'erreur
|
||||||
|
}
|
@@ -6,12 +6,13 @@ cd /var/www/html/schedule
|
|||||||
. scripts/proxy.sh
|
. scripts/proxy.sh
|
||||||
|
|
||||||
# Mise en place du fichier d'environnement model
|
# Mise en place du fichier d'environnement model
|
||||||
if [ ! -f /var/www/html/schedule/.env ]; then
|
yes 2>/dev/null | cp $DIR/scripts/.env.model $DIR/.env
|
||||||
mv /var/www/html/schedule/scripts/.env.model /var/www/html/schedule/.env
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Installation des dépendances composer
|
# Installation des dépendances composer
|
||||||
composer install
|
echo COMPOSER = Install
|
||||||
|
export COMPOSER_ALLOW_SUPERUSER=1
|
||||||
|
composer self-update --1 --quiet
|
||||||
|
composer install --quiet
|
||||||
|
|
||||||
php bin/console app:AppInit --env=prod
|
php bin/console app:AppInit --env=prod
|
||||||
php bin/console app:CronInit --env=prod
|
php bin/console app:CronInit --env=prod
|
||||||
|
@@ -10,7 +10,6 @@ use Swagger\Annotations as SWG;
|
|||||||
use App\Entity\Cache;
|
use App\Entity\Cache;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RestController extends AbstractFOSRestController
|
class RestController extends AbstractFOSRestController
|
||||||
{
|
{
|
||||||
private $output=[];
|
private $output=[];
|
||||||
@@ -20,7 +19,7 @@ class RestController extends AbstractFOSRestController
|
|||||||
* Return list of maps
|
* Return list of maps
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @FOSRest\Post("/rest/getBreakdays")
|
* @FOSRest\Post("/rest/getBreakdays")
|
||||||
* @SWG\Response(
|
* @SWG\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="Return list of breakday events"
|
* description="Return list of breakday events"
|
||||||
@@ -42,33 +41,33 @@ class RestController extends AbstractFOSRestController
|
|||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function getBreakdays(Request $request) {
|
public function getBreakdays(Request $request) {
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
ini_set('memory_limit', '1024M');
|
ini_set('memory_limit', '1024M');
|
||||||
|
|
||||||
// Initalisation Manager
|
// Initalisation Manager
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
// Récupération des parametres
|
// Récupération des parametres
|
||||||
$key=$request->get("key");
|
$key=$request->get("key");
|
||||||
$username=$request->get("username");
|
$username=$request->get("username");
|
||||||
|
|
||||||
if($key!=$this->getParameter("appSecret")) {
|
if($key!=$this->getParameter("appSecret")) {
|
||||||
$view = $this->view("API Key inconnue", 403);
|
$view = $this->view("API Key inconnue", 403);
|
||||||
return $this->handleView($view);
|
return $this->handleView($view);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user=$em->getRepository("App:User")->findOneBy(["username"=>$username]);
|
$user=$em->getRepository("App:User")->findOneBy(["username"=>$username]);
|
||||||
if(!$user) {
|
if(!$user) {
|
||||||
$view = $this->view("User inconnue", 403);
|
$view = $this->view("User inconnue", 403);
|
||||||
return $this->handleView($view);
|
return $this->handleView($view);
|
||||||
}
|
}
|
||||||
|
|
||||||
// On formate le tableau de jour
|
// On formate le tableau de jour
|
||||||
$start=new \Datetime('2022-03-07 00:00');
|
$start=new \Datetime('2022-03-07 00:00');
|
||||||
$end=new \Datetime('00:00');
|
$end=new \Datetime('00:00');
|
||||||
$end->modify("last day of this month");
|
$end->modify("last day of this month");
|
||||||
$end->modify("next sunday");
|
$end->modify("next sunday");
|
||||||
|
|
||||||
$events = $em
|
$events = $em
|
||||||
->createQueryBuilder('event')
|
->createQueryBuilder('event')
|
||||||
@@ -100,7 +99,7 @@ class RestController extends AbstractFOSRestController
|
|||||||
"naturename"=>$event->getTask()->getNature()->getName(),
|
"naturename"=>$event->getTask()->getNature()->getName(),
|
||||||
];
|
];
|
||||||
|
|
||||||
array_push($output["events"],$tmp);
|
array_push($output["events"],$tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,10 +123,10 @@ class RestController extends AbstractFOSRestController
|
|||||||
"naturename"=>"Jour Férié",
|
"naturename"=>"Jour Férié",
|
||||||
];
|
];
|
||||||
|
|
||||||
array_push($output["events"],$tmp);
|
array_push($output["events"],$tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
$view = $this->view($output, 200);
|
$view = $this->view($output, 200);
|
||||||
return $this->handleView($view);
|
return $this->handleView($view);
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user