- 如何得知要安裝的外掛是否需要輸入 SQL 語法來完成安裝?
- 那要如何輸入 SQL 語法?
- 什麼是"請記得修改成你的資料表名稱"?
- 為何我進入後是英文介面?
- 我忘記我當時安裝的資料庫名稱了,該怎麼辦?
- 有些外掛例如Birthday、Gender、Custom mass PM等都是需要輸入 SQL 語法的
但為何我沒在說明文件中看到 SQL 語法?
有些外掛作者會考慮到有些使用者對於phpMyAdmin不大熟悉
所以他們會在外掛包理附加一個"執行檔"
通常檔案名稱是db_update.php、install.php等
像是Advanced Links Mod 1.2.2就是links_install.php
Birthday則是birthday_db_update.php
此外也有升級用的"執行檔"
例如EasySite 1.3.0裡的db_update_111-130.php是給已安裝EasySite 1.1.1.的人升級到1.3.0用的
將執行檔上傳到phpBB2目錄下
然後以管理員的身份登入後,在網址輸入(以birthday做範例)
http://(你的網址)/(你的phpBB2資料夾名稱)/birthday_db_update.php
例:http://MyHome/phpBB2/birthday_db_update.php
按下 Enter 按鈕就會看到以下畫面就是成功了!
之後安全性上的考量,在執行完後請記得刪除"執行檔"- 如何確定外掛的語法有正確執行?
- 如何檢查語法是否已輸入到資料庫?
- 是先輸入語法還是先安裝外掛?
- 同樣的語法再執行一次會不會出問題?
- 如果語法的資料庫格式不同輸入會不會有影響?
在安裝說明文件中,檢視是否有以下文字
#
#-----[ SQL ]-------------------------------------------------
#
有的話就表示除了修改完檔案後還要再輸入 SQL 語法來完成安裝
這我以 Forum Logo Selector MOD 這個外掛來做範例
根據install_tw.txt文件說明
#
#-----[ 增加 SQL ]------------------------------------------
#
# 請記得修改成你的資料表名稱
INSERT INTO `phpbb_config` VALUES ('logo_image_path', 'images/logo');
INSERT INTO `phpbb_config` VALUES ('logo_image', 'subSilver.gif');
INSERT INTO `phpbb_config` VALUES ('logo_image_w', '200');
INSERT INTO `phpbb_config` VALUES ('logo_image_h', '91');
這就表示我們要輸入四行語法來完成安裝
還記得你當時在安裝phpBB2時的畫面嗎?
根據圖中紅框的資料來修改語法中的"phpbb_"
如果你當時有再進行修改不是取phpbb_的話 例如你是取phpbb22_
那麼語法要改成
INSERT INTO `phpbb22_config` VALUES ('logo_image_path', 'images/logo');
INSERT INTO `phpbb22_config` VALUES ('logo_image', 'subSilver.gif');
INSERT INTO `phpbb22_config` VALUES ('logo_image_w', '200');
INSERT INTO `phpbb22_config` VALUES ('logo_image_h', '91');
接下來就是連到phpMyAdmin網頁來進行輸入語法的動作
自機架設的話,其網址為
http://localhost/phpMyAdmin/index.php
localhost請自行換成你的網址
如果你是租用空間的話,phpMyAdmin網址請自行去詢問你所承租的主機商
不論是自機還是租用的,連到phpMyAdmin後會出現一個小畫面要你輸入phpMyAdmin的帳號及密碼
輸入完後會進入以下畫面
請在右邊 Language 下拉式選單中選擇Chinese traditional(zh-tw)
接下來請在左邊的(資料庫...)下拉式選單中選擇你phpBB2所使用的資料庫名稱
這時請開啟你phpBB2資料夾下的config.php
內容裡的紅字就是你資料庫的名稱
$dbname = 'dante_Rebellion';
之後按下上方的 SQL 連結
然後在空白處複製貼上說明文件中的語法,再按下"執行"
然後就會出現以下的結果畫面
這就表示你已成功輸入該外掛的語法,可以離開phpMyAdmin頁面了
如果你是使用作者提供的執行檔來輸入語法
這裡以Cash Mod 2.2.1做範例
那麼在執行畫面後可看到是否有成功輸入語法
圖中的綠色英文"Successfull"
就表示已成功輸入 SQL 語法到資料庫
但如果是以下畫面
顯示紅色英文"Error"
就表示語法輸入錯誤,你可能已輸入過這些語法
這時請進入phpMyAdmin網頁後,再進入你論壇使用的資料庫
然後根據作者提供的sql_221.txt文件來檢查是否有輸入語法
#
#-----[ SQL ]------------------------------------------
#
# If you don't know how to execute sql queries, then copy
# sql_install.php into your phpbb directory and run it.
# (assuming you use mysql or mssql)
#
# If you don't use mysql or mssql, you'll have to edit these queries accordingly
#
# If you have a different table prefix then change this command accordingly.
# I have used the default table prefix!
#
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable',0);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_display_after_posts',1);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_post_message','You earned %s for that post');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_num',10);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_time',24);
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_message','You have exceeded the alloted amount of posts and will not earn anything for your post');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_installed','yes');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_version','2.2.1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_adminbig','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_adminnavbar','1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('points_name','Points');
這部份是在phpbb_config資料表內輸入新記錄
所以按下phpbb_config左邊的瀏覽圖示
直接跳到最後一頁後(越新加入的語法越後面)
這時對照內容是否與文件中相符合
#
#-----[ SQL ]------------------------------------------
#
# If you have a different table prefix then change this command accordingly.
# I have used the default table prefix!
#
CREATE TABLE phpbb_cash (
cash_id smallint(6) NOT NULL auto_increment,
cash_order smallint(6) NOT NULL default '0',
cash_settings smallint(4) NOT NULL default '3313',
cash_dbfield varchar(64) NOT NULL default '',
cash_name varchar(64) NOT NULL default 'GP',
cash_default int(11) NOT NULL default '0',
cash_decimals tinyint(2) NOT NULL default '0',
cash_imageurl varchar(255) NOT NULL default '',
cash_exchange int(11) NOT NULL default '1',
cash_perpost int(11) NOT NULL default '25',
cash_postbonus int(11) NOT NULL default '2',
cash_perreply int(11) NOT NULL default '25',
cash_maxearn int(11) NOT NULL default '75',
cash_perpm int(11) NOT NULL default '0',
cash_perchar int(11) NOT NULL default '20',
cash_allowance tinyint(1) NOT NULL default '0',
cash_allowanceamount int(11) NOT NULL default '0',
cash_allowancetime tinyint(2) NOT NULL default '2',
cash_allowancenext int(11) NOT NULL default '0',
cash_forumlist varchar(255) NOT NULL default '',
PRIMARY KEY (cash_id)
);
#
#-----[ SQL ]------------------------------------------
#
# If you have a different table prefix then change this command accordingly.
# I have used the default table prefix!
#
CREATE TABLE phpbb_cash_events (
event_name varchar(32) NOT NULL default '',
event_data varchar(255) NOT NULL default '',
PRIMARY KEY (event_name)
);
#
#-----[ SQL ]------------------------------------------
#
# If you have a different table prefix then change this command accordingly.
# I have used the default table prefix!
#
CREATE TABLE phpbb_cash_exchange (
ex_cash_id1 int(11) NOT NULL default '0',
ex_cash_id2 int(11) NOT NULL default '0',
ex_cash_enabled int(1) NOT NULL default '0',
PRIMARY KEY (ex_cash_id1,ex_cash_id2)
);
#
#-----[ SQL ]------------------------------------------
#
# If you have a different table prefix then change this command accordingly.
# I have used the default table prefix!
#
CREATE TABLE phpbb_cash_groups (
group_id mediumint(6) NOT NULL default '0',
group_type tinyint(2) NOT NULL default '0',
cash_id smallint(6) NOT NULL default '0',
cash_perpost int(11) NOT NULL default '0',
cash_postbonus int(11) NOT NULL default '0',
cash_perreply int(11) NOT NULL default '0',
cash_perchar int(11) NOT NULL default '0',
cash_maxearn int(11) NOT NULL default '0',
cash_perpm int(11) NOT NULL default '0',
cash_allowance tinyint(1) NOT NULL default '0',
cash_allowanceamount int(11) NOT NULL default '0',
cash_allowancetime tinyint(2) NOT NULL default '2',
cash_allowancenext int(11) NOT NULL default '0',
PRIMARY KEY (group_id,group_type,cash_id)
);
#
#-----[ SQL ]------------------------------------------
#
# If you have a different table prefix then change this command accordingly.
# I have used the default table prefix!
#
CREATE TABLE phpbb_cash_log (
log_id int(11) NOT NULL auto_increment,
log_time int(11) NOT NULL default '0',
log_type smallint(6) NOT NULL default '0',
log_action varchar(255) NOT NULL default '',
log_text varchar(255) NOT NULL default '',
PRIMARY KEY (log_id)
);
這部份是直接新增資料表
所以在主畫面就可檢查是否相符合
這我個人是建議先輸入語法再安裝外掛後上傳檔案,就是輸入完語法後再上傳檔案(這期間強烈建議暫時關閉論壇,避免發生不可預測的問題)
有些語法再執行一次不會對資料庫造成影響,但有的語法卻有可能造成影響
如果不小心再度執行,然後論壇有出現異狀,建議先刪除該語法所輸入的記錄或資料表再重新輸入看看
這一定會出問題而無法輸入語法,就算能成功輸入,也難保不會對外掛的功能產生影響>
文章標籤
全站熱搜
