oont-contents/plugins/wp-optimize/includes/tables/class-wp-optimize-table-404-detector.php
2025-02-10 13:57:45 +01:00

61 lines
1.3 KiB
PHP

<?php
if (!defined('ABSPATH')) die('No direct access allowed');
if (!class_exists('WP_Optimize_Table_404_Detector')) :
class WP_Optimize_Table_404_Detector implements WP_Optimize_Table_Interface {
/**
* Name of the table
*
* @var string
*/
private $table_name = '404_detector';
/**
* Complete table name with prefix
*
* @return string
*/
public function get_table_name() {
global $wpdb;
return $wpdb->base_prefix . 'wpo_' . $this->table_name;
}
/**
* Table fields and keys (if any)
*
* @return array
*/
public function describe() {
return array(
'fields' => array(
'url' => 'TEXT NOT NULL',
'request_timestamp' => 'BIGINT UNSIGNED NOT NULL',
'request_count' => 'BIGINT UNSIGNED NOT NULL',
'referrer' => 'TEXT NOT NULL'
),
'keys' => array(
'url_timestamp_referrer' => '(url(75),request_timestamp,referrer(75))',
'timestamp_count' => '(request_timestamp,request_count)'
),
'unique' => 'url(75),request_timestamp,referrer(75)'
);
}
/**
* Returns singleton instance
*
* @return WP_Optimize_Table_404_Detector
*/
public static function get_instance() {
static $instance = null;
if (null === $instance) {
$instance = new self();
}
return $instance;
}
}
endif;