Mercurial > hg > vamp-website
comparison forum/Sources/DbSearch-mysql.php @ 76:e3e11437ecea website
Add forum code
author | Chris Cannam |
---|---|
date | Sun, 07 Jul 2013 11:25:48 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
75:72f59aa7e503 | 76:e3e11437ecea |
---|---|
1 <?php | |
2 | |
3 /** | |
4 * Simple Machines Forum (SMF) | |
5 * | |
6 * @package SMF | |
7 * @author Simple Machines http://www.simplemachines.org | |
8 * @copyright 2011 Simple Machines | |
9 * @license http://www.simplemachines.org/about/smf/license.php BSD | |
10 * | |
11 * @version 2.0 | |
12 */ | |
13 | |
14 if (!defined('SMF')) | |
15 die('Hacking attempt...'); | |
16 | |
17 /* This file contains database functions specific to search related activity. | |
18 | |
19 void db_search_init() | |
20 - adds the functions in this file to the $smcFunc array | |
21 | |
22 boolean smf_db_search_support($search_type) | |
23 - whether this database type support the search type $search_type | |
24 | |
25 void smf_db_create_word_search($size) | |
26 - create the custom word index table | |
27 | |
28 */ | |
29 | |
30 // Add the file functions to the $smcFunc array. | |
31 function db_search_init() | |
32 { | |
33 global $smcFunc; | |
34 | |
35 if (!isset($smcFunc['db_search_query']) || $smcFunc['db_search_query'] != 'smf_db_query') | |
36 $smcFunc += array( | |
37 'db_search_query' => 'smf_db_query', | |
38 'db_search_support' => 'smf_db_search_support', | |
39 'db_create_word_search' => 'smf_db_create_word_search', | |
40 'db_support_ignore' => true, | |
41 ); | |
42 } | |
43 | |
44 // Does this database type support this search type? | |
45 function smf_db_search_support($search_type) | |
46 { | |
47 $supported_types = array('fulltext'); | |
48 | |
49 return in_array($search_type, $supported_types); | |
50 } | |
51 | |
52 // Highly specific - create the custom word index table! | |
53 function smf_db_create_word_search($size) | |
54 { | |
55 global $smcFunc; | |
56 | |
57 if ($size == 'small') | |
58 $size = 'smallint(5)'; | |
59 elseif ($size == 'medium') | |
60 $size = 'mediumint(8)'; | |
61 else | |
62 $size = 'int(10)'; | |
63 | |
64 $smcFunc['db_query']('', ' | |
65 CREATE TABLE {db_prefix}log_search_words ( | |
66 id_word {raw:size} unsigned NOT NULL default {string:string_zero}, | |
67 id_msg int(10) unsigned NOT NULL default {string:string_zero}, | |
68 PRIMARY KEY (id_word, id_msg) | |
69 ) ENGINE=InnoDB', | |
70 array( | |
71 'string_zero' => '0', | |
72 'size' => $size, | |
73 ) | |
74 ); | |
75 } | |
76 | |
77 ?> |