Help! How to deal with moved/renamed files?
When a file is upstreamed to Conversant, I check to see if there is already a page at its target URL in the CMS. If there is, I update the message that is bound to that existing page, otherwise, I create a new message and bind it to that target URL.
If I delete that file, I have two choices: delete the URL binding in the CMS, but leave the message in the CMS (since it might have become a topic for discussion), or, delete the binding and the message. I'm going to make that a preference.
Here's the part I'm agonizing over: if you rename a file or move it to a different folder managed by the same upstreaming settings, what should I do? Radio will tell my driver to delete the existing file and then create a new one, since that's what happened from it's POV. From your point of view the message should simply be retargeted to a new URL, so the discussion thread under it stays in place.
How can I do that? I need metadata. I could stash the message number in the file's resource fork (if you're using a Mac). Windows has forks too (seriously) but they aren't exposed in Radio. Anyway, that's a fragile solution.
Here's my proposal. Put a GUID in the file. (GUID stands for Globally Unique IDentifier) If you want a file to persist in a known message:
- Create a GUID custom field in your Conversant conversation.
- Put
CONVERSANT-GUID: <%GUID%>at the top of your #template.txt file - Add a
#GUIDdirective line to the content (.txt) file.Example: #GUID "laksjfaoj23r0jaf" - The upstreaming driver tells Radio to render the .txt file (through the template). If it sees the GUID at the top of the file, it checks if that GUID exists in the conversation already. If it exists, the message with that GUID is updated and so is the URL binding (if necessary). If it's not found, it creates the message, saves the GUID, and binds the message to the correct URL as normal.
What to put in the GUID? You can't use the message number because you don't know it in advance (and I don't want to add the hurdle of requesting one). You could use some GUID generator but that's just as bad a message # request hurdle. You could thrash at the keyboard... I think that's reasonably safe if the string is long enough, but yes it's laughable and not foolproof.
You COULD use the message number if you add the GUID after the fact. You could even ask the upstreaming driver to generate one for you and put it in the .txt file for you. That would be nice and easy, but there is a downside... the message will be upstreamed twice, since the change in the file will result in Radio re-upstreaming the file. Even if I set the moddate of the file back to the original moddate, Radio could eventually be smart enough to do checksums! (maybe it already does I don't know) Honestly, this isn't such a big deal, but it's not elegant and that really bugs me. :-)
Anyway, the more I think about it the more I think the GUID is appropriate, but I have a suspicion I may be missing something obvious or clever, so if you can think of something better, please let me know.
Thanks for reading all this. :-)
Jim




