php-pear/cleanup.php
Troy Dawson 7a4c1feb87 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/php-pear#3d17f9f491b7975e8e7bb56390c243fef1dfe796
2020-10-20 07:33:10 -07:00

34 lines
646 B
PHP

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