Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 113 replies, has 3 voices.

Last updated by Sumit 1 year, 4 months ago.

Assisted by: Sumit.

Author Posts
March 28, 2023 at 11:08 pm #13353237

louisN-4

"duplicate images, I found few of them"

how did you find them so quickly, i am running media cleaner, it still didn't find anything

March 29, 2023 at 7:33 am #13355081

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

For point #4 once we have the media files translated completely it should solve this issue otherwise we will debug it.

For this message https://wpml.org/forums/topic/slow-down-on-mass-price-update/#post-13220995 I have not replicated it yet.
When SQL server is busy any query can be logged into the slow query log. Because slow query log only log the query that is taking longer time than the defined limit i.e. 60 seconds or something else.
After fixing the media issue we should check this again.

#5 No problem. Keep it as it is.

#6 Okay let's keep it too.
#7 The plugin you are using to clean the DB is good. Let's keep using it.

how did you find them so quickly, i am running media cleaner, it still didn't find anything

I run this query

SELECT COUNT(guid) as item_counts, guid, ID FROM `lsk_posts` WHERE post_type = 'attachment' GROUP BY guid ORDER  BY item_counts DESC;

This gives me
Count of attachment group by URL, URL of the image, and First attachment ID.

It is possible that same image is uploaded multiple times but it should not be 400, 300, 200.
The correct count should be 4 because you have 4 languages activated.

I hope it helps.

Thanks

March 29, 2023 at 8:31 am #13355441

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

If you run this query

SELECT *  FROM `lsk_posts` WHERE `guid` NOT LIKE '<em><u>hidden link</u></em>' AND `post_type` = 'attachment';

You can see these images are missing the mime type and has an invalid image URL.
Those can be deleted IMO. The number of these invalid items is nearly 280.

March 29, 2023 at 8:37 am #13355497

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

If you are having issues with media cleaner because of large data. I can write a script to detect and delete media posts.

The problem here is we can't find which image post to delete and which to keep. Suppose there are 400 entries in the database for the same URL. Now the problem is how to find which one of them is being used on the front-end.

Assuming that the first one is the original image (oldest ID) and then find its translation in WPML then delete all items except the oldest ID and its translation.
These steps I can put into a PHP script.

But again if our assumption goes wrong we need to correct the post manually for missing images.
If you are using URL of the images in the post those will be fine because URL will exist if ID is being used in post content then it could be a problem.

Please let me know what do you think.

March 29, 2023 at 3:33 pm #13359975

louisN-4

Hey Sumit

1. YES I NEED YOUR HELP ON THIS - media cleaner has stopped in the middle
- don't forget their are thumbnails as well
OR alternatively, release a WPML fix to handle duplicates by ignoring them without retrying to duplicate them,
since that happens when you translate brands, so i guess others are experiencing the same thing without even knowing.

"If you are having issues with media cleaner because of large data. I can write a script to detect and delete media posts."

2. This is simply indexing the JOIN between the tables would resolve the issue, also phpmyadmin advisor is speaking about this problem

"https://wpml.org/forums/topic/slow-down-on-mass-price-update/#post-13220995"

March 31, 2023 at 12:42 am #13371135

louisN-4

any update sumit please?

March 31, 2023 at 10:03 am #13374555

louisN-4

as you saw in the email corrospondance, media cleaner doesn't work on large sites
i already complained to the plugin owner on wordpress.org

we really need a solution from you about this bug

March 31, 2023 at 3:23 pm #13377299

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

Okay, I can see the media cleaner is not working correctly. Please allow me some time to write and test the script to clean the media.

don't forget their are thumbnails as well

Please note we will not delete the physical file from the disk we are going to delete only the media entry in the database so no thumbnail deletion is needed.

OR alternatively, release a WPML fix to handle duplicates by ignoring them without retrying to duplicate them,

Sorry, but this is not possible. This is DB corruption and we usually patch the DB in case of corruption because DB corruption can happen beyond our imagination and it is not possible to cover all the cases by automatic repair. We have covered a lot of cases in WPML troubleshooting but this is the first we see in years.

since that happens when you translate brands, so i guess others are experiencing the same thing without even knowing.

I am not sure if this happens with brand creation. If you can replicate it on the staging site and share the steps with me then of course I will report to our development team.

This is simply indexing the JOIN between the tables would resolve the issue, also phpmyadmin advisor is speaking about this problem

I am sorry but I am not following what do you mean by indexing the join.
As per my understanding joining happens on columns and we index the columns based on join, where clause, order by, etc. The concept varies for each query.

The query you are pointing out is not the WPML query it is WooCommerce query or some add-on query we are just joining it with our tabels.

If your PHPMyAdmin adviser can explain to me an example of how to INDEX a Join then it would be good.
Currently, this is what we are following hidden link

Thanks

March 31, 2023 at 3:27 pm #13377329

louisN-4

regarding deleting db pointing to duplicate images - i will wait for your script or fix

regarding the JOIN (https://wpml.org/forums/topic/slow-down-on-mass-price-update/#post-13220995) + hidden link
- i would raise the subject with knownhost, THEY are super profesionals

March 31, 2023 at 3:40 pm #13377401

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

regarding the JOIN (https://wpml.org/forums/topic/slow-down-on-mass-price-update/#post-13220995) + hidden link;

these links are the same as I posted in my previous message. I understand you are pointing me to the query and the answer which I posted. But my question is there is no concept of Indexing the join in SQL. Or I don't know yet so please reach out to the person who suggested indexing the join to give an example or point to the documentation in MySQL.

Thanks

March 31, 2023 at 3:44 pm #13377409

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

I saw you wrote an email to support. I will wait for their answer.

Thank you 🙂

April 1, 2023 at 1:25 pm #13381173

louisN-4

knownhost answered and gave a paste

you also have the phpmyadmin access, so you can check if all the relevant tables are indexed including the woocommerce

April 3, 2023 at 3:16 pm #13392057

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

As I saw in the mail. They just suggested the idea of indexing without checking whether it is.

I already checked this in your database all tables are indexed. I will double-check them if any default indexes are missing but right now I am working on the script it is 50% completed.

I will share the script once it is done.

Thanks

April 3, 2023 at 3:29 pm #13392447

louisN-4

1. maybe the woocommerce table that is related to the price sync is not indexed? can you check please?

2. about media script, thanks eagerly waiting for it...

3.you have a bug on this forum - i think,

where i try to read this page:
https://wpml.org/forums/topic/slow-down-on-mass-price-update/page/4/

it sends me back to:
https://wpml.org/forums/topic/slow-down-on-mass-price-update/

April 5, 2023 at 8:57 am #13407725

louisN-4

hello sumit, any update on the script for media duplicate issue?