1 頁 (共 1 頁)

[教學]誤刪phpbb_config搶救實錄!!

發表於 : 2004-12-17 05:17
ksbank
當我犯下這個錯誤之後,從中也學會了不少東西
讓我的功力大大增加,經過神川小羽前輩的提示\r
特在此寫下搶救的過程,以作為教學!!
相關討論串:http://phpbb-tw.net/phpbb/viewtopic.php?t=30711

因為我的空間是lycos,所以圖片會以這個空間為主
若是使用其他空間,功能可能會不相同,但過程都是一樣的!!

1.重新建立一個新的phpbb_config
在Run SQL query/queries on database的空格中貼上
CREATE TABLE `phpbb_config` (
`config_name` varchar(255) NOT NULL default '',
`config_value` varchar(255) NOT NULL default '',
PRIMARY KEY (`config_name`)
) TYPE=MyISAM;

圖檔
按下GO就會新建一個空的phpbb_config

2.選擇phpbb_config之後,在相同的空格中匯入SQL

代碼: 選擇全部

INSERT INTO `phpbb_config` VALUES ('config_id', '1'); 
INSERT INTO `phpbb_config` VALUES ('board_disable', '0'); 
INSERT INTO `phpbb_config` VALUES ('sitename', 'yourdomain.com'); 
INSERT INTO `phpbb_config` VALUES ('site_desc', 'A _little_ text to describe your forum'); 
INSERT INTO `phpbb_config` VALUES ('cookie_name', 'phpbb2mysql1211'); 
INSERT INTO `phpbb_config` VALUES ('cookie_path', '/'); 
INSERT INTO `phpbb_config` VALUES ('cookie_domain', ''); 
INSERT INTO `phpbb_config` VALUES ('cookie_secure', '0'); 
INSERT INTO `phpbb_config` VALUES ('session_length', '3600'); 
INSERT INTO `phpbb_config` VALUES ('allow_html', '0'); 
INSERT INTO `phpbb_config` VALUES ('allow_html_tags', 'b,i,u,pre'); 
INSERT INTO `phpbb_config` VALUES ('allow_bbcode', '1'); 
INSERT INTO `phpbb_config` VALUES ('allow_smilies', '1'); 
INSERT INTO `phpbb_config` VALUES ('allow_sig', '1'); 
INSERT INTO `phpbb_config` VALUES ('allow_namechange', '0'); 
INSERT INTO `phpbb_config` VALUES ('allow_theme_create', '0'); 
INSERT INTO `phpbb_config` VALUES ('allow_avatar_local', '0'); 
INSERT INTO `phpbb_config` VALUES ('allow_avatar_remote', '0'); 
INSERT INTO `phpbb_config` VALUES ('allow_avatar_upload', '0'); 
INSERT INTO `phpbb_config` VALUES ('enable_confirm', '0'); 
INSERT INTO `phpbb_config` VALUES ('override_user_style', '[color=red]1[/color]'); 
INSERT INTO `phpbb_config` VALUES ('posts_per_page', '15'); 
INSERT INTO `phpbb_config` VALUES ('topics_per_page', '50'); 
INSERT INTO `phpbb_config` VALUES ('hot_threshold', '25'); 
INSERT INTO `phpbb_config` VALUES ('max_poll_options', '10'); 
INSERT INTO `phpbb_config` VALUES ('max_sig_chars', '255'); 
INSERT INTO `phpbb_config` VALUES ('max_inbox_privmsgs', '50'); 
INSERT INTO `phpbb_config` VALUES ('max_sentbox_privmsgs', '25'); 
INSERT INTO `phpbb_config` VALUES ('max_savebox_privmsgs', '50'); 
INSERT INTO `phpbb_config` VALUES ('board_email_sig', 'Thanks, The Management'); 
INSERT INTO `phpbb_config` VALUES ('board_email', '[color=red]系統管理員電子信箱[/color]'); 
INSERT INTO `phpbb_config` VALUES ('smtp_delivery', '0'); 
INSERT INTO `phpbb_config` VALUES ('smtp_host', ''); 
INSERT INTO `phpbb_config` VALUES ('smtp_username', ''); 
INSERT INTO `phpbb_config` VALUES ('smtp_password', ''); 
INSERT INTO `phpbb_config` VALUES ('sendmail_fix', '0'); 
INSERT INTO `phpbb_config` VALUES ('require_activation', '0'); 
INSERT INTO `phpbb_config` VALUES ('flood_interval', '15'); 
INSERT INTO `phpbb_config` VALUES ('board_email_form', '0'); 
INSERT INTO `phpbb_config` VALUES ('avatar_filesize', '6144'); 
INSERT INTO `phpbb_config` VALUES ('avatar_max_width', '80'); 
INSERT INTO `phpbb_config` VALUES ('avatar_max_height', '80'); 
INSERT INTO `phpbb_config` VALUES ('avatar_path', 'images/avatars'); 
INSERT INTO `phpbb_config` VALUES ('avatar_gallery_path', 'images/avatars/gallery'); 
INSERT INTO `phpbb_config` VALUES ('smilies_path', 'images/smiles'); 
INSERT INTO `phpbb_config` VALUES ('default_style', '[color=red]2[/color]'); 
INSERT INTO `phpbb_config` VALUES ('default_dateformat', 'D M d, Y g:i a'); 
INSERT INTO `phpbb_config` VALUES ('board_timezone', '8'); 
INSERT INTO `phpbb_config` VALUES ('prune_enable', '1'); 
INSERT INTO `phpbb_config` VALUES ('privmsg_disable', '0'); 
INSERT INTO `phpbb_config` VALUES ('gzip_compress', '0'); 
INSERT INTO `phpbb_config` VALUES ('coppa_fax', ''); 
INSERT INTO `phpbb_config` VALUES ('coppa_mail', ''); 
INSERT INTO `phpbb_config` VALUES ('record_online_users', '2'); 
INSERT INTO `phpbb_config` VALUES ('record_online_date', '1102778480'); 
INSERT INTO `phpbb_config` VALUES ('server_name', '[color=red]你的網域名稱[/color]'); 
INSERT INTO `phpbb_config` VALUES ('server_port', '80'); 
INSERT INTO `phpbb_config` VALUES ('script_path', '/[color=red]系統存放位置[/color]/'); 
INSERT INTO `phpbb_config` VALUES ('version', '.0.11'); 
INSERT INTO `phpbb_config` VALUES ('board_startdate', '1102777223'); 
INSERT INTO `phpbb_config` VALUES ('default_lang', 'chinese_traditional_taiwan');
請先注意sql中紅字的部分是必須做變更的
<1>('override_user_style', '1');
這個是看你要不要推翻會員的預設風格樣式
1=要推翻
0=不推翻
如果不知道怎麼設定,就先設定1,推翻,等網站回復之後再到後台修改\r
<2>('board_email', '系統管理員電子信箱');
你的電子信箱
<3>('default_style', '2');
開啟phpbb_themes查看你使用的風格themes_id是多少,像我的是4,就改成4
圖檔
<4>('server_name', '你的網域名稱');
這就是你的網址,例如我的網址是members.lycos.co.uk/ksbank/
<5>('script_path', '/系統存放位置/');
這是你存放檔案的根目錄資料夾名稱,如果當初沒變更過資料夾名稱,就是/phpBB2/,因為我本身沒有設定資料夾名稱,所以就是//
圖檔

