public function writePHPConfig($formvars, &$php = null)
{
$php = $this->generatePHPConfig($formvars);
$path = $GLOBALS['registry']->get('fileroot', $this->_app) . '/config';
$configFile = $this->configFile();
if (file_exists($configFile)) {
if (@copy($configFile, $path . '/conf.bak.php')) {
$GLOBALS['notification']->push(sprintf(Horde_Core_Translation::t("Successfully saved the backup configuration file %s."), Horde_Util::realPath($path . '/conf.bak.php')), 'horde.success');
} else {
$GLOBALS['notification']->push(sprintf(Horde_Core_Translation::t("Could not save the backup configuration file %s."), Horde_Util::realPath($path . '/conf.bak.php')), 'horde.warning');
}
}
if ($fp = @fopen($configFile, 'w')) {
/* Can write, so output to file. */
fwrite($fp, $php);
fclose($fp);
$GLOBALS['registry']->rebuild();
$GLOBALS['notification']->push(sprintf(Horde_Core_Translation::t("Successfully wrote %s"), Horde_Util::realPath($configFile)), 'horde.success');
return true;
}
/* Cannot write. Save to session. */
$GLOBALS['session']->set('horde', 'config/' . $this->_app, $php);
return false;
}