protected function addMotifToCabin(string $cabin) : bool
{
if (!\is_dir(ROOT . '/Cabin/' . $cabin)) {
return false;
}
$supplier = $this->supplier->getName();
$name = $this->package;
$configFile = ROOT . '/Cabin/' . $cabin . '/config/motifs.json';
$config = \Airship\loadJSON($configFile);
$i = 1;
while (isset($config[$name])) {
$name = $this->package . '-' . ++$i;
}
$config[$name] = ['enabled' => true, 'supplier' => $supplier, 'name' => $this->package, 'path' => $supplier . '/' . $this->package];
if (!$this->createSymlinks($cabin, $config, $name)) {
// This isn't essential.
$this->log('Could not create symlinks for Cabin "' . $cabin . '".', LogLevel::WARNING);
}
return \Airship\saveJSON($configFile, $config);
}