Page MenuHomePhabricator
Paste P10669

extkeys-all (T187154)
ActivePublic

Authored by Krinkle on Mar 9 2020, 6:44 PM.
Tags
None
Referenced Files
F31673289: raw.txt
Mar 9 2020, 6:44 PM
Subscribers
None
<?php
$json = @$argv[1] ? file_get_contents($argv[1]) : die('Missing argument');
$data = json_decode($json, /* assoc */ true);
$keys = array_keys($data);
foreach ($data as $key => $val) {
if (is_array($val) ) {
foreach ($val as $subkey => $subval) {
$keys[] = "{$key}.{$subkey}";
if ($key === 'attributes') {
// one more level for this one
foreach ($subval as $attribsubkey => $_) {
$keys[] = "{$key}.{$subkey}.{$attribsubkey}";
}
}
}
}
}
echo implode("\n", $keys) . "\n";
# /srv/mediawiki $ ls php/extensions/*/extension.json | xargs -P 10 -I '{}' php ~/extkeys.php '{}' > ~/extkeys-all.txt
# ~ $ sort ./extkeys-all.txt | uniq -c | sort -nr | head -n50