I’m writing a script to automatically tag files based on a known data source. I’m acting right on the database, because it’s more flexible.
I look up the file in ‘filecache’ by ‘name’, as they are controlled and named via an ID for another service, and by ‘storage’, then add the ‘systemtag’ if missing, and finally create the ‘systemtag_object_mapping’.
Unfortunately, the one issue I have is that the ‘filecache.name’ column isn’t indexed. I figure I can use the already indexed path_hash column, but I don’t know how or on what data the path is hashed. Is it a simple md5 of the path column or what?
This question has no answers but 850+ views. So I will answer it although it’s five years old now.
I validated all rows in a productive instance’s filecache table with 33m+ rows. path_hash always was the md5 of path.
Good luck with that information!
2 Likes
Agreed. Some code for cross-reference purposes:
2 Likes
UPDATE oc_filecache
SET path = REPLACE(path, 'old_path', 'new_path'),
path_hash = MD5(REPLACE(path, 'old_path', 'new_path'))
WHERE path LIKE '%old_path%';
Thanks!!!