configFile() public method

public configFile ( )
Esempio n. 1
0
 /**
  * Creates default configuration files for all installed applications.
  *
  * @throws Horde_Exception
  */
 public function writeAllConfigs()
 {
     foreach ($GLOBALS['registry']->listAllApps() as $app) {
         if ($app == 'horde' || !file_exists($GLOBALS['registry']->get('fileroot', $app) . '/config/conf.xml')) {
             continue;
         }
         $config = new Horde_Config($app);
         $configFile = $config->configFile();
         if (!$config->writePHPConfig(new Horde_Variables())) {
             throw new Horde_Exception('Cannot write configuration file ' . Horde_Util::realPath($configFile));
         }
     }
 }
Esempio n. 2
0
    }
}
/* Update configurations if requested. */
if ($vars->action == 'config') {
    foreach ($a as $app) {
        $path = $registry->get('fileroot', $app) . '/config';
        if (!file_exists($path . '/conf.xml') || file_exists($path . '/conf.php') && ($xml_ver = $hconfig->getVersion(@file_get_contents($path . '/conf.xml'))) !== false && ($php_ver = $hconfig->getVersion(@file_get_contents($path . '/conf.php'))) !== false && $xml_ver == $php_ver) {
            continue;
        }
        $vars = new Horde_Variables();
        $form = new Horde_Config_Form($vars, $app, true);
        $form->setSubmitted(true);
        if ($form->validate($vars)) {
            $config = new Horde_Config($app);
            if (!$config->writePHPConfig($vars)) {
                $notification->push(sprintf(_("Could not save the configuration file %s. Use one of the options below to save the code."), Horde_Util::realPath($config->configFile())), 'horde.warning', array('content.raw', 'sticky'));
            }
        } else {
            $notification->push(sprintf(_("The configuration for %s cannot be updated automatically. Please update the configuration manually."), $app), 'horde.error');
        }
    }
}
/* Update schema if requested. */
if ($vars->action == 'schema') {
    $apps = isset($vars->app) ? array($vars->app) : $migration->apps;
    foreach ($apps as $app) {
        $migrator = $migration->getMigrator($app);
        if ($migrator->getTargetVersion() <= $migrator->getCurrentVersion()) {
            continue;
        }
        try {