get_charset_collate(); // --- Tabella 1: ncb_arm_redirects --- $table_redirects = $wpdb->prefix . 'ncb_arm_redirects'; $sql_redirects = "CREATE TABLE $table_redirects ( id mediumint(9) NOT NULL AUTO_INCREMENT, url_from TEXT NOT NULL, url_to TEXT NOT NULL, status VARCHAR(10) NOT NULL DEFAULT '301', type VARCHAR(20) NOT NULL DEFAULT 'url', query_string_mode VARCHAR(20) NOT NULL DEFAULT 'ignore', count mediumint(9) NOT NULL DEFAULT 0, last_hit DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL, created_at DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL, PRIMARY KEY (id), KEY url_from_key (url_from(191)) ) $charset_collate;"; dbDelta( $sql_redirects ); // --- Tabella 2: ncb_arm_404_log --- $table_404_log = $wpdb->prefix . 'ncb_arm_404_log'; $table_exists = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $table_404_log ) ) === $table_404_log; if ( ! $table_exists ) { $sql_404_log = "CREATE TABLE $table_404_log ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, url text NOT NULL, timestamp datetime NOT NULL, user_agent text NOT NULL, referrer text, ip varchar(45) NOT NULL DEFAULT '', PRIMARY KEY (id), KEY timestamp_key (timestamp) ) $charset_collate;"; $wpdb->query( $sql_404_log ); } } private static function set_default_options() { if ( get_option( 'ncb_arm_404_log_limit' ) === false ) { add_option( 'ncb_arm_404_log_limit', 200, '', 'no' ); } if ( get_option( 'ncb_arm_404_logging_enabled' ) === false ) { add_option( 'ncb_arm_404_logging_enabled', 1, '', 'no' ); } } }