Blame SOURCES/cleanup.php

965a29
965a29
965a29
#
965a29
# Usage: php cleanup.php /path/to/pear.conf /usr/share
965a29
# 
965a29
$file = $_SERVER['argv'][1];
965a29
$data = $_SERVER['argv'][2];
965a29
965a29
# Keys to be removed if exists
965a29
$remove = [
965a29
  'ext_dir',
965a29
  'http_proxy',
965a29
];
965a29
# Keys to be added
965a29
$add = [
965a29
  '__channels' => [
965a29
    'pecl.php.net' => [
965a29
      'doc_dir'  => "$data/doc/pecl",
965a29
      'test_dir' => "$data/tests/pecl",
965a29
    ]
965a29
  ]
965a29
];
965a29
965a29
$input = file_get_contents($file);
965a29
list($header, $config) = explode("\n", $input);
965a29
$config = unserialize($config);
965a29
965a29
foreach ($remove as $key) unset($config[$key]);
965a29
$config = array_merge($config, $add);
965a29
$config = serialize($config);
965a29
965a29
file_put_contents($file, "$header\n$config");
965a29