Verzeichnisstruktur phpBB-3.0.0
- Veröffentlicht
- 12.12.2007
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
search_fill.php
001 <?php
002
003 //
004 // Security message:
005 //
006 // This script is potentially dangerous.
007 // Remove or comment the next line (die(".... ) to enable this script.
008 // Do NOT FORGET to either remove this script or disable it after you have used it.
009 //
010
011 //
012 // Security message:
013 //
014 // This script is potentially dangerous.
015 // Remove or comment the next line (die(".... ) to enable this script.
016 // Do NOT FORGET to either remove this script or disable it after you have used it.
017 //
018 die("Please read the first lines of this script for instructions on how to enable it");
019
020 //
021 // Do not change anything below this line.
022 //
023 set_time_limit(0);
024
025 define('IN_PHPBB', true);
026 $phpbb_root_path = '../';
027 $phpEx = substr(strrchr(__FILE__, '.'), 1);
028 include($phpbb_root_path . 'common.'.$phpEx);
029
030 // Start session management
031 $user->session_begin();
032 $auth->acl($user->data);
033 $user->setup();
034
035 $search_type = $config['search_type'];
036
037 if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx))
038 {
039 trigger_error('NO_SUCH_SEARCH_MODULE');
040 }
041
042 require($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx);
043
044 $error = false;
045 $search = new $search_type($error);
046
047 if ($error)
048 {
049 trigger_error($error);
050 }
051
052 print "<html>\n<body>\n";
053
054 //
055 // Fetch a batch of posts_text entries
056 //
057 $sql = "SELECT COUNT(*) as total, MAX(post_id) as max_post_id
058 FROM ". POSTS_TABLE;
059 if ( !($result = $db->sql_query($sql)) )
060 {
061 $error = $db->sql_error();
062 die("Couldn't get maximum post ID :: " . $sql . " :: " . $error['message']);
063 }
064
065 $max_post_id = $db->sql_fetchrow($result);
066
067 $totalposts = $max_post_id['total'];
068 $max_post_id = $max_post_id['max_post_id'];
069
070 $postcounter = (!isset($HTTP_GET_VARS['batchstart'])) ? 0 : $HTTP_GET_VARS['batchstart'];
071
072 $batchsize = 200; // Process this many posts per loop
073 $batchcount = 0;
074 for(;$postcounter <= $max_post_id; $postcounter += $batchsize)
075 {
076 $batchstart = $postcounter + 1;
077 $batchend = $postcounter + $batchsize;
078 $batchcount++;
079
080 $sql = "SELECT *
081 FROM " . POSTS_TABLE . "
082 WHERE post_id
083 BETWEEN $batchstart
084 AND $batchend";
085 if( !($result = $db->sql_query($sql)) )
086 {
087 $error = $db->sql_error();
088 die("Couldn't get post_text :: " . $sql . " :: " . $error['message']);
089 }
090
091 $rowset = $db->sql_fetchrowset($result);
092 $db->sql_freeresult($result);
093
094 $post_rows = sizeof($rowset);
095
096 if( $post_rows )
097 {
098
099 // $sql = "LOCK TABLES ".POST_TEXT_TABLE." WRITE";
100 // $result = $db->sql_query($sql);
101 print "\n<p>\n<a href='{$_SERVER['PHP_SELF']}?batchstart=$batchstart'>Restart from posting $batchstart</a><br>\n";
102
103 // For every post in the batch:
104 for($post_nr = 0; $post_nr < $post_rows; $post_nr++ )
105 {
106 print ".";
107 flush();
108
109 $post_id = $rowset[$post_nr]['post_id'];
110
111 $search->index('post', $rowset[$post_nr]['post_id'], $rowset[$post_nr]['post_text'], $rowset[$post_nr]['post_subject'], $rowset[$post_nr]['poster_id']);
112 }
113 // $sql = "UNLOCK TABLES";
114 // $result = $db->sql_query($sql);
115
116 }
117 }
118
119 print "<br>Removing common words (words that appear in more than 50% of the posts)<br>\n";
120 flush();
121 $search->tidy();
122 print "Removed words that where too common.<br>";
123
124 echo "<br>Done";
125
126 ?>
127
128 </body>
129 </html>
130