Skip to content

Commit

Permalink
Change to 32k
Browse files Browse the repository at this point in the history
  • Loading branch information
mfleeson committed Jul 29, 2024
1 parent 6a278f3 commit fd89341
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion core/classes/class.core.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,20 @@ public function getFileFromUrl(string $moduleUrl, string $filePath, $progressBar
return ['error' => 'Error saving module'];
}

// Ensure $inputStream is a valid file resource
if (is_resource($inputStream)) {
// Get file statistics
$fileStats = fstat($inputStream);

// Extract the file size
$fileSize = $fileStats['size'];

// Output the file size
Util::logError( 'File size: ' . $fileSize . ' bytes' );
}

// Read and write in chunks to avoid memory overload
$bufferSize = 32768; // 8KB
$bufferSize = 32768; // 32KB
while ( !feof( $inputStream ) ) {
$buffer = fread( $inputStream, $bufferSize );
if ( $buffer === false ) {
Expand Down

0 comments on commit fd89341

Please sign in to comment.