Blame SOURCES/cleanup.php

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