Updating these views and adding a third one to list the rchives with their status.
This commit is contained in:
parent
4ef5fe2994
commit
ba2cc3ec40
33
owark.php
33
owark.php
|
@ -188,7 +188,7 @@ if (!class_exists("Owark")) {
|
|||
$sql = "CREATE OR REPLACE VIEW {$wpdb->prefix}owark_broken_links AS
|
||||
SELECT
|
||||
owark.id as id,
|
||||
instances.raw_url as url,
|
||||
owark.url as url,
|
||||
instances.container_id as container_id,
|
||||
instances.container_type as container_type,
|
||||
instances.container_field as container_field
|
||||
|
@ -198,21 +198,34 @@ if (!class_exists("Owark")) {
|
|||
{$wpdb->prefix}blc_instances AS instances
|
||||
WHERE
|
||||
owark.url = instances.raw_url
|
||||
AND instances.link_id = links.link_id
|
||||
AND broken = 1
|
||||
AND last_check is not null
|
||||
AND instances.link_id = links.link_id";
|
||||
print_r_log("sql: $sql");
|
||||
$wpdb->query($sql);
|
||||
$sql = "CREATE OR REPLACE VIEW {$wpdb->prefix}owark_links_to_ckeck AS
|
||||
$sql = "CREATE OR REPLACE VIEW {$wpdb->prefix}owark_archives AS
|
||||
SELECT
|
||||
owark.*,
|
||||
links.broken,
|
||||
links.first_failure
|
||||
FROM
|
||||
{$wpdb->prefix}owark as owark,
|
||||
{$wpdb->prefix}blc_links as links,
|
||||
{$wpdb->prefix}blc_instances AS instances
|
||||
WHERE
|
||||
owark.url = instances.raw_url
|
||||
AND instances.link_id = links.link_id
|
||||
GROUP BY owark.url";
|
||||
print_r_log("sql: $sql");
|
||||
$wpdb->query($sql);
|
||||
$sql = "CREATE OR REPLACE VIEW {$wpdb->prefix}owark_links_to_archive AS
|
||||
SELECT
|
||||
DISTINCT instances.raw_url as url
|
||||
FROM
|
||||
{$wpdb->prefix}blc_links as links,
|
||||
{$wpdb->prefix}blc_instances AS instances
|
||||
WHERE
|
||||
instances.link_id = links.link_id
|
||||
AND broken = 0
|
||||
broken = 0
|
||||
AND instances.link_id = links.link_id
|
||||
AND url NOT IN (SELECT url FROM wp_owark)";
|
||||
print_r_log("sql: $sql");
|
||||
|
@ -350,10 +363,10 @@ if (!class_exists("Owark")) {
|
|||
|
||||
echo '<p>List of broken links with archived pages:</p>';
|
||||
|
||||
$query = "SELECT owark.id, owark.url, owark.status, owark.arc_date, owark.arc_location, blc_links.status_text
|
||||
FROM {$wpdb->prefix}owark AS owark, {$wpdb->prefix}blc_links as blc_links
|
||||
WHERE owark.url = blc_links.final_url COLLATE latin1_swedish_ci and blc_links.broken = 1
|
||||
ORDER BY owark.url";
|
||||
$query = "SELECT *
|
||||
FROM {$wpdb->prefix}owark_archives
|
||||
WHERE broken = 1
|
||||
ORDER BY url";
|
||||
$results = $wpdb->get_results($query);
|
||||
|
||||
echo '<table class="widefat">';
|
||||
|
@ -681,7 +694,7 @@ if (!class_exists("Owark")) {
|
|||
global $wpdb;
|
||||
|
||||
$query = "
|
||||
SELECT url from {$wpdb->prefix}owark_links_to_ckeck";
|
||||
SELECT url from {$wpdb->prefix}owark_links_to_archive";
|
||||
print_r_log("query: $query");
|
||||
|
||||
$url = $wpdb->get_row($query);
|
||||
|
|
Loading…
Reference in New Issue