[外掛]Rebuild Search v1.0.1

MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群

主題已鎖定
動機不明
喝咖啡的綠皮猴
喝咖啡的綠皮猴
文章: 1179
註冊時間: 2002-03-06 20:37
來自: GOP (重啟)

[外掛]Rebuild Search v1.0.1

文章 動機不明 »

這個外掛很簡單,只要將下列語法存成兩個檔案,放在指定位置上,就可以使用了(需由控制台進入才會看到)
河風本人試用過兩三次,沒有發現問題!(中文化可能不是很好,請自行再翻譯)


將下列代碼存為 admin_rebuild_search.php 後丟到 admin 目錄下
[php]<?php
/***************************************************************************
* admin_rebuild_search.php
* -------------------
* time : Thursday, January 30, 2003
* author : Peter Wyss
* email : wysspeter@bluewin.ch
* version : 1.2
*
*
\n ***************************************************************************/

/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/

define('IN_PHPBB', 1);

if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['General']['重建搜尋索引'] = $filename;

return;
}

//
// Include required files, get $phpEx and check permissions
//
$no_page_header = TRUE;
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);

if(( isset($HTTP_POST_VARS['rebuild'])) OR ($HTTP_GET_VARS['start_id'] > 0))
{
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);

if ($HTTP_GET_VARS['start_id']==0)
{
// Empty wordlist tables

$sql = "DELETE FROM " . SEARCH_WORD_TABLE;
$result = $db->sql_query($sql);
if ( !$result )
{
message_die(GENERAL_ERROR, "Could not empty search_wordlist table.", "",__LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE;
$result = $db->sql_query($sql);
if ( !$result )
{
message_die(GENERAL_ERROR, "Could not empty search_wordmatch table.", "",__LINE__, __FILE__, $sql);
}
}
$sql = "SELECT count(*) as pcount FROM " . POSTS_TEXT_TABLE;

$result = $db->sql_query($sql);
if ( !$result )
{
message_die(GENERAL_ERROR, "Could not find posts.", "",__LINE__, __FILE__, $sql);
}

$postcount = $db->sql_fetchrow($result);
$nextpage = 0;
for( $i = $HTTP_GET_VARS['start_id']; $i < $postcount[pcount]; $i++ )
{

if ($i == $HTTP_GET_VARS['start_id'] + 100)
{
$nextpage=1;
break;
}
$sql = "SELECT post_id FROM " . POSTS_TEXT_TABLE . " LIMIT " . $i . ",1";
$result = $db->sql_query($sql);
if ( !$result )
{
message_die(GENERAL_ERROR, "Could not find posts.", "",__LINE__, __FILE__, $sql);
}
$posts = $db->sql_fetchrow($result);
$activeid = $posts['post_id'];
$sql = "SELECT * FROM " . POSTS_TEXT_TABLE . " WHERE post_id = " . $activeid;
$result = $db->sql_query($sql);
if ( !$result )
{
message_die(GENERAL_ERROR, "Could not find posts.", "",__LINE__, __FILE__, $sql);
}

$activepost = $db->sql_fetchrowset($result);
add_search_words('single', $activepost[0]['post_id'], stripslashes($activepost[0]['post_text']), stripslashes($activepost[0]['post_subject']));
}

if ($nextpage==1)
{
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("admin_rebuild_search.$phpEx?start_id=$i") . '">')
);
$message = $i . ' 文章 完成';

$message .= "<br /><br />" . sprintf('點選 %s這裡%s 繼續 (或等待三秒鐘)', "<a href=\"" . append_sid("admin_rebuild_search.$phpEx?start_id=$i") . "\">", "</a>");

message_die(GENERAL_MESSAGE, $message);
}
else
{
$message = '重新建立完成';

$message .= "<br /><br />" . sprintf('點選 %s這裡%s 返回到 重建搜尋索引介面', "<a href=\"" . append_sid("admin_rebuild_search.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf('點選 %s這裡%s 返回控制台', "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

message_die(GENERAL_MESSAGE, $message);
}

}


$template->set_filenames(array(
"body" => "admin/rebuild_search_body.tpl")
);

$template->assign_vars(array(
"S_FORM_ACTION" => append_sid("admin_rebuild_search.$phpEx?start_id=0"),

"L_INFO" => $output_info,
"L_REBUILD_SEARCH_TITLE" => "重建搜尋索引",
"L_REBUILD_SEARCH_SUBMIT" => "重新建立")
);

include('./page_header_admin.'.$phpEx);

$template->pparse("body");

include('./page_footer_admin.'.$phpEx);

?>[/php]

存成 rebuild_search_body.tpl 後丟到 template 的 admin 目錄下

代碼: 選擇全部

<h1>{L_REBUILD_SEARCH_TITLE}</h1>

<form method="post" action="{S_FORM_ACTION}"><table cellspacing="1" cellpadding="4" border="0" align="center" class="forumline">
	<tr> 
		<th class="thHead" colspan="2">{L_REBUILD_SEARCH_TITLE}</th>
	</tr>
	<tr> 
		<td class="row2" align="center"><input type="submit" name="rebuild" value="{L_REBUILD_SEARCH_SUBMIT}" class="mainoption" /></td>
	</tr>

</table></form>
進入控制台後就可以用了!

這個外掛好像是可以加速搜尋時的時間,以及改善文章之間對應的問題,對於有大量文章的論壇來說蠻實用的....
最後由 動機不明 於 2003-07-15 10:55 編輯,總共編輯了 1 次。
動機不明
喝咖啡的綠皮猴
喝咖啡的綠皮猴
文章: 1179
註冊時間: 2002-03-06 20:37
來自: GOP (重啟)

文章 動機不明 »

新版....(不知怎的版本變成 1.0.1 :roll: )

http://www.phpbbhacks.com/viewhack.php?id=1592
###############################################
## Hack Title: Rebuild Search
## Hack Version: 1.0.1
## Author: Antony Bailey
## Description: Optimises the search function, by using the whole MySQL range.
## Compatibility: 2.0.4
##
## Installation Level: Easy
## Installation Time: 5
##
## Included Files: 4
## admin_rebuild_search.php
## lang_rebuild_search.php
## rebuild_search_body.tpl
## rebuild_search_progress_body.tpl
###############################################

檔案下載後放至指定的目錄下即完成安裝!! (超簡單~)

-------
用法: 至控制台,會看到 [Rebuild Search] 功能,按下去後,就給他擺著,程式會自動完成!
非官方外掛問題區公告: [必看]請配合發問格式及明確主題發問(2006 02/24更新)
七點要求:
1. 發問前先搜尋,確定沒有重複後再發表
2. 主題要明確
3. 依照發問格式
4. 禁連續推文
5. 請盡量減少使用地方性語言
6. 解決問題後請修改第一篇主題,並感謝曾經幫過你的前輩們 ^^
7. 請不要將檔案內容完整貼出喔! 只要提供問題行及上下各五行就可以了
依夢兒
竹貓忠實會員
竹貓忠實會員
文章: 2013
註冊時間: 2002-11-20 00:07

文章 依夢兒 »

河風 寫:新版....(不知怎的版本變成 1.0.1 :roll: )
因為作者不同
二支MOD名稱相同,但不是同一人開發的
有任何關於 phpBB 或是架站的問題,請在論壇上公開發表出來,大家一起討論。
請不要丟私人訊息問我,因為私訊是用來聊私事的。
這樣作對於解決您的問題一點幫助也沒有,也很沒有效率,小弟我一概謝絕。



搜尋是一種美德,在發問之前,請多加利用頂端的文章搜尋功能,搜尋可能的關鍵字。
確定您想問的問題找不到答案後,再發問。
主題已鎖定

回到「非官方認證外掛」