Example #1
0
            $entry->set_is_optional(TRUE);
            // if the user didn't set a value for an undocumented entry, make it undocumented again:
            if (!is_string($entry->ask())) {
                $config->remove_entry($entry->get_config_key());
                $config->add_undocumented_entry($entry->get_config_key(), $entry->get_default_answer());
            }
        }
    }
}
// show config and changes to user:
output("\nYour chosen settings:\n(Changed values are marked with an asterisk '*')\n");
foreach ($config->get_entries() as $entry) {
    output(($entry->has_changed() ? "* " : "  ") . $entry->get_config_key() . " = " . $entry->get_answer() . "\n");
}
// write config to file (if necessary):
if (sizeof($config->get_changes()) > 0) {
    $ask_continue = new ConfigEntry("continue", "YesNo", "\nWrite these settings to the config file?");
    if ($ask_continue->ask() == "no") {
        exit(1);
    }
    if (!$config->write_config()) {
        output("Error: could not write config file: " . $config_path . "\n");
        exit(1);
    } else {
        output("Wrote config to " . $config_path . "\n");
    }
} else {
    output("\nYour config settings haven't changed.\n");
}
// check public/.htaccess file:
output("\n");