Skip to content

Commit ffbdc36

Browse files
author
fritzmg
committed
added logging for ambiguous file results and disabled maximum execution time
1 parent 4029c5a commit ffbdc36

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/system/modules/file_access/classes/FileAccess.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ public function run()
8585
// find the path in the database
8686
if( ( $objFile = \FilesModel::findByPath( $strFile ) ) !== null )
8787
{
88+
if( $objFile->count() > 0 )
89+
{
90+
$logMessage = 'FileAccess error: found multiple database entries for path | count: '.$objFile->count();
91+
while( $objFile->next() )
92+
$logMessage.= ' | ID: '.$objFile->id.', path: '.$objFile->path;
93+
log_message($logMessage);
94+
95+
header('HTTP/1.1 500 Internal Server Error');
96+
die('Server error');
97+
}
98+
8899
// authenticate the frontend user
89100
\FrontendUser::getInstance()->authenticate();
90101

@@ -121,12 +132,15 @@ public function run()
121132
session_write_close();
122133

123134
// Disable zlib.output_compression (see #6717)
124-
ini_set('zlib.output_compression', 'Off');
135+
@ini_set('zlib.output_compression', 'Off');
125136

126137
// Set headers
127138
header('Content-Type: ' . $objFile->mime);
128139
header('Content-Length: ' . $objFile->filesize);
129140

141+
// Disable maximum execution time
142+
@ini_set('max_execution_time', 0);
143+
130144
// Output the file
131145
readfile( TL_ROOT . '/' . $objFile->path );
132146
}

0 commit comments

Comments
 (0)