XPressME Integration Kit

Trac

Changeset 398


Ignore:
Timestamp:
Oct 14, 2009, 1:00:59 PM (15 years ago)
Author:
toemon
Message:

WPMU2.8インストール中 Fatal errorが発生するバグを修正 Fixes #222 (thx threm)

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/Ver2.1/extras/for_wordpress_mu/src/include/xpress_mu_function.php

    r244 r398  
    4444                update_blog_option( 1, 'stylesheet', 'xpress_mu_home'); 
    4545                 
    46                 mu_create_blog( $domain, $base, $weblog_title, $user_id, array( 'blog_public' => 1, 'public' => 1 ) ); 
     46                mu_create_blog( $domain, $base, $weblog_title, $admin_user_id, array( 'blog_public' => 1, 'public' => 1 ) ); 
    4747} 
    4848endif; 
     
    187187if( ! function_exists( 'install_mu_blog_defaults' ) ) : 
    188188function install_mu_blog_defaults($blog_id, $user_id) { 
    189         global $wpdb, $wp_rewrite, $current_site, $table_prefix; 
     189        global $wpdb, $wp_rewrite, $current_site, $table_prefix , $xoops_config; 
    190190        if(!is_object($wp_rewrite)){ 
    191191                $wp_rewrite   =& new WP_Rewrite(); 
     
    213213        $first_post = str_replace( "SITE_URL", clean_url("http://" . $current_site->domain . $current_site->path), $first_post ); 
    214214        $first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post ); 
    215         $wpdb->insert( $wpdb->posts, array( 
    216                 'post_author' => $user_id,  
    217                 'post_date' => $now,  
    218                 'post_date_gmt' => $now_gmt, 
    219                 'post_content' => stripslashes( $first_post ),  
    220                 'post_excerpt' => '',  
    221                 'post_title' => __('Hello world!'), 
    222                 'post_category' => 0,  
    223                 'post_name' => __('hello-world'), 
    224                 'post_modified' => $now, 
    225                 'post_modified_gmt' => $now_gmt, 
    226                 'comment_count' => 1 
    227         ) );     
     215 
     216        // insert First page &  First post 
     217        if (version_compare($xoops_config->wp_version,'2.8', '<')){ 
     218                $wpdb->insert( $wpdb->posts, array( 
     219                        'post_author' => $user_id,  
     220                        'post_date' => $now,  
     221                        'post_date_gmt' => $now_gmt, 
     222                        'post_content' => stripslashes( $first_post ),  
     223                        'post_excerpt' => '',  
     224                        'post_title' => __('Hello world!'), 
     225                        'post_category' => 0,  
     226                        'post_name' => __('hello-world'), 
     227                        'post_modified' => $now, 
     228                        'post_modified_gmt' => $now_gmt, 
     229                        'comment_count' => 1 
     230                ) ); 
     231                $wpdb->insert( $wpdb->posts, array( 
     232                        'post_author' => $user_id,  
     233                        'post_date' => $now,  
     234                        'post_date_gmt' => $now_gmt, 
     235                        'post_content' => __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'),  
     236                        'post_excerpt' => '',  
     237                        'post_title' => __('About'), 
     238                        'post_category' => 0,  
     239                        'post_name' => __('about'), 
     240                        'post_modified' => $now, 
     241                        'post_modified_gmt' => $now_gmt, 
     242                        'post_status' => 'publish', 
     243                        'post_type' => 'page', 
     244                        'to_ping' => '', 
     245                        'pinged' => '', 
     246                        'post_content_filtered' => '' 
     247                ) ); 
     248        }else {  
     249                $wpdb->insert( $wpdb->posts, array( 
     250                        'post_author' => $user_id,  
     251                        'post_date' => $now,  
     252                        'post_date_gmt' => $now_gmt, 
     253                        'post_content' => stripslashes( $first_post ),  
     254                        'post_excerpt' => '',  
     255                        'post_title' => __('Hello world!'), 
     256                        'post_name' => __('hello-world'), 
     257                        'post_modified' => $now, 
     258                        'post_modified_gmt' => $now_gmt, 
     259                        'comment_count' => 1 
     260                ) );     
     261                $wpdb->insert( $wpdb->term_relationships, array('object_id' => 1, 'term_taxonomy_id' => 1)); 
     262                update_option( "post_count", 1 ); 
     263                        $wpdb->insert( $wpdb->posts, array( 
     264                        'post_author' => $user_id,  
     265                        'post_date' => $now,  
     266                        'post_date_gmt' => $now_gmt, 
     267                        'post_content' => __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'),  
     268                        'post_excerpt' => '',  
     269                        'post_title' => __('About'), 
     270                        'post_name' => __('about'), 
     271                        'post_modified' => $now, 
     272                        'post_modified_gmt' => $now_gmt, 
     273                        'post_status' => 'publish', 
     274                        'post_type' => 'page', 
     275                        'to_ping' => '', 
     276                        'pinged' => '', 
     277                        'post_content_filtered' => '' 
     278                ) ); 
     279        } 
    228280        $wpdb->insert( $wpdb->term_relationships, array('object_id' => 1, 'term_taxonomy_id' => 1)); 
    229281        update_option( "post_count", 1 ); 
    230282 
    231         // First page 
    232         $wpdb->insert( $wpdb->posts, array( 
    233                 'post_author' => $user_id,  
    234                 'post_date' => $now,  
    235                 'post_date_gmt' => $now_gmt, 
    236                 'post_content' => __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'),  
    237                 'post_excerpt' => '',  
    238                 'post_title' => __('About'), 
    239                 'post_category' => 0,  
    240                 'post_name' => __('about'), 
    241                 'post_modified' => $now, 
    242                 'post_modified_gmt' => $now_gmt, 
    243                 'post_status' => 'publish', 
    244                 'post_type' => 'page', 
    245                 'to_ping' => '', 
    246                 'pinged' => '', 
    247                 'post_content_filtered' => '' 
    248         ) ); 
    249          
    250283        // Flush rules to pick up the new page. 
    251284        $wp_rewrite->init(); 
    252         $wp_rewrite->flush_rules(); 
     285        $wp_rewrite->flush_rules(false); 
    253286 
    254287        // Default comment 
  • trunk/extras/for_wordpress_mu/src/include/xpress_mu_function.php

    r244 r398  
    4444                update_blog_option( 1, 'stylesheet', 'xpress_mu_home'); 
    4545                 
    46                 mu_create_blog( $domain, $base, $weblog_title, $user_id, array( 'blog_public' => 1, 'public' => 1 ) ); 
     46                mu_create_blog( $domain, $base, $weblog_title, $admin_user_id, array( 'blog_public' => 1, 'public' => 1 ) ); 
    4747} 
    4848endif; 
     
    187187if( ! function_exists( 'install_mu_blog_defaults' ) ) : 
    188188function install_mu_blog_defaults($blog_id, $user_id) { 
    189         global $wpdb, $wp_rewrite, $current_site, $table_prefix; 
     189        global $wpdb, $wp_rewrite, $current_site, $table_prefix , $xoops_config; 
    190190        if(!is_object($wp_rewrite)){ 
    191191                $wp_rewrite   =& new WP_Rewrite(); 
     
    213213        $first_post = str_replace( "SITE_URL", clean_url("http://" . $current_site->domain . $current_site->path), $first_post ); 
    214214        $first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post ); 
    215         $wpdb->insert( $wpdb->posts, array( 
    216                 'post_author' => $user_id,  
    217                 'post_date' => $now,  
    218                 'post_date_gmt' => $now_gmt, 
    219                 'post_content' => stripslashes( $first_post ),  
    220                 'post_excerpt' => '',  
    221                 'post_title' => __('Hello world!'), 
    222                 'post_category' => 0,  
    223                 'post_name' => __('hello-world'), 
    224                 'post_modified' => $now, 
    225                 'post_modified_gmt' => $now_gmt, 
    226                 'comment_count' => 1 
    227         ) );     
     215 
     216        // insert First page &  First post 
     217        if (version_compare($xoops_config->wp_version,'2.8', '<')){ 
     218                $wpdb->insert( $wpdb->posts, array( 
     219                        'post_author' => $user_id,  
     220                        'post_date' => $now,  
     221                        'post_date_gmt' => $now_gmt, 
     222                        'post_content' => stripslashes( $first_post ),  
     223                        'post_excerpt' => '',  
     224                        'post_title' => __('Hello world!'), 
     225                        'post_category' => 0,  
     226                        'post_name' => __('hello-world'), 
     227                        'post_modified' => $now, 
     228                        'post_modified_gmt' => $now_gmt, 
     229                        'comment_count' => 1 
     230                ) ); 
     231                $wpdb->insert( $wpdb->posts, array( 
     232                        'post_author' => $user_id,  
     233                        'post_date' => $now,  
     234                        'post_date_gmt' => $now_gmt, 
     235                        'post_content' => __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'),  
     236                        'post_excerpt' => '',  
     237                        'post_title' => __('About'), 
     238                        'post_category' => 0,  
     239                        'post_name' => __('about'), 
     240                        'post_modified' => $now, 
     241                        'post_modified_gmt' => $now_gmt, 
     242                        'post_status' => 'publish', 
     243                        'post_type' => 'page', 
     244                        'to_ping' => '', 
     245                        'pinged' => '', 
     246                        'post_content_filtered' => '' 
     247                ) ); 
     248        }else {  
     249                $wpdb->insert( $wpdb->posts, array( 
     250                        'post_author' => $user_id,  
     251                        'post_date' => $now,  
     252                        'post_date_gmt' => $now_gmt, 
     253                        'post_content' => stripslashes( $first_post ),  
     254                        'post_excerpt' => '',  
     255                        'post_title' => __('Hello world!'), 
     256                        'post_name' => __('hello-world'), 
     257                        'post_modified' => $now, 
     258                        'post_modified_gmt' => $now_gmt, 
     259                        'comment_count' => 1 
     260                ) );     
     261                $wpdb->insert( $wpdb->term_relationships, array('object_id' => 1, 'term_taxonomy_id' => 1)); 
     262                update_option( "post_count", 1 ); 
     263                        $wpdb->insert( $wpdb->posts, array( 
     264                        'post_author' => $user_id,  
     265                        'post_date' => $now,  
     266                        'post_date_gmt' => $now_gmt, 
     267                        'post_content' => __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'),  
     268                        'post_excerpt' => '',  
     269                        'post_title' => __('About'), 
     270                        'post_name' => __('about'), 
     271                        'post_modified' => $now, 
     272                        'post_modified_gmt' => $now_gmt, 
     273                        'post_status' => 'publish', 
     274                        'post_type' => 'page', 
     275                        'to_ping' => '', 
     276                        'pinged' => '', 
     277                        'post_content_filtered' => '' 
     278                ) ); 
     279        } 
    228280        $wpdb->insert( $wpdb->term_relationships, array('object_id' => 1, 'term_taxonomy_id' => 1)); 
    229281        update_option( "post_count", 1 ); 
    230282 
    231         // First page 
    232         $wpdb->insert( $wpdb->posts, array( 
    233                 'post_author' => $user_id,  
    234                 'post_date' => $now,  
    235                 'post_date_gmt' => $now_gmt, 
    236                 'post_content' => __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'),  
    237                 'post_excerpt' => '',  
    238                 'post_title' => __('About'), 
    239                 'post_category' => 0,  
    240                 'post_name' => __('about'), 
    241                 'post_modified' => $now, 
    242                 'post_modified_gmt' => $now_gmt, 
    243                 'post_status' => 'publish', 
    244                 'post_type' => 'page', 
    245                 'to_ping' => '', 
    246                 'pinged' => '', 
    247                 'post_content_filtered' => '' 
    248         ) ); 
    249          
    250283        // Flush rules to pick up the new page. 
    251284        $wp_rewrite->init(); 
    252         $wp_rewrite->flush_rules(); 
     285        $wp_rewrite->flush_rules(false); 
    253286 
    254287        // Default comment 
Note: See TracChangeset for help on using the changeset viewer.