3.當基本的設定完成之後,接下來就必須靠你的記憶\r
將你有安裝過的外掛中,有影響到phpbb_config的sql通通匯入\r
在我的網站中,有安裝過:
CashMOD2.2.2
虛擬銀行
Birthday1.5.6
Gender1.2.6
竹貓公告條
這幾個都是會影響phpbb_config的外掛,在壓縮檔中如果沒有看到sql的文字檔
幾乎都是在install檔或是update檔中,以Birthday1.5.6舉例

代碼: 選擇全部

<?php
#########################################################
## SQL commands to phpBB2
## Author: Niels Chr. R鷣\r
## Nickname: Niels Chr. Denmark
## Email: ncr@db9.dk
##
## Ver 1.0.7
##
## phpBB2 database update script for mods
## this file is intended to use with phpBB2, when installing mods
## after so you may delete this file, but only admin can use so it really doesen't matter
## The script will look what prefix you are using, and use the existing DB defined by congig.php
## The execution of this script's included SQL is harmless, so you can run it as meny times you like
## note, though that the users last visit, will be set back to his/her last login, 
## but that is a minor cosmetic isue, that will correct it self next time the use  logs in
##
## the following example are from my mods, and you can add some self, for other mods if you like
## you will after execution get a list over those commands that are run with succes and those with warnings !
## delete the sample lines if you are using it only for other mods
##
#########################################################

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
define('SITE_HISTORY_TABLE', $table_prefix.'site_history');

