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 30, 2023 at 11:00 pm #13563543

louisN-4

good week - the process seem to have finished,

i have re-activated your admin access so you can enter and see if now things are ok

May 3, 2023 at 1:56 pm #13579255

louisN-4

ok it seems like it ddn't finish, but probably would finish over the next several days

you initial calculation said 22 days from the 13/4/2023,

i did notify some log warning related to this

[03-May-2023 12:56:20 UTC] PHP Warning: The use statement with non-compound name 'WPMLMediaOption' has no effect in /home/kidenoad/domains/kideno.com/public_html/wp-content/themes/kidz-child/functions/wpmlsupp-10550_fix.php on line 69
[03-May-2023 12:56:20 UTC] PHP Warning: The use statement with non-compound name 'WPMLMediaOption' has no effect in /home/kidenoad/domains/kideno.com/public_html/wp-content/themes/kidz-child/functions/wpmlsupp-10550_fix.php on line 69
[03-May-2023 12:56:20 UTC] PHP Warning: The use statement with non-compound name 'WPMLMediaOption' has no effect in /home/kidenoad/domains/kideno.com/public_html/wp-content/themes/kidz-child/functions/wpmlsupp-10550_fix.php on line 69
[03-May-2023 13:00:03 UTC] PHP Warning: The use statement with non-compound name 'WPMLMediaOption' has no effect in /home/kidenoad/domains/kideno.com/public_html/wp-content/themes/kidz-child/functions/wpmlsupp-10550_fix.php on line 69
[03-May-2023 13:15:03 UTC] PHP Warning: The use statement with non-compound name 'WPMLMediaOption' has no effect in /home/kidenoad/domains/kideno.com/public_html/wp-content/themes/kidz-child/functions/wpmlsupp-10550_fix.php on line 69

May 4, 2023 at 11:38 am #13585831

Sumit
Supporter

Languages: English (English )

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

Hi,

Sorry for the delay.

I see in the emails the delete command has been re-started.
Please note, if you re-start the command it will scan each image and look for duplicate files, if no files are found it says 0 files deleted. But each time you will run it it will run.

So I would suggest halting it once it starts logging "Deleted 0 items for image" continuously.

About the warning, I saw no error on my system so I checked the code added by your team and found, by mistake they have removed the slashes in the code.

In code, I provided, this line was

use WPML\Media\Option;

but added as

use WPMLMediaOption;

Please see the screenshot for more details.

Please copy the code again from here https://wpml.org/forums/topic/slow-down-on-mass-price-update/page/7/#post-13518127 and paste it correctly.

Thanks

Screenshot 2023-05-04-2.png
Screenshot 2023-05-04-1.png
May 4, 2023 at 11:43 am #13585939

louisN-4

Hi Sumit
Last night i deleted 200k orphan meta post, so more are getting deleted for sure, after all its a site of 2 years with over 50k products in several languages
so a lot of duplicates as you said so early on

as for

1
use WPML\Media\Option;
but added as

1
use WPMLMediaOption;

when you get this code via email the \ is deleted so this is where the error originated from

May 4, 2023 at 12:04 pm #13586237

Sumit
Supporter

Languages: English (English )

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

Hi,

Okay then let it be. But I shared you when you can predict the process is finished and running without real output.

About the code error, yes that is what I predicted. Please share the direct link with your team, this is public forum so they can copy directly from this thread.

This is the link https://wpml.org/forums/topic/slow-down-on-mass-price-update/page/6/#post-13518127 for non-logged-in users.

Thanks

May 4, 2023 at 1:47 pm #13587053

louisN-4

done we have updated the code

but i might need you to check if the duplication process is now running and shut it down again, please

May 4, 2023 at 7:10 pm #13589749

Sumit
Supporter

Languages: English (English )

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

Hi,

I spent 10 to 15 min on your website and there were only two processes running.
- Server state plugin process
- WordPress heartbeat process.

There was no duplication process running from WPML. Also, this is expected that it won't run again, I think there is no way left to trigger the process.

Thanks

May 4, 2023 at 8:32 pm #13590019

louisN-4

Thank you very much

May 10, 2023 at 8:08 pm #13626487

louisN-4

sumit - can you please check how many duplicate are left?

May 11, 2023 at 4:42 pm #13632171

Sumit
Supporter

Languages: English (English )

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

Hi,

I checked the duplicates there are only 35k items left to delete. Last month we check the number was 488k.

We both did not notice that during this process you added a new language and now we have 5 languages but CLI command treats more than 5 items with the same URL as duplicates so it is going over almost all images in the database but deletes nothing as those are valid translation from WPML. (I added a check in command to do not delete valid items)

Since you started the command again so the process started again and doing nothing that's why showing 0 items are deleted.

I will adjust the command to new number a of languages. And you can ask them to kill the current command and run it again when it is updated.

I hope 35k items will be done in a day or two.

