Update storage and file tracking#32
Conversation
3f8ffae to
8bff3da
Compare
0b74679 to
df1da08
Compare
df1da08 to
6ab47d2
Compare
1396f0f to
90de924
Compare
a94baf7 to
c9fab13
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #32 +/- ##
=============================================
+ Coverage 99.66% 100.00% +0.33%
- Complexity 83 84 +1
=============================================
Files 8 8
Lines 299 305 +6
=============================================
+ Hits 298 305 +7
+ Misses 1 0 -1 ☔ View full report in Codecov by Sentry. |
d7f84d2 to
9a43e36
Compare
9a43e36 to
84c574e
Compare
| $files = !empty($files_to_track) ? array_map( | ||
| static fn($file) => [ | ||
| 'file_path' => $file, | ||
| 'filesize' => filesize($full_base_path . $file) |
There was a problem hiding this comment.
This won't work if the adapter used is not local
There was a problem hiding this comment.
Local is the only option I have. But also this is installed as local in migrations and the files being handled here must be treated as normal file system files. This is just a way for admins to add/remove favicons without needing to use FTP.
There was a problem hiding this comment.
Or I guess I can do this in this function:
$provider = $this->storage_helper->get_current_provider($this->storage->get_name());
if (str_ends_with($provider, 'local') === false)
{
throw new runtime_exception('Web app icons storage must be local in storage settings.');
}There was a problem hiding this comment.
I don't really get what the other adapters do, but I'll just explain what's going on here and why I think in this use case, I just have to enforce local adapter usage, any others won't be permitted for this storage type.
This method is addressing a problem that will occur if an admin decides to add or remove images (that are their site's favicons/touch icons) via FTP. If they do that, what's on disk won't match what's in the storage table. So the two need to be "re-synchronized"
These images must be kept on disk, aka local, as the browsers expect to be directly accessible from a physical location, for example:
<link rel="apple-touch-icon" href="./phpBB/images/site_icons/touch-icon.png">
I assume the other adapters can do something like, encode an image or file into binary data and store that in a DB instead of on disk. The image files that this extension is letting admin's manage via the ACP shouldn't be stored in those ways though.
This reverts commit fbc0517.
# Conflicts: # tests/unit/helper_test.php
This is for phpbb/phpbb#6753