Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions webapp/src/Service/DOMJudgeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1342,16 +1342,24 @@ public function apiRelativeUrl(string $route, array $params = []): string
return substr($route, strlen($apiRootRoute) + $offset);
}


/** @var array<string, string[]> */
private static array $assetFiles = [];

/**
* Get asset files in the given directory with the given extension
*
* @return string[]
*/
public function getAssetFiles(string $path): array
{
if (isset(self::$assetFiles[$path])) {
return self::$assetFiles[$path];
}

$customDir = sprintf('%s/public/%s', $this->params->get('kernel.project_dir'), $path);
if (!is_dir($customDir)) {
return [];
return self::$assetFiles[$path] = [];
}

$results = [];
Expand All @@ -1363,7 +1371,7 @@ public function getAssetFiles(string $path): array
}
}

return $results;
return self::$assetFiles[$path] = $results;
}

/**
Expand Down
Loading