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
April 5, 2023 at 11:54 am #13409967

Sumit
Supporter

Languages: English (English )

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

Hi,

As I requested let's proceed one by one. About WooCommerce index let's first finish the media issues.

For the forum bug, please open the link when you are logged-in to the wpml.org forum. The number of pages are different for logged-in and logged-out users due to private replies.

I have shared the script here hidden link

Please follow these steps:-

#1 Make sure you have a complete DB backup. Or try this on the staging site first.
#2 Copy the code from the above link and paste to theme functions.php
#3 Now logged into the site and visit the dashboard then visit this URL hidden link
#4 Let the script run and wait do not close the browser and tab. It will keep refreshing the page, I have done it to avoid a request termination in one go.
Once it is done copy the logs that you will see in the notice and please share them here.
#5 Confirm if everything on the site is fine regarding the images.

After your feedback, I will clean the leftover from WPML tables using PHPMyAdmin and then we will duplicate images using WPML once all the processes are done the WPML media slow queries issue should be fixed.

Thanks

April 5, 2023 at 8:35 pm #13414073

louisN-4

what did you mean?

After your feedback, I will clean the leftover from WPML tables using PHPMyAdmin

and then we will duplicate images using WPML once all the processes are done the WPML media slow queries issue should be fixed.

- i understood you don't actually plan to delete files, can you clarify what the script do?

April 6, 2023 at 7:53 am #13416943

Sumit
Supporter

Languages: English (English )

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

Hi,

Please see the documentation of WPML media https://wpml.org/documentation/getting-started-guide/media-translation/#id5

It says

Please note that WPML Media Translation doesn’t duplicate any files on your site. Duplication here means that new entries are created in the database with your translated image captions, titles, meta text, and other information.

The script will delete duplicated entries from the database. After it posts meta table and WPML tables need to be cleaned.
Post meta table can be cleaned using this query

DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL

Deleting post meta for the posts that do not exist in the WP posts table.

WPML tables can be fixed from WPML troubleshooting options. https://wpml.org/documentation/support/wpml-troubleshooting-options/

Then after it we will run WPML media duplication defined here https://wpml.org/documentation/getting-started-guide/media-translation/#id5

That is the root of the issue. Running in the background and slowing your site. Once WPML media setup is done WPML does not run these background tasks.
Usually this happens in a couple of minutes when WPML is installed and new languages is added but since your database was corrupted this process was stuck.

Thanks

April 6, 2023 at 10:03 am #13418631

louisN-4

just sharing that we saw the same behavior of brands also in blog, that some images db entities were not created,
hopefully the script will resolve it too

wiill keep you updated.

April 10, 2023 at 9:37 am #13436645

louisN-4

we started running the script,
it said it found 488893 duplicates

and now the screen starts refreshing like you said, and so far it deleted 402 items

April 10, 2023 at 9:43 am #13436703

louisN-4

QUESTION:

it continuously show Deleted 402 items for image hidden link
not sure when this will change it says deleting 402 images

April 10, 2023 at 10:03 am #13436773

Sumit
Supporter

Languages: English (English )

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

Hi,

If you think it is stuck. Please close the tab and do not run it. I will check in a couple of minutes. What is happening

Thanks

April 10, 2023 at 10:08 am #13436787

louisN-4

we closed the tab, you can check

April 10, 2023 at 12:44 pm #13437411

Sumit
Supporter

Languages: English (English )

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

May I know where you have added this script?
It seems the server caching causing this issue.

April 10, 2023 at 1:41 pm #13437491

louisN-4

its inside functions.php

and if you load the site from the same browser you are logged in, you will not be served with cache, try even incognito admin and then run in another tab the

April 10, 2023 at 2:29 pm #13437719

Sumit
Supporter

Languages: English (English )

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

Nevermind I found it here in child theme functions/wpmlsupp-10550_fix.php
but I don't have the write permission to change the code there.

So I checked the caching setting and found you have turned on Cache WP-Admin in LiteSpeed object cache and that object caching giving inaccurate results to the script.
I have turned this off while running the script and so far it is fine.

You may see higher CPU and RAM uses please be patient I will update you once it is finished.

April 10, 2023 at 2:47 pm #13437797

louisN-4

so you don't need access to

wpmlsupp-10550_fix.php ?

April 10, 2023 at 3:21 pm #13437943

louisN-4

thanks for the update and

we can keep your disable you did on

Cache WP-Admin in LiteSpeed and
object caching

how long do you expect the process to end?

ONCE IT FINISHES
you will run

DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL

and after do what you need through wpml?

April 10, 2023 at 5:16 pm #13439023

Sumit
Supporter

Languages: English (English )

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

Hi,

This is taking too much time to finish. I don't think we can make it like this so I have converted it to WP CLI command.

With WP CLI command you can ask server support to run it and then turn on the caching if you wish in backend and continue working.

Please follow these new steps:-
1. Copy the code from the same link here hidden link
2. Replace the code that you added previously with this new code.
3. Ask your server support to run this command

wp DeleteMediaDuplicates

Please ask them to log the output of this command in a file so we can have it later if needed.

I will keep checking mails when the command is finished.

Thanks

April 11, 2023 at 1:17 pm #13446195

louisN-4

Analyze Content : 100% [===============================================================================================================================================================] 55:39 / 50:49Error: באתר זה אירעה שגיאה קריטית.מידע נוסף על ניפוי תקלות בוורדפרס. באתר זה אירעה שגיאה קריטית.
* Method : Filesystem
* Check Library : yes
* Check Content : yes
* Check Live : no
---------------------------

Here is the verbose output:
---------------------------
hidden link

Whats next?