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, 7 months ago.

Assisted by: Sumit.

Author Posts
April 12, 2023 at 7:41 am #13452663

louisN-4

Hi Sumit,

What are the next steps please

April 12, 2023 at 8:26 am #13452959

Sumit
Supporter

Languages: English (English )

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

Hi,

That's good!

I will now proceed with clearing leftovers as stated here https://wpml.org/forums/topic/slow-down-on-mass-price-update/page/4/#post-13416943

Please let me know if I have permission to proceed.

Thanks

April 12, 2023 at 10:59 am #13454675

louisN-4

yes you have my permission to continue

April 12, 2023 at 2:36 pm #13456863

Sumit
Supporter

Languages: English (English )

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

Hi,

I have done with the queries. All seems to be good now.
The last step is

There are 4751922 total images but only 3151914 are registered with WPML rest of them missing the language of images.

Now you need to duplicate the media and leave the process until finished it may take a while.
Please go to WPML >Settings > Media translation and click start.
Ref:- https://wpml.org/documentation/getting-started-guide/media-translation/#id5

One weird thing I noticed when I was counting the media in DB. Someone is deleting media files on your site I am not sure what it is. But I see the difference in counting.
Are you deleting the media files or this is some kind of CRON job?

Thanks

April 12, 2023 at 2:40 pm #13456877

louisN-4

are you talking about deleting new products or posts media deletion,
since that can happen when wp-all-import is unsuccessful

if its OLD, this is indeed odd and we have to get to the bottom of it

- I have started: "WPML >Settings > Media translation"

April 12, 2023 at 2:53 pm #13457063

Sumit
Supporter

Languages: English (English )

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

I am not sure I just wanted to let you know to avoid confusion because you know I was also working on the site.

However, I don't see any difference in other post types except media.

You can run this query to see the count of media in PHPMyAdmin

SELECT COUNT(ID) as cnt FROM `lsk_posts` WHERE post_type = 'attachment';

You can remove the WP CLI that I added from the file. I hope server support has not started the command again?

April 12, 2023 at 2:56 pm #13457119

louisN-4

i am running what you asked, it started from
Setting language to media. 1,610,000 left

and now stands on
Setting language to media. 1,597,475 left

so its indeed going to take a while

April 12, 2023 at 3:04 pm #13457135

Sumit
Supporter

Languages: English (English )

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

Hi,

Yes, it will take a while.
WPML duplicate the media as soon as you upload them so these media files are left because you might have added new language and you have millions of media files. Thus adding a new language mean duplicating the million entry to the new language.

So I would suggest as soon you as you add new language duplicate the media files manually overnight so you can avoid triggering the calls all in the middle when you are working on the site.

You can also turn this off and have single media entry for all language but then you won't be able to translate the caption, alt etc.

April 12, 2023 at 3:11 pm #13457145

Sumit
Supporter

Languages: English (English )

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

I see your server support says the command is running but it seems they started again because it was finished.

Please ask them to stop it and I will do the same process again.

Don't worry any files will not be deleted the command is not written any way to delete the actual file or real media entry.

Please confirm when it is done and I will repeat the process.

April 12, 2023 at 3:13 pm #13457151

louisN-4

i dont mind not translating alts

1. how can i stop this media duplication now, as you have seen in the email, knownhost reported to us falsely that the script finishd, and it didn't - SO this is the deletion you are seeing

2. how do i make the media duplication not needed?

April 12, 2023 at 3:23 pm #13457243

Sumit
Supporter

Languages: English (English )

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

Hi,

I saw the command is not finished yet. I wonder why.
Let me check few things in DB and I will let you know.

Yes, please stop the duplication just refresh the page and it will be stopped.

April 12, 2023 at 3:29 pm #13457259

louisN-4

i refreshed the page, but i think our best "bet" would be what you suggested

"turn this off and have single media entry for all language but then you won't be able to translate the caption"

just tell me what to set in our settings, or you can set it, what ever you decide, this will put this subject behind us and redude load on wpml

April 12, 2023 at 3:59 pm #13457583

Sumit
Supporter

Languages: English (English )

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

Hi,

I will let you know that method after testing on my local system what happens to existing media files.

But I would like to let you know why that command still running. Please pay close attention to my feedback.

I see there still a lot of duplicate media files. It seems the command is deleting the media and someone is creating the media thus it keeps running so long.

It is not WPML for sure, because I wrote the script to delete and treat it as duplicate only if
- URL is same
- Upload date is same

That is what WPML does when translating the media file into other languages.

But in your database the date is different even the URL is same. Please see the screenshot. So the command will not delete them as those are not duplicates as per WPML concept.
All these IDs have the same URL but different date.

I can just guess it could be WP All import. So deleting them will not be a good idea as we don't know which one is being used on site. But I found the post it was uploaded to is deleted so it could be WP All import.

I am sorry but I can not go further than this due to our policy you need to contact someone professional to clean the unused media file and free up some space to speed up the DB.
but I can guarantee you it is not WPML.

I will update you how we can use media files without translating them.

I hope it helps.

PS:- If you are running the command just stop the import process until the command is finished.
It was my mistake I should have added a progress indicator there.

Thanks

Screenshot 2023-04-12.png
April 12, 2023 at 4:41 pm #13458071

louisN-4

What you showed me is from January 14th, so it not something creating it now

this is also why i suggested to avoid media duplication at all, and just use 1 media for all languages (will wait for your test)

we have this plugin Regenerate Thumbnails or WP-All-Import that could have created issues for this media thingy,
But after we move to 1 media for all languages, i am sure we will be behind this problem

April 12, 2023 at 5:35 pm #13458619

louisN-4

Sumit - you might also want to investigate with WP-All-Import,
since its an approved plugin by WPML

How do they handle Failed Imports,

because if you ask me, this is what happened here.

additionally another option, is that a post is getting deleted, but the db record for the media is not being deleted.
- But i tend to believe the first option of WP-All-Import not properly handling failed imports is the issue of the media duplicates.