Skip to content

Commit af19d22

Browse files
authored
Update CodebaseLoader5.php
1 parent e0b31c6 commit af19d22

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/Autoload/CodebaseLoader5.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public function getClassMaps(): array
262262
*/
263263
public function rebuild(): void
264264
{
265-
$this->withTimeout(max(180, max(intval(ini_get('max_execution_time')), 45)));
265+
$this->withTimeout(max(300, intval(ini_get('max_execution_time')) ));
266266
$this->cacheLoaded = true;
267267
$this->classes = $this->missingClasses = $this->emptyFiles = [];
268268
$this->refreshClasses();
@@ -278,7 +278,7 @@ public function rebuild(): void
278278
*/
279279
public function refresh(): void
280280
{
281-
$this->withTimeout(max(180, max(intval(ini_get('max_execution_time')), 45)));
281+
$this->withTimeout(max(300, intval(ini_get('max_execution_time')) ));
282282
$this->loadCache();
283283
if (!$this->refreshed) {
284284
$this->refreshClasses();
@@ -303,13 +303,13 @@ protected function refreshClasses(): void
303303
$this->classes = $this->emptyFiles = [];
304304

305305
foreach ($this->scanPaths as $path) {
306-
$this->withTimeout(max(180, max(intval(ini_get('max_execution_time')), 45)));
306+
$this->withTimeout(max(300, intval(ini_get('max_execution_time')) ));
307307
$iterator = is_file($path)
308308
? [new SplFileInfo($path)]
309309
: $this->createFileIterator($path);
310310

311311
foreach ($iterator as $fileInfo) {
312-
$this->withTimeout(max(180, max(intval(ini_get('max_execution_time')), 45)));
312+
$this->withTimeout(max(300, intval(ini_get('max_execution_time')) ));
313313
$mtime = $fileInfo->getMTime();
314314
$file = $fileInfo->getPathname();
315315
$foundClasses = isset($files[$file]) && $files[$file] === $mtime
@@ -417,7 +417,7 @@ protected function createFileIterator(string $dir): \Nette\Utils\Finder
417417
protected function updateFile(string $file): void
418418
{
419419

420-
$this->withTimeout( max(180, max(intval(ini_get('max_execution_time')), 45)) );
420+
$this->withTimeout(max(300, intval(ini_get('max_execution_time')) ));
421421

422422
foreach ($this->classes as $class => [$prevFile]) {
423423
if ($file === $prevFile) {
@@ -435,6 +435,7 @@ protected function updateFile(string $file): void
435435
// $this->dubs[$hash][$file] = $foundClasses;
436436

437437
foreach ($foundClasses as $class) {
438+
$this->withTimeout(max(300, intval(ini_get('max_execution_time')) ));
438439
[$prevFile, $prevMtime] = $this->classes[$class] ?? null;
439440

440441
if (isset($prevFile) && @filemtime($prevFile) !== $prevMtime) { // @ file may not exists
@@ -490,17 +491,14 @@ protected function scanPhp(string $file): array
490491
if(\php_sapi_name()!=='cli'){
491492
set_time_limit(180);
492493
}
493-
494-
495494
//(new \frdl\Lint\Php($cacheDirLint) ) ->lintString($codeWithStartTags)
496-
497495
if(true !== \frdl\Lint\Php::lintFileStatic($file,false) ){
498496
trigger_error(sprintf('Parse error in %s', $file), \E_USER_WARNING);
499497
return [];
500498
}
501499
*/
502500

503-
$this->withTimeout(max(180, max(intval(ini_get('max_execution_time')), 45)));
501+
$this->withTimeout(max(300, intval(ini_get('max_execution_time')) ));
504502

505503
$code = file_get_contents($file);
506504
$expected = false;
@@ -528,8 +526,7 @@ protected function scanPhp(string $file): array
528526

529527
foreach ($tokens as $token) {
530528
$token=(object)$token;
531-
$this->withTimeout(max(180, max(intval(ini_get('max_execution_time')), 45)));
532-
529+
533530

534531
switch ($token->id) {
535532
case \T_COMMENT:
@@ -653,6 +650,7 @@ protected function loadCache(): void
653650
return;
654651
}
655652

653+
$this->withTimeout(max(300, intval(ini_get('max_execution_time')) ));
656654
$this->classes = $this->missingClasses = $this->emptyFiles = [];
657655
$this->refreshClasses();
658656
$this->saveCache($lock);
@@ -754,5 +752,3 @@ protected function getCacheKey(): array
754752

755753
}
756754

757-
758-

0 commit comments

Comments
 (0)