แยกฐานข้อมูลของ StatPress ออกจากฐานข้อมูลของ wordpress
StatPress Version: 1.4.1
WordPress Version : 3.1.2 (ที่ใช้ทดสอบแต่รุ่นอื่นๆน่าจะคล้ายกัน)
STEP1
wp-config.php
เพิ่มบรรทัดนี้ลงไป คือการกำหนดชื่อ database ที่ต้องการให้ไปเก็บ
define(‘DB_NAMSTATPRESSE‘, ‘wpstatpress‘);
วางต่อในส่วนของการกำหนดฐานข้อมูล
STEP2
statpress.php
เปลี่ยน global $wpdb; เป็น global $wpdb2; ทั้งหมด
Line:1147
dbDelta($sql_createtable); แก้เป็น dbDelta2($sql_createtable);
STEP3
load.php
C:\AppServ\www\wordpress\wp-includes\load.php
แก้ไขตาม
function require_wp_db() {
global $wpdb,$wpdb2; <–เพิ่มตัวแปร $wpdb2
require_once( ABSPATH . WPINC . ‘/wp-db.php’ );
if ( file_exists( WP_CONTENT_DIR . ‘/db.php’ ) )
require_once( WP_CONTENT_DIR . ‘/db.php’ );
ตรงส่วนนี้ให้ทำไปทับของเดิมเลย
if ( isset( $wpdb ) && isset( $wpdb2 ) ){
return;
}
$wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
$wpdb2 = new wpdb( DB_USER, DB_PASSWORD, DB_NAMSTATPRESSE, DB_HOST ); <– เพิ่ม code สีแดง ต่อจากบรรทัดด้านบน
}
STEP4
upgrade.php
C:\AppServ\www\wordpress\wp-admin\includes\upgrade.php
Line : 1377
function dbDelta($queries, $execute = true){
global $wpdb;
…..
}
copy function จากด้านบนมาวางต่อท้ายและเปลี่ยนชื่อ function เป็น dbDelta2 และเปลี่ยน global $wpdb เป็น global $wpdb2
function dbDelta2($queries, $execute = true){
global $wpdb2;
…..
}
modify by RIDTICHAI@ARIT-RMUTT
สำนักวิทยบริการและเทคโนโลยีสารสนเทศ มทร. ธัญบุรี
Tags: StatPress, WordPress, แยก database
Hiya! I know this is kinda off topic however I’d figured I’d ask. Would you be interested in trading links or maybe guest authoring a blog article or vice-versa? My site goes over a lot of the same topics as yours and I think we could greatly benefit from each other. If you happen to be interested feel free to send me an e-mail. I look forward to hearing from you! Wonderful blog by the way!
I’m now not sure where you are getting your information, however good topic. I must spend some time learning more or working out more. Thanks for magnificent information I was in search of this info for my mission.
Cheap Ugg Boots…
แยกฐานข้อมูลของ StatPress ออกจาก wp | RIDTICHAI@ARIT-RMUTT…
USA True Religion…
Do you care if I put part of this on my site if I post a link to this site?…
true religion mens ricky relaxed straight fit quick fade jean…
I will immediately seize your rss as I can not to find your e-mail subscription link or e-newsletter service. Do you have any? Kindly let me realize so that I may subscribe. Thanks….
Cheap True Religion…
I will immediately seize your rss as I can not to find your e-mail subscription link or e-newsletter service. Do you have any? Kindly let me realize so that I may subscribe. Thanks….
True Religion Jeans…
I will immediately seize your rss as I can not to find your e-mail subscription link or e-newsletter service. Do you have any? Kindly let me realize so that I may subscribe. Thanks….
Fitflop Slide Sandals…
I truly appreciate this post. I have been looking all over for this! Thank goodness I found it on Bing. You’ve made my day! Thank you again…