Using these views

This commit is contained in:
Eric van der Vlist 2020-05-05 15:42:46 +02:00
parent 0097514442
commit 4ef5fe2994
1 changed files with 9 additions and 27 deletions

View File

@ -475,15 +475,9 @@ if (!class_exists("Owark")) {
log_function_call(); log_function_call();
global $wpdb; global $wpdb;
$q = " $q = "
SELECT owark.id SELECT id
FROM {$wpdb->prefix}blc_instances AS instances, FROM {$wpdb->prefix}owark_broken_links
{$wpdb->prefix}blc_links AS links, WHERE url = %s
{$wpdb->prefix}owark AS owark
WHERE
instances.link_id = links.link_id
AND owark.url = %s
AND owark.url = instances.raw_url
AND links.broken = 1
"; ";
print_r_log($q); print_r_log($q);
$q = $wpdb->prepare($q, $url); $q = $wpdb->prepare($q, $url);
@ -516,16 +510,10 @@ if (!class_exists("Owark")) {
//Retrieve info about all occurrences of broken links in the current post //Retrieve info about all occurrences of broken links in the current post
//which happens for comments (they have links to check in 2 different filters) //which happens for comments (they have links to check in 2 different filters)
$q = " $q = "
SELECT instances.raw_url, owark.id SELECT url, id
FROM {$wpdb->prefix}blc_instances AS instances, FROM {$wpdb->prefix}owark_broken_links
{$wpdb->prefix}blc_links AS links, WHERE container_id = %s
{$wpdb->prefix}owark AS owark AND container_type = %s
WHERE
instances.link_id = links.link_id
AND owark.url = instances.raw_url
AND instances.container_id = %s
AND instances.container_type = %s
AND links.broken = 1
"; ";
print_r_log($q); print_r_log($q);
$q = $wpdb->prepare($q, $this->post_id, $this->post_type); $q = $wpdb->prepare($q, $this->post_id, $this->post_type);
@ -534,7 +522,7 @@ if (!class_exists("Owark")) {
$this->broken_links = array(); $this->broken_links = array();
foreach ($results as $link) { foreach ($results as $link) {
$this->broken_links[$link->raw_url] = $link->id; $this->broken_links[$link->url] = $link->id;
} }
} }
@ -693,13 +681,7 @@ if (!class_exists("Owark")) {
global $wpdb; global $wpdb;
$query = " $query = "
SELECT DISTINCT instances.raw_url as url SELECT url from {$wpdb->prefix}owark_links_to_ckeck";
from {$wpdb->prefix}blc_links as links,
{$wpdb->prefix}blc_instances AS instances
WHERE url NOT IN (SELECT url FROM {$wpdb->prefix}owark)
AND broken=0
AND last_check is not null
AND instances.link_id = links.link_id";
print_r_log("query: $query"); print_r_log("query: $query");
$url = $wpdb->get_row($query); $url = $wpdb->get_row($query);