<commit_before><?php
/*
Plugin Name: Folksaurus WP
Plugin URI:
Description: Use Folksaurus for tags and categories.  Requires PHP 5.3.0 or higher.
Author: <NAME>
Version: 0.1
Author URI: http://zacharychavez.com
*/

global $wpdb;

define('FOLKSAURUS_WP_VERSION', 0.1);
define('FOLKSAURUS_TERM_DATA_TABLE', $wpdb->prefix . 'folksaurus_term_data');
define('FOLKSAURUS_TERM_REL_TABLE', $wpdb->prefix . 'folksaurus_term_relationships');

//add_action('plugins_loaded', 'folksaurusUpdateDBCheck');
//register_activation_hook(__FILE__, 'folksaurusSetupTables');
add_action('plugins_loaded', 'folksaurusSetupTables');

/**
 * Set up tables needed by Folksaurus WP
 */
function folksaurusSetupTables()
{
    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');

    global $wpdb;

    $sql = sprintf(
        "CREATE TABLE %s (
        term_id INT NOT NULL,
        folksaurus_id INT NOT NULL,
        scope_note TEXT NOT NULL,
        preferred BOOLEAN DEFAULT 0,
        ambiguous BOOLEAN DEFAULT 0,
        deleted BOOLEAN DEFAULT 0,
        last_retrieved datetime NOT NULL,
        PRIMARY KEY  term_id (term_id));",
        FOLKSAURUS_TERM_DATA_TABLE
    );
    dbDelta($sql);

    $tableName = $wpdb->prefix . "folksaurus_term_relationships";
    $sql = sprintf(
        "CREATE TABLE %s (
        term_id INT NOT NULL,
        rel_type enum('UF','NT','RT'),
        related_id INT NOT NULL,
        PRIMARY KEY  (term_id, rel_type, related_id));",
        FOLKSAURUS_TERM_REL_TABLE
    );
    dbDelta($sql);

    update_option('folksaurus_wp_version', FOLKSAURUS_WP_VERSION);
}

/**
 * Update the database if this is a new version of Folksaurus WP.
 */
function folksaurusUpdateDBCheck()
{
    if (get_site_option('folksaurus_wp_version') != FOLKSAURUS_WP_VERSION) {
        folksaurusSetupTables();
    }
}
<commit_msg>Reverted temporary hook changes that were done to get the table setup function to run before tests but which are otherwise unwanted.<commit_after><?php
/*
Plugin Name: Folksaurus WP
Plugin URI:
Description: Use Folksaurus for tags and categories.  Requires PHP 5.3.0 or higher.
Author: <NAME>
Version: 0.1
Author URI: http://zacharychavez.com
*/

global $wpdb;

define('FOLKSAURUS_WP_VERSION', 0.1);
define('FOLKSAURUS_TERM_DATA_TABLE', $wpdb->prefix . 'folksaurus_term_data');
define('FOLKSAURUS_TERM_REL_TABLE', $wpdb->prefix . 'folksaurus_term_relationships');

add_action('plugins_loaded', 'folksaurusUpdateDBCheck');
register_activation_hook(__FILE__, 'folksaurusSetupTables');

/**
 * Set up tables needed by Folksaurus WP
 */
function folksaurusSetupTables()
{
    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');

    global $wpdb;

    $sql = sprintf(
        "CREATE TABLE %s (
        term_id INT NOT NULL,
        folksaurus_id INT NOT NULL,
        scope_note TEXT NOT NULL,
        preferred BOOLEAN DEFAULT 0,
        ambiguous BOOLEAN DEFAULT 0,
        deleted BOOLEAN DEFAULT 0,
        last_retrieved datetime NOT NULL,
        PRIMARY KEY  term_id (term_id));",
        FOLKSAURUS_TERM_DATA_TABLE
    );
    dbDelta($sql);

    $tableName = $wpdb->prefix . "folksaurus_term_relationships";
    $sql = sprintf(
        "CREATE TABLE %s (
        term_id INT NOT NULL,
        rel_type enum('UF','NT','RT'),
        related_id INT NOT NULL,
        PRIMARY KEY  (term_id, rel_type, related_id));",
        FOLKSAURUS_TERM_REL_TABLE
    );
    dbDelta($sql);

    update_option('folksaurus_wp_version', FOLKSAURUS_WP_VERSION);
}

/**
 * Update the database if this is a new version of Folksaurus WP.
 */
function folksaurusUpdateDBCheck()
{
    if (get_site_option('folksaurus_wp_version') != FOLKSAURUS_WP_VERSION) {
        folksaurusSetupTables();
    }
}

{'fraction_non_alphanumeric': 0.10706580366774542, 'fraction_numerical': 0.005393743257820928, 'mean_word_length': 3.584672435105068, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2385955', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1249, 'n_words': 297}