Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Suppresses I/O errors for non-existent files

Author DaveJarvis <email>
Date 2023-11-08 00:12:13 GMT-0800
Commit 6e30610eee27ec2a039cdd79efa8c9c6c0689fe5
Parent 8a68ee2
www/downloads/counter.php
// Coerce value to largest natural numeric data type.
- $count = file_get_contents( $filename ) + 0;
+ $count = @file_get_contents( $filename ) + 0;
// Write the new counter value.
*/
function download( $path ) {
- $size = filesize( $path );
+ $size = @filesize( $path );
$fileinfo = pathinfo( $path );
$filename = normalize_filename( $fileinfo );
header( 'Content-Length: ' . ($seek_end - $seek_start + 1) );
- $fp = fopen( $path, 'rb' );
+ $total_bytes = 0;
+ $fp = @fopen( $path, 'rb' );
if( $fp !== false ) {
- fseek( $fp, $seek_start );
+ @fseek( $fp, $seek_start );
$aborted = false;
Delta 5 lines added, 4 lines removed, 1-line increase