summaryrefslogtreecommitdiffstats
path: root/phpMyAdmin-bundled.php
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-12-10 12:30:38 +0100
committerRemi Collet <remi@php.net>2021-12-10 12:30:38 +0100
commitd621692a542bc9d1c87f208333a36b3167aff06f (patch)
tree7b1ebcd38cd3d6c6ca61bf35177da4e8537f384b /phpMyAdmin-bundled.php
parentdd78f9c490e05daf47960d1cf7ca481834e2212b (diff)
add flag to use all PHP bundled libraries instead of system ones
Diffstat (limited to 'phpMyAdmin-bundled.php')
-rw-r--r--phpMyAdmin-bundled.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/phpMyAdmin-bundled.php b/phpMyAdmin-bundled.php
new file mode 100644
index 0000000..5f2cb89
--- /dev/null
+++ b/phpMyAdmin-bundled.php
@@ -0,0 +1,39 @@
+<?php
+
+if (!isset($_SERVER['argv'][1])) {
+ echo "Missing arg\n";
+ exit(1);
+}
+$pkgs = file_get_contents($_SERVER['argv'][1]);
+if (!$pkgs) {
+ echo "can't read json file\n";
+ exit(2);
+}
+
+$pkgs = json_decode($pkgs, true);
+if (!is_array($pkgs)) {
+ echo "can't decode json file\n";
+ exit(3);
+}
+
+$lic = [];
+if (isset($pkgs['packages'])) {
+ foreach($pkgs['packages'] as $pkg) {
+ printf("Provides: bundled(php-%s) = %s\n", str_replace(['/', '_'], ['-', '-'], $pkg['name']), $pkg['version']);
+ $lic = array_merge($lic, $pkg['license']);
+ }
+} else if (isset($pkgs['dependencies'])) {
+ foreach($pkgs['dependencies'] as $pkg) {
+ $n = strtolower($pkg['name'] ?? $pkg['lib']);
+ $n = str_replace('.js', '', $n);
+ printf("Provides: bundled(js-%s) = %s\n", $n, $pkg['version']);
+ if (isset($pkg['license'])) {
+ $lic[] = $pkg['license'];
+ }
+ }
+} else {
+ echo "unkown content\n";
+ exit(4);
+}
+sort($lic);
+printf("\nLicense: %s\n", implode(' and ', array_unique($lic)));