831 |
florian |
1 |
<?php
|
|
|
2 |
// rebuild search-table
|
|
|
3 |
// this script rebuilds the search-table
|
|
|
4 |
|
|
|
5 |
// this needs some time, please make sure that its really needed
|
|
|
6 |
// i.e. in case of errors, required updates etc.
|
|
|
7 |
|
|
|
8 |
// it only works with the mysql/mysqli-layer.
|
|
|
9 |
|
|
|
10 |
// YOU NEED TO MOVE THIS SCRIPT TO YOUR PHORUM-DIRECTORY
|
|
|
11 |
|
|
|
12 |
define('phorum_page', 'rebuild_search_table');
|
|
|
13 |
|
|
|
14 |
if(!file_exists('./common.php')) {
|
|
|
15 |
echo "You didn't move this script to your phorum-directory!\n";
|
|
|
16 |
exit();
|
|
|
17 |
}
|
|
|
18 |
|
|
|
19 |
include './common.php';
|
|
|
20 |
|
|
|
21 |
if (! ini_get('safe_mode')) {
|
|
|
22 |
set_time_limit(0);
|
|
|
23 |
ini_set("memory_limit","64M");
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
echo "Rebuilding search-table ...\n";
|
|
|
27 |
|
|
|
28 |
$sql=array();
|
|
|
29 |
$sql[]="truncate {$PHORUM['search_table']}";
|
|
|
30 |
$sql[]="insert into {$PHORUM['search_table']} (message_id,search_text,forum_id) select message_id, concat(author, ' | ', subject, ' | ', body), forum_id from {$PHORUM['message_table']}";
|
|
|
31 |
|
|
|
32 |
phorum_db_run_queries($sql);
|
|
|
33 |
|
|
|
34 |
flush();
|
|
|
35 |
echo "Rebuilding search-table finished successfully if no errors were logged above.\n";
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
?>
|