本文整理汇总了PHP中BP_Activity_Activity::convert_tables_for_user方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Activity_Activity::convert_tables_for_user方法的具体用法?PHP BP_Activity_Activity::convert_tables_for_user怎么用?PHP BP_Activity_Activity::convert_tables_for_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Activity_Activity
的用法示例。
在下文中一共展示了BP_Activity_Activity::convert_tables_for_user方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_activity_install
function bp_activity_install()
{
global $wpdb, $bp;
if (!empty($wpdb->charset)) {
$charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
}
$sql[] = "CREATE TABLE {$bp->activity->table_name_user_activity} (\n\t\t \t\tid bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t\tuser_id bigint(20) NOT NULL,\n\t\t\t\tcomponent_name varchar(75) NOT NULL,\n\t\t\t\tcomponent_action varchar(75) NOT NULL,\n\t\t\t\titem_id bigint(20) NOT NULL,\n\t\t\t\tsecondary_item_id bigint(20) NOT NULL,\n\t\t \t\tdate_recorded datetime NOT NULL,\n\t\t\t\tis_private tinyint(1) NOT NULL DEFAULT 0,\n\t\t\t\tno_sitewide_cache tinyint(1) NOT NULL DEFAULT 0,\n\t\t\t KEY item_id (item_id),\n\t\t\t\tKEY user_id (user_id),\n\t\t\t KEY is_private (is_private),\n\t\t\t\tKEY component_name (component_name)\n\t\t \t ) {$charset_collate};";
$sql[] = "CREATE TABLE {$bp->activity->table_name_user_activity_cached} (\n\t\t \t\tid bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t\tuser_id bigint(20) NOT NULL,\n\t\t\t\tcomponent_name varchar(75) NOT NULL,\n\t\t\t\tcomponent_action varchar(75) NOT NULL,\n\t\t\t\tcontent longtext NOT NULL,\n\t\t\t\tprimary_link varchar(150) NOT NULL,\n\t\t\t\titem_id bigint(20) NOT NULL,\n\t\t\t\tsecondary_item_id bigint(20) NOT NULL,\n\t\t\t\tdate_cached datetime NOT NULL,\n\t\t\t\tdate_recorded datetime NOT NULL,\n\t\t\t\tis_private tinyint(1) NOT NULL DEFAULT 0,\n\t\t\t\tKEY date_cached (date_cached),\n\t\t\t\tKEY date_recorded (date_recorded),\n\t\t\t KEY is_private (is_private),\n\t\t\t\tKEY user_id (user_id),\n\t\t\t\tKEY item_id (item_id),\n\t\t\t\tKEY component_name (component_name)\n\t\t \t ) {$charset_collate};";
$sql[] = "CREATE TABLE {$bp->activity->table_name_sitewide} (\n\t\t \t\tid bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t\tuser_id bigint(20) NOT NULL,\n\t\t\t\titem_id bigint(20) NOT NULL,\n\t\t\t\tsecondary_item_id bigint(20),\n\t\t \t\tcontent longtext NOT NULL,\n\t\t\t\tprimary_link varchar(150) NOT NULL,\n\t\t\t\tcomponent_name varchar(75) NOT NULL,\n\t\t\t\tcomponent_action varchar(75) NOT NULL,\n\t\t\t\tdate_cached datetime NOT NULL,\n\t\t\t\tdate_recorded datetime NOT NULL,\n\t\t\t\tKEY date_cached (date_cached),\n\t\t\t\tKEY date_recorded (date_recorded),\n\t\t\t\tKEY user_id (user_id),\n\t\t\t\tKEY item_id (item_id),\n\t\t\t\tKEY component_name (component_name)\n\t\t \t ) {$charset_collate};";
require_once ABSPATH . 'wp-admin/upgrade-functions.php';
dbDelta($sql);
if ('' == get_site_option('bp-activity-db-merge') || !get_site_option('bp-activity-db-merge')) {
$users = $wpdb->get_col("SELECT ID FROM " . CUSTOM_USER_TABLE);
foreach ($users as $user_id) {
BP_Activity_Activity::convert_tables_for_user($user_id);
BP_Activity_Activity::kill_tables_for_user($user_id);
}
add_site_option('bp-activity-db-merge', 1);
}
update_site_option('bp-activity-db-version', BP_ACTIVITY_DB_VERSION);
}