We just moved the OpenEMR system to a new host. The documents table has the urls hardcoded to the full path from the old host. Is there a built-in method to fix this? I know I can construct a SQL, but was hoping for something a bit more builtin to fix it.
You shouldn’t need to do this since OpenEMR doesn’t use the full path in the documents module. If it isn’t working, then would consider it a bug that should be fixed in the codebase.
In the database for the url column all files are either file://path/to/old/location/file.pdf or /path/to/old/location. I had to hardcode the path in globals.php, which seemed to fix some of the documents, but others still try to load from the old location.
Note the documents algorithm just pops items off the end of the path:
If this is breaking for you, then would be curious to know your OpenEMR version, where it is breaking, and also what you had to set in the global.php? (I am assuming both are in sites//documents; lt me know if that is an incorrect assumption).
Going to in to view the documents it will say that it does not exist or permissions are not correct for /the/old/path/to/file/file.pdf. The structure is the same (sites/default/documents) for both, It is just the absolute path that is wrong. I believe we are behind one patch or so right now.(v4.2.1)
Short answer is no. Of course you could create a link since the hardcoded url does not include host but one of these days you will want to run a global replace. Also look around - some scripts are storing with prefix “file://” while some do not.