-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate_index.php
More file actions
32 lines (28 loc) · 905 Bytes
/
Copy pathvalidate_index.php
File metadata and controls
32 lines (28 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
require_once('config.php');
chdir(FONTS_STORAGE);
$_INDEX = json_decode(file_get_contents('index.json'), true);
$count = 0;
foreach ($_INDEX as $types) {
foreach ($types as $f) {
if (!file_exists($f)) {
echo ('Missing "' . $f . '"' . PHP_EOL);
}
$count++;
}
}
echo ('Validate complete: ' . $count . PHP_EOL);
$count = 0;
$list = [];
foreach (glob('**/*.json') as $f) {
$meta = json_decode(file_get_contents($f), true);
foreach ($meta['fontFamily'] as $fam) {
if (!isset($_INDEX[$fam])) {
echo ('Unindexed "' . $f . '" family ' . $fam . PHP_EOL);
$list[] = dirname($f);
}
}
$count++;
}
echo ('Index check complete: ' . $count . PHP_EOL);
echo (implode("\n", array_map(fn ($v) => 'cp -r "' . $v . '" ' . str_replace('\\', '/', __DIR__) . '/source/_reindex', array_values(array_unique($list)))));