klenwell information services : WikkaConfigDiffTool

Wikka Config Diff Tool

return to ProjectWikka

Php script that compares two wikka config files and lists new and deprecated keys

<?php
/**
 * Wikka Config Tool
 *
 * Diff two wikka config files.
 *
 * For more information, see: http://klenwell.com/is/ProjectWikka
 */

$root_dir = dirname(dirname(__FILE__));
$old_config_path = sprintf('%s/wikka.config.php.orig', $root_dir);
$new_config_path = sprintf('%s/wikka.config.php', $root_dir);


require($old_config_path);
$previous_wikka_config = $wakkaConfig;

require($new_config_path);
$updated_wikka_config = $wakkaConfig;


# diff keys of config arrays
$previous_keys = array_keys($previous_wikka_config);
$updated_keys = array_keys($updated_wikka_config);
$new_keys = array_diff($updated_keys, $previous_keys);
$deprecated_keys = array_diff($previous_keys, $updated_keys);
$diff = array(
    'new' => $new_keys,
    'deprecated' => $deprecated_keys,
);

# print
print_r($diff);