Overview
Comment: | Add getReadOnlyPointer method to File |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA3-256: |
bd3c82f9f6cd8f8d65afa7ba06348270 |
User & Date: | bohwaz on 2022-10-25 21:13:26 |
Other Links: | branch diff | manifest | tags |
Context
2022-10-25
| ||
21:13 | Remove DB_OPEN_SQL constant check-in: 5788cee178 user: bohwaz tags: dev | |
21:13 | Add getReadOnlyPointer method to File check-in: bd3c82f9f6 user: bohwaz tags: dev | |
19:56 | Implement touch() on files with a custom date-time check-in: f308f44d8f user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Entities/Files/File.php from [f389a0594b] to [6c627472f9].
︙ | ︙ | |||
1007 1008 1009 1010 1011 1012 1013 | return hash_equals($hash, $hash_check); } public function touch(?\DateTimeInterface $date = null) { Files::callStorage('touch', $this->path, $date); } | | > > > > > | 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 | return hash_equals($hash, $hash_check); } public function touch(?\DateTimeInterface $date = null) { Files::callStorage('touch', $this->path, $date); } public function getReadOnlyPointer() { return Files::callStorage('getReadOnlyPointer', $this); } } |
Modified src/include/lib/Garradin/Files/Storage/FileSystem.php from [ec8b634511] to [4cd0da813c].
︙ | ︙ | |||
123 124 125 126 127 128 129 130 131 132 133 134 135 136 | return $path; } static public function getFullPath(File $file): ?string { return self::_getRealPath($file->path); } static public function display(File $file): void { readfile(self::getFullPath($file)); } static public function fetch(File $file): string | > > > > > | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | return $path; } static public function getFullPath(File $file): ?string { return self::_getRealPath($file->path); } static public function getReadOnlyPointer(File $file) { return fopen(self::getFullPath($file), 'rb'); } static public function display(File $file): void { readfile(self::getFullPath($file)); } static public function fetch(File $file): string |
︙ | ︙ |
Modified src/include/lib/Garradin/Files/Storage/SQLite.php from [c770e7f55c] to [71699b5605].
︙ | ︙ | |||
113 114 115 116 117 118 119 120 121 122 123 124 125 126 | $blob = self::getPointer($file); Static_Cache::storeFromPointer($cache_id, $blob); fclose($blob); } return Static_Cache::getPath($cache_id); } static public function display(File $file): void { $blob = self::getPointer($file); while (!feof($blob)) { echo fread($blob, 8192); | > > > > > | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | $blob = self::getPointer($file); Static_Cache::storeFromPointer($cache_id, $blob); fclose($blob); } return Static_Cache::getPath($cache_id); } static public function getReadOnlyPointer(File $file) { return self::getPointer($file); } static public function display(File $file): void { $blob = self::getPointer($file); while (!feof($blob)) { echo fread($blob, 8192); |
︙ | ︙ |
Modified src/include/lib/Garradin/Files/Storage/StorageInterface.php from [929a37f418] to [36c2650e7e].
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 | /** * Should return full local file access path. * If storage backend cannot store the file locally, return NULL. * In that case a subsequent call to fetch() will be done. */ static public function getFullPath(File $file): ?string; /** * Returns the binary of a content to php://output */ static public function display(File $file): void; /** * Returns the binary content of a file | > > > > > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | /** * Should return full local file access path. * If storage backend cannot store the file locally, return NULL. * In that case a subsequent call to fetch() will be done. */ static public function getFullPath(File $file): ?string; /** * Returns a read-only file pointer (resource) to the file contents */ static public function getReadOnlyPointer(File $file); /** * Returns the binary of a content to php://output */ static public function display(File $file): void; /** * Returns the binary content of a file |
︙ | ︙ |