PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.7.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.7.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / includes / tables / class-wp-optimize-table-404-detector.php

class-wp-optimize-table-404-detector.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 4.7.0, at includes/tables/class-wp-optimize-table-404-detector.php

62 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) die('No direct access allowed');
3
4 if (!class_exists('WP_Optimize_Table_404_Detector')) :
5
6 class WP_Optimize_Table_404_Detector implements WP_Optimize_Table_Interface {
7
8 /**
9 * Name of the table
10 *
11 * @var string
12 */
13 private $table_name = '404_detector';
14
15 /**
16 * Complete table name with a prefix
17 *
18 * @return string
19 */
20 public function get_table_name(): string {
21 global $wpdb;
22
23 return $wpdb->base_prefix . 'wpo_' . $this->table_name;
24 }
25
26 /**
27 * Table fields and keys (if any)
28 *
29 * @return array
30 */
31 public function describe(): array {
32 return array(
33 'fields' => array(
34 'url' => 'TEXT NOT NULL',
35 'request_timestamp' => 'BIGINT UNSIGNED NOT NULL',
36 'request_count' => 'BIGINT UNSIGNED NOT NULL',
37 'referrer' => 'TEXT NOT NULL'
38 ),
39 'keys' => array(
40 'url_timestamp_referrer' => '(url(75),request_timestamp,referrer(75))',
41 'timestamp_count' => '(request_timestamp,request_count)'
42 ),
43 'unique' => 'url(75),request_timestamp,referrer(75)'
44 );
45 }
46
47 /**
48 * Returns singleton instance
49 *
50 * @return WP_Optimize_Table_404_Detector
51 */
52 public static function get_instance() {
53 static $instance = null;
54 if (null === $instance) {
55 $instance = new static();
56 }
57 return $instance;
58 }
59 }
60
61 endif;
62