Commit 82acf2e6 authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Correction de bug de déploiement des liens symboliques : ils sont maintenant relatifs : c'est mieux

parent 847e59ae
......@@ -117,7 +117,6 @@ function update(Console $c, OseAdmin $oa)
}
function passwordChange(Console $c, OseAdmin $oa)
{
$c->println("Veuillez saisir un login :");
......@@ -140,7 +139,6 @@ function passwordChange(Console $c, OseAdmin $oa)
}
function majPublicLinks(Console $c, OseAdmin $oa)
{
$osedir = dirname(__DIR__);
......@@ -149,15 +147,14 @@ function majPublicLinks(Console $c, OseAdmin $oa)
$res = $oa->majUnicaenSymLinks($osedir);
if ($res){
if ($res) {
$c->println('Liens mis à jour', $c::COLOR_LIGHT_GREEN);
}else{
} else {
$c->println('Liens déjà à jour', $c::COLOR_LIGHT_GREEN);
}
}
function help(Console $c, OseAdmin $oa)
{
$actions = [
......@@ -213,23 +210,20 @@ class OseAdmin
public function majUnicaenSymLinks($oseDir ): bool
public function majUnicaenSymLinks($oseDir): bool
{
if (substr($oseDir, -1) !== '/') {
$oseDir .= '/';
}
$publicDir = $oseDir . 'public/vendor/unicaen/';
$unicaenDir = $oseDir . 'vendor/unicaen/';
$oldLibs = [];
$od = array_filter(glob($publicDir . '*'), 'is_dir');
$od = array_filter(glob($oseDir . 'public/vendor/unicaen/*'), 'is_dir');
foreach ($od as $dir) {
$oldLibs[] = basename($dir);
}
$newLibs = [];
$nd = array_filter(glob($unicaenDir . '*'), 'is_dir');
$nd = array_filter(glob($oseDir . 'vendor/unicaen/*'), 'is_dir');
foreach ($nd as $dir) {
if (is_dir($dir . '/public')) {
$newLibs[] = basename($dir);
......@@ -240,18 +234,18 @@ class OseAdmin
$createLibs = array_diff($newLibs, $oldLibs);
foreach ($deleteLibs as $lib) {
$command = "rm $publicDir$lib";
$command = "rm $oseDir"."public/vendor/unicaen/$lib";
$this->console->print($command);
$this->console->exec($command);
}
foreach ($createLibs as $lib) {
$command = "ln -sf $unicaenDir$lib/public $publicDir$lib";
$command = "cd $oseDir/public/vendor/unicaen;ln -sf ../../../vendor/unicaen/$lib/public $lib";
$this->console->print($command);
$this->console->exec($command);
}
return ! (empty($deleteLibs) && empty($createLibs));
return !(empty($deleteLibs) && empty($createLibs));
}
......
......@@ -181,23 +181,20 @@ class OseDeploy
public function majUnicaenSymLinks($oseDir ): bool
public function majUnicaenSymLinks($oseDir): bool
{
if (substr($oseDir, -1) !== '/') {
$oseDir .= '/';
}
$publicDir = $oseDir . 'public/vendor/unicaen/';
$unicaenDir = $oseDir . 'vendor/unicaen/';
$oldLibs = [];
$od = array_filter(glob($publicDir . '*'), 'is_dir');
$od = array_filter(glob($oseDir . 'public/vendor/unicaen/*'), 'is_dir');
foreach ($od as $dir) {
$oldLibs[] = basename($dir);
}
$newLibs = [];
$nd = array_filter(glob($unicaenDir . '*'), 'is_dir');
$nd = array_filter(glob($oseDir . 'vendor/unicaen/*'), 'is_dir');
foreach ($nd as $dir) {
if (is_dir($dir . '/public')) {
$newLibs[] = basename($dir);
......@@ -208,22 +205,23 @@ class OseDeploy
$createLibs = array_diff($newLibs, $oldLibs);
foreach ($deleteLibs as $lib) {
$command = "rm $publicDir$lib";
$command = "rm $oseDir"."public/vendor/unicaen/$lib";
$this->console->print($command);
$this->console->exec($command);
}
foreach ($createLibs as $lib) {
$command = "ln -sf $unicaenDir$lib/public $publicDir$lib";
$command = "cd $oseDir/public/vendor/unicaen;ln -sf ../../../vendor/unicaen/$lib/public $lib";
$this->console->print($command);
$this->console->exec($command);
}
return ! (empty($deleteLibs) && empty($createLibs));
return !(empty($deleteLibs) && empty($createLibs));
}
public function checkPhpModules(array $modules)
{
$len = 60;
......
Supports Markdown
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