mirror of
https://github.com/unraid/webgui.git
synced 2026-01-06 01:29:54 -06:00
chore: try-catch on js loader
This commit is contained in:
@@ -10,15 +10,20 @@ function findJsFiles($directory) {
|
||||
new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS)
|
||||
);
|
||||
|
||||
foreach ($iterator as $file) {
|
||||
if ($file->isFile() && $file->getExtension() === 'js') {
|
||||
$path = $file->getPathname();
|
||||
$baseDir = '/usr/local/emhttp';
|
||||
if (strpos($path, $baseDir) === 0) {
|
||||
$path = substr($path, strlen($baseDir));
|
||||
try {
|
||||
foreach ($iterator as $file) {
|
||||
if ($file->isFile() && $file->getExtension() === 'js') {
|
||||
$path = $file->getPathname();
|
||||
$baseDir = '/usr/local/emhttp';
|
||||
if (strpos($path, $baseDir) === 0) {
|
||||
$path = substr($path, strlen($baseDir));
|
||||
}
|
||||
$jsFiles[] = $path;
|
||||
}
|
||||
$jsFiles[] = $path;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
my_logger("Error scanning for JS files: " . $e->getMessage());
|
||||
return [];
|
||||
}
|
||||
|
||||
return $jsFiles;
|
||||
|
||||
Reference in New Issue
Block a user