| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function install() { |
||
| 15 | |||
| 16 | global $wpdb; |
||
| 17 | |||
| 18 | $dataset_uri = Wordlift_Configuration_Service::get_instance()->get_dataset_uri(); |
||
| 19 | |||
| 20 | if ( ! $dataset_uri ) { |
||
| 21 | // Dont run the query, running it would delete all the values. |
||
| 22 | return; |
||
| 23 | } |
||
| 24 | $post_meta_table_name = $wpdb->postmeta; |
||
| 25 | $meta_key = Wordlift_Schema_Service::FIELD_SAME_AS; |
||
| 26 | |||
| 27 | $http = $wpdb->esc_like( 'http://' ) . '%'; |
||
| 28 | $https = $wpdb->esc_like( 'https://' ) . '%'; |
||
| 29 | $dataset_uri = $wpdb->esc_like( $dataset_uri ) . '%'; |
||
| 30 | $sql = $wpdb->prepare( "DELETE FROM $post_meta_table_name WHERE meta_key='$meta_key' |
||
| 31 | AND ( ( meta_value NOT LIKE %s AND meta_value NOT LIKE %s ) |
||
| 32 | OR meta_value LIKE %s )", $http, $https, $dataset_uri ); |
||
| 33 | $wpdb->query( $sql ); |
||
| 34 | |||
| 35 | } |
||
| 36 | |||
| 39 |