1. Gfy
  2. php-rescene

Commits

Gfy  committed 14a9b71

PHP caching issue fixed

  • Participants
  • Parent commits 3c85fb0
  • Branches default

Comments (0)

Files changed (1)

File rescene.php

View file
  */
 function processSrr($file) {
     $fh = fopen($file, 'rb');
-    // PHP uses cacheing for filesize() and we do not always want that!
-    $stat = fstat($fh);
     // file handle gets closed afterwards
-    return processSrrHandle($fh, $stat['size']);
+    return processSrrHandle($fh, getFileSize($file));
 }
 
 /**
 
     $fh = fopen($srr, 'rb');
     $before = fread($fh, $offset);
-    $after = fread($fh, filesize($srr));
+    $after = fread($fh, getFileSize($srr));
     fclose($fh);
 
     $header = createStoredFileHeader($filePath, strlen($fdata));
 }
 
 // Private helper functions -------------------------------------------------------------------------------------------
+
+function getFileSize($file) {
+    $fh = fopen($file, 'rb');
+    // PHP uses caching for filesize() and we do not always want that!
+    $stat = fstat($fh);
+    fclose($fh);
+    return $stat['size'];
+}
 
 function isFolder($dir) {
     return (strpos($dir, '/', 1) !== FALSE);