/** * Create the translation index table * */ public static function refresh_search_index() { global $wpdb; $wpdb->query('DROP TABLE IF EXISTS ' . self::index_table); // Note this function creates the table with dbDelta() which apparently has some pickiness // See http://codex.wordpress.org/Creating_Tables_with_Plugins#Creating_or_Updating_the_Table require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta("CREATE TABLE " . self::index_table . " (\n\t\t\t\tunique_id MEDIUMINT UNSIGNED NOT NULL,\n\t\t\t\tbook_id TINYINT UNSIGNED NOT NULL,\n\t\t\t\ttrans_id SMALLINT UNSIGNED NOT NULL,\n\t\t\t\tindex_text TEXT NOT NULL,\n\t\t\t\tFULLTEXT (index_text),\n\t\t\t\tINDEX (unique_id)\n\t\t\t);"); $msg = "Dropped and recreated the index table.<br/>"; // Loop through each enabled bible translation and refresh their index data $translations = BfoxTrans::get_enabled(); foreach ($translations as $translation) { $msg .= "Refreshing {$translation->long_name} (ID: {$translation->id})...<br/>"; self::refresh_translation_index($translation); } $msg .= 'Finished<br/>'; return $status; }