Also, good news there is no duplicate since you started this ticket I checked the number of duplicates after March but there was none.

Please wait for few more minutes and I will give you the new command link.

Thanks

May 11, 2023 at 4:46 pm #13632181

louisN-4

THank you, i will tell them to stop now

and will wait for the next command from you

May 11, 2023 at 5:49 pm #13632395

Sumit
Supporter

Languages: English (English )

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

Hi Udi,

I have updated the script the link is same hidden link

The process is same, Please see https://wpml.org/forums/topic/slow-down-on-mass-price-update/page/5/#post-13439023

This time, we are checking more than 5 items + added an indicator showing the percent of the process so this will be easy for us to understand what is going on.

Once the code is updated in the theme, please request the hosting support to run again in the same format.

Thanks

May 23, 2023 at 8:52 pm #13703523

louisN-4

main main main issue here and we know it now.

wpml translation is considered a slow query
hidden link

what we have decided to do, is never translate when the cpu/s level is above 0.6 average

thank you sumit for your dedicated help here !

May 24, 2023 at 2:20 pm #13708579

louisN-4

we would be also happy if you address those slow queries, but if you can't our workaround is as detailed in

https://wpml.org/forums/topic/slow-down-on-mass-price-update/page/8/#post-13703523

May 24, 2023 at 4:06 pm #13709845

Sumit
Supporter

Languages: English (English )

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

Hi,

The query you posted in the screenshot of the mail is a known issue. We have this slow query and this will be improved in future versions of WPML.

If you need a patch to make it work then please follow these steps:-
#1 Make sure you have a complete backup of site files and DB (Just a good practice.)
#2 Edit the file wp-content\plugins\sitepress-multilingual-cms\inc\taxonomy-term-translation\wpml-term-translation.class.php
#3 and replace the function

	private function maybe_warm_term_id_cache() {

		if ( ! isset( $this->ttids ) || ! isset( $this->term_ids ) ) {

			$data           = $this->wpdb->get_results(
				'	SELECT wpml_translations.element_id, tax.term_id, tax.taxonomy
													 ' . $this->get_element_join() . "
													 JOIN {$this->wpdb->terms} terms
													  ON terms.term_id = tax.term_id
													 WHERE tax.term_id != tax.term_taxonomy_id",
				ARRAY_A
			);
			$this->term_ids = array();
			$this->ttids    = array();
			foreach ( $data as $row ) {
				$this->ttids[ $row['term_id'] ]                     = isset( $this->ttids[ $row['term_id'] ] )
					? $this->ttids[ $row['term_id'] ] : array();
				$this->ttids[ $row['term_id'] ][ $row['taxonomy'] ] = $row['element_id'];
				$this->term_ids[ $row['element_id'] ]               = $row['term_id'];
			}
		}
	}

with

	private function maybe_warm_term_id_cache() {
		$cached_value = wp_cache_get('wpml_adjust_ttid_for_term_id', 'wpml_terms');
		
		if ( empty($cached_value) ) {

			$data           = $this->wpdb->get_results(
				'	SELECT wpml_translations.element_id, tax.term_id, tax.taxonomy
													 ' . $this->get_element_join() . "
													 JOIN {$this->wpdb->terms} terms
													  ON terms.term_id = tax.term_id
													 WHERE tax.term_id != tax.term_taxonomy_id",
				ARRAY_A
			);
			$this->term_ids = array();
			$this->ttids    = array();
			foreach ( $data as $row ) {
				$this->ttids[ $row['term_id'] ]                     = isset( $this->ttids[ $row['term_id'] ] )
					? $this->ttids[ $row['term_id'] ] : array();
				$this->ttids[ $row['term_id'] ][ $row['taxonomy'] ] = $row['element_id'];
				$this->term_ids[ $row['element_id'] ]               = $row['term_id'];
			}
			
			wp_cache_set('wpml_adjust_ttid_for_term_id', [
				'term_ids'	=> $this->term_ids,
				'ttids'		=> $this->ttids
			], 'wpml_terms');
		} else {
			$this->term_ids = $cached_value['term_ids'];
			$this->ttids = $cached_value['ttids'];
		}
	}

#4 Then add the below code in theme functions.php

add_action('clean_term_cache', function(){
	wp_cache_delete('wpml_adjust_ttid_for_term_id', 'wpml_terms');
});

These changes will cache the query results in the object caching which I hope you have. So this will not fire every time.

About the logs you sent me there are 400+ queries in the logs coming from different plugins/themes I am not sure which one to blame the WPML.
If a query shows icl tables in the statement it does not mean this is fired by WPML it just means that WPML joins the table to filter the results. So adding join could cost the time but not the entire query time taken by WPML also this is not clear how these queries were fired.

I would suggest sticking with the query monitor plugin this gives me the idea of action when the query is fired and details about the query.

Thanks