summaryrefslogtreecommitdiffstats
path: root/cleanup.php
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-08-05 18:58:15 +0200
committerRemi Collet <fedora@famillecollet.com>2016-08-05 18:58:15 +0200
commit35a4d072c7b6ff0242911a5f8db19251a52f39cc (patch)
treed7c0a659e12bcafec84118cd105a3608c69ac181 /cleanup.php
parentc09c659844def14cf1602ccc847b0688f978ae69 (diff)
php-pear: improve default configuration (avoid change in scriplet)
Diffstat (limited to 'cleanup.php')
-rw-r--r--cleanup.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/cleanup.php b/cleanup.php
new file mode 100644
index 0000000..9dde7c8
--- /dev/null
+++ b/cleanup.php
@@ -0,0 +1,33 @@
+<?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");
+