r3-v2/utils.php

46 lines
898 B
PHP
Raw Normal View History

2021-06-21 11:43:10 +02:00
<?php
if (isset($argc)) {
2021-07-01 16:39:25 +02:00
for ($i = 0; $i < $argc; $i++) {
echo "Argument #" . $i . " - " . $argv[$i] . "\n";
}
2021-06-21 11:43:10 +02:00
}
else {
2021-07-01 16:39:25 +02:00
echo "argc and argv disabled\n";
2021-06-21 11:43:10 +02:00
}
$files = [];
if ($argv[1] == 'all') {
2021-07-01 16:39:25 +02:00
$files = scandir('src/r3/', SCANDIR_SORT_DESCENDING);
$systemFiles = scandir('src/r3/r3-system', SCANDIR_SORT_DESCENDING);
$newFiles = [];
for ($i = 0; $i < sizeof($files); $i++) {
if (preg_match('/index\.js$/', $files[$i])) {
continue;
}
if (preg_match('/\.js$/', $files[$i])) {
array_push($newFiles, 'src/r3/' . $files[$i]);
}
}
2021-06-21 11:43:10 +02:00
2021-07-01 16:39:25 +02:00
for ($i = 0; $i < sizeof($systemFiles); $i++) {
2021-06-21 11:43:10 +02:00
if (preg_match('/index\.js$/', $systemFiles[$i])) {
2021-07-01 16:39:25 +02:00
continue;
2021-06-21 11:43:10 +02:00
}
2021-07-01 16:39:25 +02:00
if (preg_match('/\.js$/', $systemFiles[$i])) {
array_push($newFiles, 'src/r3/r3-system/' . $systemFiles[$i]);
2021-06-21 11:43:10 +02:00
}
2021-07-01 16:39:25 +02:00
}
2021-06-21 11:43:10 +02:00
2021-07-01 16:39:25 +02:00
$files = $newFiles;
2021-06-21 11:43:10 +02:00
} else {
2021-07-01 16:39:25 +02:00
$files = [$argv[1]];
2021-06-21 11:43:10 +02:00
}