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();
global $wpdb;
$q = "
SELECT owark.id
FROM {$wpdb->prefix}blc_instances AS instances,
{$wpdb->prefix}blc_links AS links,
{$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
SELECT id
FROM {$wpdb->prefix}owark_broken_links
WHERE url = %s
";
print_r_log($q);
$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
//which happens for comments (they have links to check in 2 different filters)
$q = "
SELECT instances.raw_url, owark.id
FROM {$wpdb->prefix}blc_instances AS instances,
{$wpdb->prefix}blc_links AS links,
{$wpdb->prefix}owark AS owark
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
SELECT url, id
FROM {$wpdb->prefix}owark_broken_links
WHERE container_id = %s
AND container_type = %s
";
print_r_log($q);
$q = $wpdb->prepare($q, $this->post_id, $this->post_type);
@ -534,7 +522,7 @@ if (!class_exists("Owark")) {
$this->broken_links = array();
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;
$query = "
SELECT DISTINCT instances.raw_url as url
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";
SELECT url from {$wpdb->prefix}owark_links_to_ckeck";
print_r_log("query: $query");
$url = $wpdb->get_row($query);