public function saveConfig(Config $config) { $key = sprintf("%s-%s", $config->getType(), $config->getArea()); if (!($file = $config->getFile('base'))) { throw new KurogoConfigurationException("Unable to load base file for " . $config->getType() . '-' . $config->getArea()); } if (count($config->getFiles()) > 1) { KurogoDebug::Debug($config, true); throw new KurogoConfigurationException("Safety net. File will not be saved because it was loaded with extra files. The code is probably wrong"); } $data = $config->getSaveData(); if (!is_writable($file)) { throw new KurogoConfigurationException("Cannot save config file: {$file} Check permissions"); } file_put_contents($file, $data); unset($this->configs[$key]); Kurogo::deleteCache('config-' . $key); return true; }