当前位置: 首页>>代码示例>>PHP>>正文


PHP BP_Messages_Thread::upgrade_tables方法代码示例

本文整理汇总了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 );
}
开发者ID:n-sane,项目名称:zaroka,代码行数:53,代码来源:bp-messages.php


注:本文中的BP_Messages_Thread::upgrade_tables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。