Blame SOURCES/cleanup.php

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