-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Keep file ids when moving between storages #13385
Conversation
I would rather have proper cross storage rename for the cache instead of fixing the remote-update approach since it would be cleaner and saves having to do a rescan of the target. That said I'm not sure if there is a clean way to do it |
So I guess it could be a follow up on your other PR #13360 but for the caches. I already spent quite some time on the file id part so I don't think we'll have a solution for 8.0, so let's leave this for 8.1. I'll keep this PR just in case. |
For the record, the idea I had in mind (with the approach from this PR here) was to provide an alternative "renameToStorage()" method that would be called instead of "copy()" when moving folders. |
The inspection completed: 4 new issues, 4 updated code elements |
@icewind1991 I looked at #13360 but still don't see how to fit in the file id change there. Did you have any particular idea how to solve this ? Do we need to provide new cache methods called "moveFromStorage" so we can do Even if we do, the logic will probably not be too different than in this PR:
If we don't want to do the remove+insert, then we'll need specialized code that knows how to move a cache entry from one storage to another and update the parents (which is partially done by scanFile() + oldFileId in this PR). The only advantage of having it in the cache implementation is probably to be able to detect whether cross-cache changes are done on the same implementations (similar to cross-storage moving from #13360) |
Something like that yes.
We can do something like UPDATE oc_filecache SET storage = $targetStorage->getId() AND path = $targetInternalPath
The same propagator logic that we currently have should work correctly |
It's a bit more tricky for the update: we also need to update the And even more tricky when moving folders: we need to do this for every file/folder inside it. |
Hmm... and permissions might need updating too (which was done by |
Closing in favor of #15360 |
@icewind1991 note, this is hacky and I'm afraid the change to the DB "Cache" class could cause some other side effects
Tentative fix for #13310