Airship\Engine\Continuum\Installers\Motif::install PHP Méthode

install() public méthode

1. Extract files to the appropriate directory. 2. If this is a cabin-specific motif, update motifs.json. Otherwise, it's a global Motif. Enable for all cabins. 3. Create symbolic links. 4. Clear cache files.
public install ( InstallFile $fileInfo ) : boolean
$fileInfo InstallFile
Résultat boolean
    public function install(InstallFile $fileInfo) : bool
    {
        $path = $fileInfo->getPath();
        $zip = new \ZipArchive();
        $res = $zip->open($path);
        if ($res !== true) {
            $this->log('Could not open the ZipArchive.', LogLevel::ERROR);
            return false;
        }
        // Extraction destination directory
        $dir = \implode(DIRECTORY_SEPARATOR, [ROOT, 'Motifs', $this->supplier->getName(), $this->package]);
        if (!\is_dir($dir)) {
            \mkdir($dir, 0775, true);
        }
        // Grab metadata
        $metadata = \Airship\parseJSON($zip->getArchiveComment(\ZipArchive::FL_UNCHANGED), true);
        if (isset($metadata['cabin'])) {
            $cabin = $this->expandCabinName($metadata['cabin']);
            if (!\is_dir(ROOT . '/Cabin/' . $cabin)) {
                $this->log('Could not install; cabin "' . $cabin . '" is not installed.', LogLevel::ERROR);
                return false;
            }
        } else {
            $cabin = null;
        }
        // Extract the new files to the current directory
        if (!$zip->extractTo($dir)) {
            $this->log('Could not extract Motif to its destination.', LogLevel::ERROR);
            return false;
        }
        // Add to the relevant motifs.json files
        if ($cabin) {
            $this->addMotifToCabin($cabin);
        } else {
            foreach (\glob(ROOT . '/Cabin/') as $cabin) {
                if (\is_dir($cabin)) {
                    $this->addMotifToCabin(\Airship\path_to_filename($cabin));
                }
            }
        }
        self::$continuumLogger->store(LogLevel::INFO, 'Motif install successful', $this->getLogContext($fileInfo));
        // Finally, nuke the cache:
        return $this->clearCache();
    }