Commit 43b7f320 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Oubli

parent 261c1cd6
Loading
Loading
Loading
Loading
+44
Changes for bin/install: 44 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -206,6 +206,50 @@ class OseDeploy



    public function majUnicaenSymLinks($oseDir): bool
    {
        if (substr($oseDir, -1) !== '/') {
            $oseDir .= '/';
        }

        $oldLibs = [];
        $od      = array_filter(glob($oseDir . 'public/vendor/unicaen/*'), 'is_dir');
        foreach ($od as $dir) {
            $oldLibs[] = basename($dir);
        }

        $newLibs = [];
        $nd      = array_filter(glob($oseDir . 'vendor/unicaen/*'), 'is_dir');
        foreach ($nd as $dir) {
            if (is_dir($dir . '/public')) {
                $newLibs[] = basename($dir);
            }
        }

        $deleteLibs = array_diff($oldLibs, $newLibs);
        $createLibs = array_diff($newLibs, $oldLibs);

        foreach ($deleteLibs as $lib) {
            $command = "rm $oseDir" . "public/vendor/unicaen/$lib";
            $this->console->print($command);
            $this->console->exec($command);
        }

        foreach ($createLibs as $lib) {
            if (is_dir($oseDir . "/vendor/unicaen/$lib/public/unicaen/$lib")) {
                $command = "cd $oseDir" . "public/vendor/unicaen;ln -sf ../../../vendor/unicaen/$lib/public/unicaen/$lib $lib";
            } else {
                $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));
    }



    public function checkPhpModules(array $modules)
    {
        $len    = 60;