###################################################################################################
##
## put the SQL commands below here, the SQL commands listed below are only exampels, substitude them with the one you need ##
##
###################################################################################################
$sql=array(
'ALTER TABLE '.USERS_TABLE.' ADD user_birthday INT DEFAULT "999999" not null  ',
'ALTER TABLE '.USERS_TABLE.' ADD user_next_birthday_greeting INT DEFAULT "0" not null ',
[color=red]'INSERT INTO '.CONFIG_TABLE.' (config_name, config_value) VALUES ("birthday_required", "0")',
'INSERT INTO '.CONFIG_TABLE.' (config_name, config_value) VALUES ("birthday_greeting", "1")',
'INSERT INTO '.CONFIG_TABLE.' (config_name, config_value) VALUES ("max_user_age", "100")',
'INSERT INTO '.CONFIG_TABLE.' (config_name, config_value) VALUES ("min_user_age", "5")',
'INSERT INTO '.CONFIG_TABLE.' (config_name, config_value) VALUES ("birthday_check_day", "7")'
);[/color]

$mods = array ( 
'Birthday PART 1 Mod','Birthday PART 1 Mod','Birthday PART 2 Mod','Birthday PART 2 Mod','Birthday PART 2 Mod','Birthday PART 2 Mod','Birthday PART 2 Mod',
);

############################################### Do not change anything below this line #######################################

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

if ($userdata['user_level']!=ADMIN)
      message_die(GENERAL_ERROR, "You are not Authorised to do this"); 
$n=0;
$message="<b>This list is a result of the SQL queries needed for the additional mods in the pre-moded pack</b><br/><br/>";
while($sql[$n])
{
	$message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : '';
	if(!$result = $db->sql_query($sql[$n])) 
	$message .= '<b><font color=#FF0000>[Already added]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
	else $message .='<b><font color=#0000fF>[Added/Updated]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
	$n++;
}
 message_die(GENERAL_MESSAGE, $message); 
?>
在紅字的部分就是影響phpbb_config的sql,
CONFIG_TABLE的字樣就是與phpbb_config有關的
把這些sql依照之前的方法匯入就可以了

當所有的外掛都匯入之後,就大公告成囉!!
以上的教學如果有需要改進的地方,請在回覆指教囉!!

發表於 : 2004-12-17 07:30
hollowaysxp
不外乎的!有點像自己把"表"重新安裝一次。
你可以到phpBB2/install/mysql_basic.sql
裡面是做很多從表插入欄位的動作!
相同資料夾內的檔案mysql_schema.sql
裡面是做新增資料表的動作!
我上次把phpBBX SP Lite 1.1.0整合入虛擬股市就知道這些了。

不過安裝phpBB2如果表已存在就會跟你說哪張表以存在之後就停止嚕!
所以如果跟還原一樣!先在每張表前做DROP TABLE的話,那我想竹貓會問表已存在的人又會少ㄧ個問題!
只是.......安全性就不可考啦!