Пример #1
0
/**
 * Process the searches.ini file.
 *
 * @param string $old_search_input The old input file
 * @param string $new_search_input The new input file
 *
 * @return void
 */
function fixSearchIni($old_search_input, $new_search_input)
{
    $old_config = parse_ini_file($old_search_input, true);
    $new_config = parse_ini_file($new_search_input, true);
    $new_comments = readIniComments($new_search_input);
    $new_config_file = 'web/conf/searches.ini.new';
    // override new version's defaults with matching settings from old version:
    foreach ($old_config as $section => $subsection) {
        foreach ($subsection as $key => $value) {
            $new_config[$section][$key] = $value;
        }
    }
    // we want to retain the old installation's Basic/Advanced search settings
    // exactly as-is
    $new_config['Basic_Searches'] = $old_config['Basic_Searches'];
    $new_config['Advanced_Searches'] = $old_config['Advanced_Searches'];
    // save the file
    if (!writeIniFile($new_config, $new_comments, $new_config_file)) {
        die("Error: Problem writing to {$new_config_file}.");
    }
    // report success
    echo "\nInput:  {$old_search_input}\n";
    echo "Output: {$new_config_file}\n";
}
Пример #2
0
/**
 * Process the Summon.ini file.
 *
 * @param string $old_input The old input file
 * @param string $new_input The new input file
 *
 * @return array            Dependency problems detected during processing
 */
function fixSummonIni($old_input, $new_input)
{
    $old_config = parse_ini_file($old_input, true);
    $new_config = parse_ini_file($new_input, true);
    $new_comments = readIniComments($new_input);
    $new_config_file = 'web/conf/Summon.ini.new';
    // override new version's defaults with matching settings from old version:
    foreach ($old_config as $section => $subsection) {
        foreach ($subsection as $key => $value) {
            $new_config[$section][$key] = $value;
        }
    }
    // we want to retain the old installation's search and facet settings
    // exactly as-is
    $groups = array('Facets', 'FacetsTop', 'Basic_Searches', 'Advanced_Searches', 'Sorting');
    foreach ($groups as $group) {
        $new_config[$group] = $old_config[$group];
    }
    // save the file
    if (!writeIniFile($new_config, $new_comments, $new_config_file)) {
        die("Error: Problem writing to {$new_config_file}.");
    }
    // report success
    echo "\nInput:  {$old_input}\n";
    echo "Output: {$new_config_file}\n";
    return array();
}