Skip to content

Commit 4cecc74

Browse files
authored
Merge pull request #172 from MichaONO/patch-1
Speedup for loading patchwork.json
2 parents 1bf183a + 7b161ee commit 4cecc74

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Config.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616

1717
function locate()
1818
{
19-
$alreadyRead = [];
19+
$alreadyChecked = [];
2020
$paths = array_map('dirname', get_included_files());
2121
$paths[] = dirname($_SERVER['PHP_SELF']);
2222
$paths[] = getcwd();
2323
foreach ($paths as $path) {
2424
while (dirname($path) !== $path) {
2525
$file = $path . DIRECTORY_SEPARATOR . FILE_NAME;
26-
if (is_file($file) && !isset($alreadyRead[$file])) {
26+
if (!isset($alreadyChecked[$file]) && is_file($file)) {
2727
read($file);
2828
State::$timestamp = max(filemtime($file), State::$timestamp);
29-
$alreadyRead[$file] = true;
3029
}
30+
$alreadyChecked[$file] = true;
3131
$path = dirname($path);
3232
}
3333
}

0 commit comments

Comments
 (0)