本文整理匯總了PHP中BP_Messages_Thread::upgrade_tables方法的典型用法代碼示例。如果您正苦於以下問題:PHP BP_Messages_Thread::upgrade_tables方法的具體用法?PHP BP_Messages_Thread::upgrade_tables怎麽用?PHP BP_Messages_Thread::upgrade_tables使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BP_Messages_Thread
的用法示例。
在下文中一共展示了BP_Messages_Thread::upgrade_tables方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: messages_install
function messages_install() {
global $wpdb, $bp;
if ( !empty($wpdb->charset) )
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
$sql[] = "CREATE TABLE {$bp->messages->table_name_recipients} (
id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
user_id bigint(20) NOT NULL,
thread_id bigint(20) NOT NULL,
unread_count int(10) NOT NULL DEFAULT '0',
sender_only tinyint(1) NOT NULL DEFAULT '0',
is_deleted tinyint(1) NOT NULL DEFAULT '0',
KEY user_id (user_id),
KEY thread_id (thread_id),
KEY is_deleted (is_deleted),
KEY sender_only (sender_only),
KEY unread_count (unread_count)
) {$charset_collate};";
$sql[] = "CREATE TABLE {$bp->messages->table_name_messages} (
id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
thread_id bigint(20) NOT NULL,
sender_id bigint(20) NOT NULL,
subject varchar(200) NOT NULL,
message longtext NOT NULL,
date_sent datetime NOT NULL,
KEY sender_id (sender_id),
KEY thread_id (thread_id)
) {$charset_collate};";
$sql[] = "CREATE TABLE {$bp->messages->table_name_notices} (
id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
subject varchar(200) NOT NULL,
message longtext NOT NULL,
date_sent datetime NOT NULL,
is_active tinyint(1) NOT NULL DEFAULT '0',
KEY is_active (is_active)
) {$charset_collate};";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta($sql);
/* Upgrade and remove the message threads table if it exists */
if ( $wpdb->get_var( "SHOW TABLES LIKE '%{$wpdb->base_prefix}bp_messages_threads%'" ) ) {
$upgrade = BP_Messages_Thread::upgrade_tables();
if ( $upgrade )
$wpdb->query( "DROP TABLE {$wpdb->base_prefix}bp_messages_threads" );
}
add_site_option( 'bp-messages-db-version', BP_MESSAGES_DB_VERSION );
}