PluginProbe
Cookie Consent – GDPR & CCPA Cookie Banner & Consent Manager / 0.0.3
Cookie Consent – GDPR & CCPA Cookie Banner & Consent Manager v0.0.3
0.0.11 0.0.10 0.0.9 0.0.8 0.0.7 0.0.6 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5
cookiez / modules / scanner / database / scan-url-table.php

scan-url-table.php in Cookie Consent – GDPR & CCPA Cookie Banner & Consent Manager 0.0.3, at modules/scanner/database/scan-url-table.php

101 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Cookiez\Modules\Scanner\Database;
4
5 use Cookiez\Classes\Database\{
6 Database_Constants,
7 Table
8 };
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12 }
13
14 /**
15 * Class Scan_Url_Table
16 * Stores URLs scanned in each scan
17 */
18 class Scan_Url_Table extends Table {
19 const DB_VERSION = '3';
20 const DB_VERSION_FLAG_NAME = 'cookiez_scan_url_db_version';
21
22 const ID = 'id';
23 const SCAN_ID = 'scan_id';
24 const URL = 'url';
25 const SCAN_STATUS = 'scan_status';
26 const ERROR_CODE = 'error_code';
27 const CREATED_AT = 'created_at';
28 const UPDATED_AT = 'updated_at';
29
30 public static $table_name = 'cookiez_scan_urls';
31
32 /**
33 * Get table columns definition
34 * @return array
35 */
36 public static function get_columns(): array {
37 return [
38 self::ID => [
39 'type' => Database_Constants::get_col_type( Database_Constants::BIGINT ) . ' UNSIGNED',
40 'flags' => Database_Constants::build_flags_string( [
41 Database_Constants::NOT_NULL,
42 Database_Constants::AUTO_INCREMENT,
43 ] ),
44 'key' => Database_Constants::get_primary_key_string( self::ID ),
45 ],
46 self::SCAN_ID => [
47 'type' => Database_Constants::get_col_type( Database_Constants::BIGINT ) . ' UNSIGNED',
48 'flags' => Database_Constants::build_flags_string( [
49 Database_Constants::NOT_NULL,
50 ] ),
51 ],
52 self::URL => [
53 'type' => Database_Constants::get_col_type( Database_Constants::TEXT ),
54 'flags' => Database_Constants::build_flags_string( [
55 Database_Constants::NOT_NULL,
56 ] ),
57 ],
58 self::SCAN_STATUS => [
59 'type' => Database_Constants::get_col_type( Database_Constants::VARCHAR, 20 ),
60 'flags' => Database_Constants::build_flags_string( [
61 Database_Constants::NOT_NULL,
62 ] ),
63 ],
64 self::ERROR_CODE => [
65 'type' => Database_Constants::get_col_type( Database_Constants::TEXT ),
66 'flags' => Database_Constants::build_flags_string( [
67 Database_Constants::NULL,
68 ] ),
69 ],
70 self::CREATED_AT => [
71 'type' => Database_Constants::get_col_type( Database_Constants::DATETIME ),
72 'flags' => Database_Constants::build_flags_string( [
73 Database_Constants::NOT_NULL,
74 Database_Constants::DEFAULT,
75 Database_Constants::CURRENT_TIMESTAMP,
76 ] ),
77 ],
78 self::UPDATED_AT => [
79 'type' => Database_Constants::get_col_type( Database_Constants::DATETIME ),
80 'flags' => Database_Constants::build_flags_string( [
81 Database_Constants::NOT_NULL,
82 Database_Constants::DEFAULT,
83 Database_Constants::CURRENT_TIMESTAMP,
84 Database_Constants::ON_UPDATE,
85 Database_Constants::CURRENT_TIMESTAMP,
86 ] ),
87 ],
88 ];
89 }
90
91 /**
92 * Get additional keys for the table
93 * @return array
94 */
95 protected static function get_extra_keys(): array {
96 return [
97 Database_Constants::build_key_string( Database_Constants::KEY, self::SCAN_ID ),
98 ];
99 }
100 }
101