Update jQuery from 1.12.4 to 3.7.1
[phorkie.git] / www / raw.php
index 28f7c56ee6ca3475a68507e3de2e27ec422a48d7..605462da41d267184cb522219917ca21a51caccb 100644 (file)
@@ -1,9 +1,11 @@
 <?php
+namespace phorkie;
 /**
  * Displays a file
  */
-namespace phorkie;
+$reqWritePermissions = false;
 require_once 'www-header.php';
+
 $repo = new Repository();
 $repo->loadFromRequest();
 
@@ -17,5 +19,10 @@ if ($mimetype === null) {
     $mimetype = 'text/plain';
 }
 header('Content-Type: ' . $mimetype);
-readfile($file->getFullPath());
+if ($repo->hash === null) {
+    //IIRC readfile is not so memory-intensive for big files
+    readfile($file->getFullPath());
+} else {
+    echo $file->getContent();
+}
 ?>