本文整理汇总了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 );
}