Changeset 187 for trunk/include/onupdate.php
- Timestamp:
- Apr 21, 2009, 9:05:32 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/onupdate.php
r179 r187 23 23 $mid = $module->getVar('mid') ; 24 24 25 //XPress TABLE UPGRADE 26 global $wpdb,$wp_rewrite, $wp_queries, $table_prefix, $wp_db_version, $wp_roles,$wp_query; 27 define('WP_INSTALLING', true); 28 $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname; 29 $path = $mydirpath . '/'; 30 if (file_exists($path . 'wp-load.php')) { 31 require_once $path . 'wp-load.php'; 32 } else { 33 require_once $path . 'wp-config.php'; 34 } 35 require_once($mydirpath . '/wp-admin/upgrade-functions.php'); 36 37 if ( get_db_version($mydirname) != $wp_db_version ){ 38 if( function_exists( 'wp_upgrade' ) ) { 39 wp_upgrade(); 40 } else { 41 wp_cache_flush(); 42 make_db_current_silent(); 43 upgrade_all(); 44 wp_cache_flush(); 45 } 46 $msgs[] = 'Upgrade Wordpress Database Ver.' . get_db_version($mydirname) .' to' . $wp_db_version; 47 } 48 49 /* activate the xpressme plugin */ 50 require_once dirname( __FILE__ ).'/xpress_active_plugin.php'; 51 if (xpress_pulugin_activation('xpressme/xpressme.php')){ 52 $msgs[] = 'The xpressme plug-in was activated.'; 53 } 54 55 // update_option("blog_charset", wp_blog_charset()); 56 $xpress_version = $module->modinfo['version']; 57 25 // XPressME orignal table updayte 58 26 if (! enhanced_table_check($mydirname,'views')){ 59 27 $xp_prefix = $mydirname; … … 140 108 } 141 109 142 110 // make templates 143 111 include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/xpress_templates_make.php' ; 144 112 $t_mess = xpress_templates_make($mid,$mydirname); 145 113 146 114 $msgs = array_merge($msgs,$t_mess); 115 116 117 //Wordpress TABLE UPGRADE 118 global $wpdb,$wp_rewrite, $wp_queries, $table_prefix, $wp_db_version, $wp_roles,$wp_query; 119 define('WP_INSTALLING', true); 120 $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname; 121 $path = $mydirpath . '/'; 122 123 /* 124 * xpress_put_siteurl($mydirname,''); 125 * Call to a member function register() The on a non-object error is evaded. 126 * It happens by register_widget() that exists in wp-includes/widgets.php. 127 * The blog is not installed. It is cheating to function wp_maybe_load_widgets(). 128 * As a result, default-widgets.php is not loaded. 129 */ 130 xpress_put_siteurl($mydirname,''); // Site_url is temporarily deleted. 131 132 if (file_exists($path . 'wp-load.php')) { 133 require_once $path . 'wp-load.php'; 134 } else { 135 require_once $path . 'wp-config.php'; 136 } 137 138 $site_url= XOOPS_URL."/modules/".$mydirname; 139 update_option("home", $site_url); // Site_url is set again. 140 update_option("siteurl", $site_url); 141 142 require_once($mydirpath . '/wp-admin/upgrade-functions.php'); 143 144 if ( get_db_version($mydirname) != $wp_db_version ){ 145 if( function_exists( 'wp_upgrade' ) ) { 146 wp_upgrade(); 147 } else { 148 wp_cache_flush(); 149 make_db_current_silent(); 150 upgrade_all(); 151 wp_cache_flush(); 152 } 153 $msgs[] = 'Upgrade Wordpress Database Ver.' . get_db_version($mydirname) .' to' . $wp_db_version; 154 } 155 156 /* activate the xpressme plugin */ 157 require_once dirname( __FILE__ ).'/xpress_active_plugin.php'; 158 if (xpress_pulugin_activation('xpressme/xpressme.php')){ 159 $msgs[] = 'The xpressme plug-in was activated.'; 160 } 161 162 // update_option("blog_charset", wp_blog_charset()); 163 $xpress_version = $module->modinfo['version']; 164 165 147 166 148 167 return true ; 168 } 169 endif; 170 171 if( ! function_exists( 'xpress_put_siteurl' ) ) : 172 function xpress_put_siteurl($mydirname,$url){ 173 global $xoopsModule; 174 $wp_prefix = $mydirname; 175 if ($wp_prefix == 'wordpress'){ 176 $wp_prefix = 'wp'; 177 } 178 $xoopsDB =& Database::getInstance(); 179 $db_xpress_option = $xoopsDB->prefix($wp_prefix . '_options'); 180 181 $sql = "UPDATE $db_xpress_option SET option_value = '$url' WHERE option_name = 'siteurl'"; 182 $res = $xoopsDB->queryF($sql, 0, 0); 149 183 } 150 184 endif;
Note: See TracChangeset
for help on using the changeset viewer.