Switch from old WP/LR RML extension creates duplicates
Closed this issue · 15 comments
Thanks for developing an improved extension to WP/LR. I'm in the process of migration from the old RML extension for WP/LR Sync.
Steps to reproduce
- "Reset with extensions" in WP/LR while the RML extension box is checked
- Uncheck the RML extension box
- Save setting
- Activate WP/LR Folder Sync plugin
- "Resync with extensions"
Actual behaviour
Now the media library contains twice as many photos, half of which are the newly created duplicates of the original ones with new IDs. The WP/LR collections shown in media library contain only the duplicates (there's a little blue arrow indicating these are just shortcuts). The order of photos was completely messed up in the process of creating duplicates, and the RML collection IDs were different than before. This is very inconvenient.
Expected behaviour
The migration process should preserve the original data structure (IDs, order) of the RML extension for WP/LR Sync. No new duplicates should be created.
Is it possible to write a simple one-time migration script, so that all the old folder IDs, etc, don't need to be removed and recreated? Currently the function add_to_collection
in inc/sync/Attachments.class.php
seems to always create shortcuts during migration.
Hi there!
I'm just wondering myself whether it was the right way to always create shortcuts. I think I'll knock this mechanism over again. I was in the discussion about this with @jordymeow more often, and I think I'll change that now, that the original files will be moved into the right folder.
When are shortcuts needed? Since there is only one truth for the location of a file in the Real Media Library, shortcuts have been introduced. So I will do it so that the file is moved for the first image and if a file is stored in several folders, a shortcut has to be created here. For the shortcut a shortcut to the LR ID has to be created so that it also works with Total Synchronize, Jordy, how could I do this?
What I need to do?
https://github.com/matzeeable/wplr-rml/blob/b8d50b85c8c6c52926a1c4c66fba6adc4ce8e297/inc/sync/Attachments.class.php#L16-L24
This query sorts the given RML folder by LR order, so I have to use the isShortcut
or attachment
column (depending on whether shortcut or not)
https://github.com/matzeeable/wplr-rml/blob/b8d50b85c8c6c52926a1c4c66fba6adc4ce8e297/inc/sync/Attachments.class.php#L59-L72
Here I have to get the attachment ID of the given attachment of the RML folder and move it to Unorganized if not shortcut, and delete it when its a shortcut.
https://github.com/matzeeable/wplr-rml/blob/b8d50b85c8c6c52926a1c4c66fba6adc4ce8e297/inc/sync/Attachments.class.php#L28-L57
Here I have to move the file to the given RML folder when it is the "first file", otherwise I have to create the shortcut. When a shortcut is created then I have to link it to the LR ID.
I do not know exactly when I can implement this.
Best regards,
Matthew :-)
Thanks for the reply. Though the shortcut mechanism for WP/LR Sync is a matter of personal taste, I think it's best to minimise disruption for current users who are migrating. I personally prefer the new_new_mechanism you've just suggested, since the total image count will be correct (rather than doubled), even though it is less "democratic" who gets to be the source. It also doesn't cause "unorganised" to be cluttered. I will roll back to legacy version until this decision has been settled and implemented.
Btw, this combination of LR + WP + RML is a wonderful workflow for me. Without it my photography blog would not be possible. Thank you and Jordy!
HI @jordymeow and @winstonyin,
I have now worked the complete afternoon to get the synchronization work better. The new code finds currently place in decrease-shortcuts-#2 branch. I have to admit that I did a little crap with the previous synchronization. It's true that you don't want to create a shortcut for every relation. Since I have received this feedback several times now, I had to change something here.
The new synchronization now moves the Lightroom files to the respective folder. Only a shortcut will be created as long as this is necessary (putting the same image in multiple collections):
However, I did not yet figure out how to register a LR ID to the created shortcut so it works with Total Synchronization. Jordy, can I simply insert a new row to wp_lrsync
and delete the row also, when the shortcut get's deleted?
WP/LR Sync Folders: Migration from 1.0.x to >= 1.1
If you have used previously the old version of the WP/LR Sync Folders plugin simply
- Navigate to
WP/LR Sync > Extensions
- Press the button
Resync with Extensions
and wait until the process has finished
Afterwards navigate to your media library and you should see the correct WP/LR tree node without duplicates.
What I have to do next?
- Resolve #3: 60b0d14
- Do some further tests for the general synchronization (tomorrow)
- Link LR id to shortcuts so they work with Total Synchronization (help wanted)
- -> I had a talk with jordy and linking a shortcut with a LR ID seems impossible because it only exists once. So I decided to create a FAQ for this at first, you can simply ignore the shortcut in Total Sync.
- Create an admin notice when used the old version and show the above migration hint
- Create action button in "WP/LR" RML folder to delete all the shortcuts
- Release next version of Real Media Library (v4.0.10 or v4.1.0) because it contains a fix which is needed for the new synchronisation process
I can not promise an exact ETA but I think I can release it before 24th December.
Sorry for the troubles and best regards,
Matthew :-)
HI again to all the WP/LR Sync Folders users and @jordymeow!
Finally I have finished and tested the new version. If you want to test the version before I release it, download the version here: https://github.com/matzeeable/wplr-rml/archive/decrease-shortcuts-%232.zip and unzip it into your existing wp-content/plugins/wplr-rml
folder.
I tested the new version and then tried reset with extensions. My media library is still full of old shortcuts. Is there any way to get rid of the shortcuts?
I tested the new version and then tried reset with extensions. My media library is still full of old shortcuts. Is there any way to get rid of the shortcuts?
@rsmith4321 Did the general synchronization work? I have added two reset buttons to Settings > Media > Reset > WP/LR delete shortcuts
. I think I have to add this to the admin notice, too.
I tried reset and resync. Then I tried to delete wp/lr shortcut files under the reset tab and it says failed when I click the box.
Hi @rsmith4321,
I have logged into your site and have repaired the WP/LR synchronization with Real Media Library. Through the old sync process there are a lot of "dead" shortcuts which must be deleted manually through "Bulk select". For this I have created a folder "Deletable shortcuts". 👍
Hi again! I reply to you via email because the main issue is resolved.
Hi @winstonyin, you can download the installable WordPress plugin here: https://github.com/matzeeable/wplr-rml/releases/tag/1.1.0-0 I have not yet published it on wp.org.
Matthias, 1.1.0 works great and doesn't create unnecessary shortcuts. However, the claimed "respects LR order" doesn't actually work when images are ordered by capture time in Lightroom. Is it possible to make the default ordering for WP/LR collections in RML filename_asc? (I understand this is a completely separate issue.)
As far as I understand, capture time ordering is the default in LR, so the "sort" column in DB is 0 for images in this kind of collection. The sync process from WP/LR plugin loops over images in a random order.
Currently, I have to manually trigger republish in LR two times to cause the correct order in RML folders for capture time ordered collections. This is very inconvenient. Note that in the past, WP/LR collections created by their extension allowed sorting within RML.