| | |
| | $lines = file($orderFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
| | - $order = array_flip(array_map('trim', $lines)); |
| | + $order = []; |
| | + $exclude = []; |
| | + |
| | + // Parse order.txt for ranking and exclusions |
| | + foreach ($lines as $line) { |
| | + $line = trim($line); |
| | + if ($line === '') continue; |
| | + |
| | + if ($line[0] === '-') { |
| | + // Found a suppression (minus sign) |
| | + $exclude[substr($line, 1)] = true; |
| | + } else { |
| | + // Found a ranking |
| | + $order[$line] = count($order); |
| | + } |
| | + } |
| | + |
| | + // Remove suppressed repositories |
| | + foreach ($repos as $key => $repo) { |
| | + if (isset($exclude[$repo['safe_name']])) { |
| | + unset($repos[$key]); |
| | + } |
| | + } |
| | |
| | + // Sort the remaining repositories |
| | uasort($repos, function($a, $b) use ($order) { |
| | $nameA = $a['safe_name']; |