long filenames
parent
9ec0a610bb
commit
89a39b14dc
|
@ -1,38 +1,9 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
if (isset($argc)) {
|
||||
for ($i = 0; $i < $argc; $i++) {
|
||||
echo "Argument #" . $i . " - " . $argv[$i] . "\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "argc and argv disabled\n";
|
||||
}
|
||||
include "utils.php";
|
||||
|
||||
if ($argv[1] == 'all') {
|
||||
$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('/\.js$/', $files[$i])) {
|
||||
array_push($newFiles, 'src/r3/' . $files[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < sizeof($systemFiles); $i++) {
|
||||
if (preg_match('/\.js$/', $systemFiles[$i])) {
|
||||
array_push($newFiles, 'src/r3/r3-system/' . $systemFiles[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$files = $newFiles;
|
||||
|
||||
} else {
|
||||
$files = [$argv[1]];
|
||||
}
|
||||
global $files;
|
||||
|
||||
foreach ($files as $file) {
|
||||
|
||||
|
|
|
@ -1,31 +1,9 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
if (isset($argc)) {
|
||||
for ($i = 0; $i < $argc; $i++) {
|
||||
echo "Argument #" . $i . " - " . $argv[$i] . "\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "argc and argv disabled\n";
|
||||
}
|
||||
include "utils.php";
|
||||
|
||||
if ($argv[1] == 'all') {
|
||||
$files = scandir('src/r3', SCANDIR_SORT_DESCENDING);
|
||||
|
||||
$newFiles = [];
|
||||
|
||||
for ($i = 0; $i < sizeof($files); $i++) {
|
||||
if (preg_match('/\.js$/', $files[$i])) {
|
||||
array_push($newFiles, 'src/r3/' . $files[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$files = $newFiles;
|
||||
|
||||
} else {
|
||||
$files = [$argv[1]];
|
||||
}
|
||||
global $files;
|
||||
|
||||
foreach ($files as $file) {
|
||||
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
if (isset($argc)) {
|
||||
for ($i = 0; $i < $argc; $i++) {
|
||||
echo "Argument #" . $i . " - " . $argv[$i] . "\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "argc and argv disabled\n";
|
||||
}
|
||||
include "utils.php";
|
||||
|
||||
$tokens = [
|
||||
'OPTIONS_START' => 'OPTIONS_END',
|
||||
|
@ -28,8 +21,6 @@ $tokens = [
|
|||
'CUSTOM_[A..Z_]+_METHOD_START' => 'CUSTOM_[A..Z_]+_METHOD_END'
|
||||
];
|
||||
|
||||
$files = [$argv[2]];
|
||||
|
||||
function getIndex($needle, $haystack) {
|
||||
|
||||
$index = 0;
|
||||
|
@ -44,23 +35,18 @@ function getIndex($needle, $haystack) {
|
|||
return false;
|
||||
}
|
||||
|
||||
global $files;
|
||||
|
||||
foreach ($files as $file) {
|
||||
|
||||
if ($argv[1] == 'save') {
|
||||
if ($argv[2] == 'save') {
|
||||
|
||||
echo "saving file " . $file . "\n";
|
||||
|
||||
$saved = [];
|
||||
$startSaving = false;
|
||||
|
||||
$fn = null;
|
||||
|
||||
// try {
|
||||
$fn = fopen($file, "r");
|
||||
// } catch (Exception $e) {
|
||||
// $file = "r3-system/" . $file;
|
||||
// $fn = fopen($file, "r");
|
||||
// }
|
||||
|
||||
while (!feof($fn)) {
|
||||
|
||||
|
@ -93,9 +79,10 @@ foreach ($files as $file) {
|
|||
fclose($fn);
|
||||
|
||||
file_put_contents($file . '.saved', $saved);
|
||||
|
||||
echo "saved file " . $file . ".saved\n";
|
||||
|
||||
} else if ($argv[1] == 'restore') {
|
||||
} else if ($argv[2] == 'restore') {
|
||||
|
||||
$saveFile = $file . '.saved';
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
if (isset($argc)) {
|
||||
for ($i = 0; $i < $argc; $i++) {
|
||||
echo "Argument #" . $i . " - " . $argv[$i] . "\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "argc and argv disabled\n";
|
||||
}
|
||||
|
||||
$files = [];
|
||||
|
||||
if ($argv[1] == 'all') {
|
||||
$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('/\.js$/', $files[$i])) {
|
||||
array_push($newFiles, 'src/r3/' . $files[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < sizeof($systemFiles); $i++) {
|
||||
if (preg_match('/\.js$/', $systemFiles[$i])) {
|
||||
array_push($newFiles, 'src/r3/r3-system/' . $systemFiles[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$files = $newFiles;
|
||||
|
||||
} else {
|
||||
$files = [$argv[1]];
|
||||
}
|
Loading…
Reference in New Issue