/bp-forums/bbpress/bb-admin/includes/functions.bb-upgrade.php

  1. <?php 
  2. function bb_install() { 
  3. require_once( BACKPRESS_PATH . 'class.bp-sql-schema-parser.php' ); 
  4. require_once( BB_PATH . 'bb-admin/includes/defaults.bb-schema.php' ); 
  5. $alterations = BP_SQL_Schema_Parser::delta( $bbdb, $bb_queries, $bb_schema_ignore ); 
  6.  
  7. bb_update_db_version(); 
  8.  
  9. return array_filter($alterations); 
  10.  
  11. function bb_upgrade_all() 
  12. if ( !ini_get( 'safe_mode' ) ) { 
  13. set_time_limit(600); 
  14.  
  15. $_do_user_operations = true; 
  16. if ( bb_get_option( 'wp_table_prefix' ) || ( defined( 'BB_SCHEMA_IGNORE_WP_USERS_TABLES' ) && BB_SCHEMA_IGNORE_WP_USERS_TABLES ) ) { 
  17. $_do_user_operations = false; 
  18.  
  19. $bb_upgrade = array(); 
  20.  
  21. // Pre DB Delta 
  22. if ( $_do_user_operations ) { 
  23. $bb_upgrade['messages'][] = bb_upgrade_160(); // Break blocked users 
  24. $bb_upgrade['messages'][] = bb_upgrade_170(); // Escaping in usermeta 
  25. $bb_upgrade['messages'][] = bb_upgrade_180(); // Delete users for real 
  26. $bb_upgrade['messages'][] = bb_upgrade_190(); // Move topic_resolved to topicmeta 
  27. $bb_upgrade['messages'][] = bb_upgrade_200(); // Indices 
  28. $bb_upgrade['messages'][] = bb_upgrade_210(); // Convert text slugs to varchar slugs 
  29. $bb_upgrade['messages'][] = bb_upgrade_220(); // remove bb_tagged primary key, add new column and primary key 
  30.  
  31. require_once( BACKPRESS_PATH . 'class.bp-sql-schema-parser.php' ); 
  32. require_once( BB_PATH . 'bb-admin/includes/defaults.bb-schema.php' ); 
  33. $delta = BP_SQL_Schema_Parser::delta( $bbdb, $bb_queries, $bb_schema_ignore ); 
  34. if ( is_array( $delta ) ) { 
  35. $bb_upgrade['messages'] = array_merge($bb_upgrade['messages'], $delta['messages']); 
  36. $bb_upgrade['errors'] = $delta['errors']; 
  37. } else { 
  38. $bb_upgrade['errors'] = array(); 
  39.  
  40. // Post DB Delta 
  41. $bb_upgrade['messages'][] = bb_upgrade_1000(); // Make forum and topic slugs 
  42. $bb_upgrade['messages'][] = bb_upgrade_1010(); // Make sure all forums have a valid parent 
  43. if ( $_do_user_operations ) { 
  44. $bb_upgrade['messages'][] = bb_upgrade_1020(); // Add a user_nicename to existing users 
  45. $bb_upgrade['messages'][] = bb_upgrade_1030(); // Move admin_email option to from_email 
  46. $bb_upgrade['messages'][] = bb_upgrade_1040(); // Activate Akismet and bozo plugins and convert active plugins to new convention on upgrade only 
  47. $bb_upgrade['messages'][] = bb_upgrade_1050(); // Update active theme if present 
  48. $bb_upgrade['messages'][] = bb_upgrade_1070(); // trim whitespace from raw_tag 
  49. $bb_upgrade['messages'][] = bb_upgrade_1080(); // Convert tags to taxonomy 
  50. if ( $_do_user_operations ) { 
  51. $bb_upgrade['messages'][] = bb_upgrade_1090(); // Add display names 
  52. $bb_upgrade['messages'][] = bb_upgrade_1100(); // Replace forum_stickies index with stickies (#876) 
  53. $bb_upgrade['messages'][] = bb_upgrade_1110(); // Create plugin directory (#1083) 
  54. $bb_upgrade['messages'][] = bb_upgrade_1120(); // Create theme directory (#1083) 
  55. $bb_upgrade['messages'][] = bb_upgrade_1130(); // Add subscriptions option and set it to true (#1268) 
  56.  
  57. bb_update_db_version(); 
  58. wp_cache_flush(); 
  59.  
  60. $bb_upgrade['messages'] = array_filter($bb_upgrade['messages']); 
  61. $bb_upgrade['errors'] = array_filter($bb_upgrade['errors']); 
  62.  
  63. return $bb_upgrade; 
  64.  
  65. function bb_upgrade_process_all_slugs() { 
  66. global $bbdb; 
  67. // Forums 
  68.  
  69. $forums = (array) $bbdb->get_results("SELECT forum_id, forum_name FROM $bbdb->forums ORDER BY forum_order ASC" ); 
  70.  
  71. $slugs = array(); 
  72. foreach ( $forums as $forum ) : 
  73. $slug = bb_slug_sanitize( wp_specialchars_decode( $forum->forum_name, ENT_QUOTES ) ); 
  74. $slugs[$slug][] = $forum->forum_id; 
  75. endforeach; 
  76.  
  77. foreach ( $slugs as $slug => $forum_ids ) : 
  78. foreach ( $forum_ids as $count => $forum_id ) : 
  79. $_slug = $slug; 
  80. $count = - $count; // madness 
  81. if ( is_numeric($slug) || $count ) 
  82. $_slug = bb_slug_increment( $slug, $count ); 
  83. $bbdb->query("UPDATE $bbdb->forums SET forum_slug = '$_slug' WHERE forum_id = '$forum_id';"); 
  84. endforeach; 
  85. endforeach; 
  86. unset($forums, $forum, $slugs, $slug, $_slug, $forum_ids, $forum_id, $count); 
  87.  
  88. // Topics 
  89.  
  90. $topics = (array) $bbdb->get_results("SELECT topic_id, topic_title FROM $bbdb->topics ORDER BY topic_start_time ASC" ); 
  91.  
  92. $slugs = array(); 
  93. foreach ( $topics as $topic) : 
  94. $slug = bb_slug_sanitize( wp_specialchars_decode( $topic->topic_title, ENT_QUOTES ) ); 
  95. $slugs[$slug][] = $topic->topic_id; 
  96. endforeach; 
  97.  
  98. foreach ( $slugs as $slug => $topic_ids ) : 
  99. foreach ( $topic_ids as $count => $topic_id ) : 
  100. $_slug = $slug; 
  101. $count = - $count; 
  102. if ( is_numeric($slug) || $count ) 
  103. $_slug = bb_slug_increment( $slug, $count ); 
  104. $bbdb->query("UPDATE $bbdb->topics SET topic_slug = '$_slug' WHERE topic_id = '$topic_id';"); 
  105. endforeach; 
  106. endforeach; 
  107. unset($topics, $topic, $slugs, $slug, $_slug, $topic_ids, $topic_id, $count); 
  108.  
  109. // Reversibly break passwords of blocked users. 
  110. function bb_upgrade_160() { 
  111. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 535 ) 
  112. return; 
  113.  
  114. require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' ); 
  115. $blocked = bb_get_ids_by_role( 'blocked' ); 
  116. foreach ( $blocked as $b ) 
  117. bb_break_password( $b ); 
  118. return 'Done reversibly breaking passwords: ' . __FUNCTION__; 
  119.  
  120. function bb_upgrade_170() { 
  121. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 536 ) 
  122. return; 
  123.  
  124. global $bbdb; 
  125. foreach ( (array) $bbdb->get_results("SELECT * FROM $bbdb->usermeta WHERE meta_value LIKE '%"%' OR meta_value LIKE '%'%'") as $meta ) { 
  126. $value = str_replace(array('"', '''), array('"', "'"), $meta->meta_value); 
  127. $value = stripslashes($value); 
  128. bb_update_usermeta( $meta->user_id, $meta->meta_key, $value); 
  129. bb_update_option( 'bb_db_version', 536 ); 
  130. return 'Done updating usermeta: ' . __FUNCTION__; 
  131.  
  132. function bb_upgrade_180() { 
  133. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 559 ) 
  134. return; 
  135.  
  136. global $bbdb; 
  137.  
  138. foreach ( (array) $bbdb->get_col("SELECT ID FROM $bbdb->users WHERE user_status = 1") as $user_id ) 
  139. bb_delete_user( $user_id ); 
  140. bb_update_option( 'bb_db_version', 559 ); 
  141. return 'Done clearing deleted users: ' . __FUNCTION__; 
  142.  
  143. function bb_upgrade_190() { 
  144. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 630 ) 
  145. return; 
  146.  
  147. global $bbdb; 
  148.  
  149. $exists = false; 
  150. foreach ( (array) $bbdb->get_col("DESC $bbdb->topics") as $col ) 
  151. if ( 'topic_resolved' == $col ) 
  152. $exists = true; 
  153. if ( !$exists ) 
  154. return; 
  155.  
  156. $topics = (array) $bbdb->get_results("SELECT topic_id, topic_resolved FROM $bbdb->topics" ); 
  157. foreach ( $topics as $topic ) 
  158. bb_update_topicmeta( $topic->topic_id, 'topic_resolved', $topic->topic_resolved ); 
  159. unset($topics, $topic); 
  160.  
  161. $bbdb->query("ALTER TABLE $bbdb->topics DROP topic_resolved"); 
  162.  
  163. bb_update_option( 'bb_db_version', 630 ); 
  164.  
  165. return 'Done converting topic_resolved: ' . __FUNCTION__; 
  166.  
  167. function bb_upgrade_200() { 
  168. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 845 ) 
  169. return; 
  170.  
  171. global $bbdb; 
  172.  
  173. $bbdb->hide_errors(); 
  174. $bbdb->query( "DROP INDEX tag_id_index ON $bbdb->tagged" ); 
  175. $bbdb->query( "DROP INDEX user_id ON $bbdb->topicmeta" ); 
  176. $bbdb->query( "DROP INDEX forum_id ON $bbdb->topics" ); 
  177. $bbdb->query( "DROP INDEX topic_time ON $bbdb->topics" ); 
  178. $bbdb->query( "DROP INDEX topic_start_time ON $bbdb->topics" ); 
  179. $bbdb->query( "DROP INDEX tag_id_index ON $bbdb->tagged" ); 
  180. $bbdb->query( "DROP INDEX topic_id ON $bbdb->posts" ); 
  181. $bbdb->query( "DROP INDEX poster_id ON $bbdb->posts" ); 
  182. $bbdb->show_errors(); 
  183.  
  184. bb_update_option( 'bb_db_version', 845 ); 
  185.  
  186. return 'Done removing old indices: ' . __FUNCTION__; 
  187.  
  188. // 210 converts text slugs to varchar(255) width slugs (upgrading from alpha version - fires before dbDelta) 
  189. // 1000 Gives new slugs (upgrading from previous release - fires after dbDelta) 
  190. function bb_upgrade_210() { 
  191. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 846 ) 
  192. return; 
  193.  
  194. global $bbdb; 
  195.  
  196. $bbdb->hide_errors(); 
  197. if ( !$bbdb->get_var("SELECT forum_slug FROM $bbdb->forums ORDER BY forum_order ASC LIMIT 1" ) ) 
  198. return; // Wait till after dbDelta 
  199. $bbdb->show_errors(); 
  200.  
  201. bb_upgrade_process_all_slugs(); 
  202.  
  203. bb_update_option( 'bb_db_version', 846 ); 
  204.  
  205. return 'Done adding slugs: ' . __FUNCTION__; 
  206.  
  207. function bb_upgrade_220() { 
  208. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1051 ) 
  209. return; 
  210.  
  211. global $bbdb; 
  212.  
  213. $bbdb->query( "ALTER TABLE $bbdb->tagged DROP PRIMARY KEY" ); 
  214. $bbdb->query( "ALTER TABLE $bbdb->tagged ADD tagged_id bigint(20) unsigned NOT NULL auto_increment PRIMARY KEY FIRST" ); 
  215.  
  216. return "Done removing key from $bbdb->tagged: " . __FUNCTION__; 
  217.  
  218. function bb_upgrade_1000() { // Give all topics and forums slugs 
  219. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 846 ) 
  220. return; 
  221.  
  222. bb_upgrade_process_all_slugs(); 
  223.  
  224. bb_update_option( 'bb_db_version', 846 ); 
  225.  
  226. return 'Done adding slugs: ' . __FUNCTION__;; 
  227.  
  228. // Make sure all forums have a valid parent 
  229. function bb_upgrade_1010() { 
  230. global $bbdb; 
  231. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 952 ) 
  232. return; 
  233.  
  234. $forums = (array) $bbdb->get_results( "SELECT forum_id, forum_parent FROM $bbdb->forums" ); 
  235. $forum_ids = (array) $bbdb->get_col( '', 0 ); 
  236.  
  237. foreach ( $forums as $forum ) { 
  238. if ( $forum->forum_parent && !in_array( $forum->forum_parent, $forum_ids ) ) 
  239. $bbdb->query( "UPDATE $bbdb->forums SET forum_parent = 0 WHERE forum_id = '$forum->forum_id'" ); 
  240.  
  241. bb_update_option( 'bb_db_version', 952 ); 
  242.  
  243. return 'Done re-parenting orphaned forums: ' . __FUNCTION__; 
  244.  
  245. // Add a nicename for existing users if they don't have one already 
  246. function bb_upgrade_1020() { 
  247. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 977 ) 
  248. return; 
  249.  
  250. global $bbdb; 
  251.  
  252. $users = $bbdb->get_results( "SELECT ID, user_login, user_nicename FROM $bbdb->users WHERE user_nicename IS NULL OR user_nicename = ''" ); 
  253.  
  254. if ( $users ) { 
  255. foreach ( $users as $user ) { 
  256. $user_nicename = $_user_nicename = bb_user_nicename_sanitize( $user->user_login ); 
  257. while ( is_numeric($user_nicename) || $existing_user = bb_get_user_by_nicename( $user_nicename ) ) 
  258. $user_nicename = bb_slug_increment($_user_nicename, $existing_user->user_nicename, 50); 
  259.  
  260. $bbdb->query( "UPDATE $bbdb->users SET user_nicename = '$user_nicename' WHERE ID = $user->ID;" ); 
  261.  
  262. bb_update_option( 'bb_db_version', 977 ); 
  263.  
  264. return 'Done adding nice-names to existing users: ' . __FUNCTION__; 
  265.  
  266. // Move admin_email option to from_email 
  267. function bb_upgrade_1030() { 
  268. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1058 ) 
  269. return; 
  270.  
  271. $admin_email = bb_get_option('admin_email'); 
  272. if ($admin_email) { 
  273. bb_update_option('from_email', $admin_email); 
  274. bb_delete_option('admin_email'); 
  275.  
  276. bb_update_option( 'bb_db_version', 1058 ); 
  277.  
  278. return 'Done moving admin_email to from_email: ' . __FUNCTION__; 
  279.  
  280. // Activate Akismet and bozo plugins and convert active plugins to new convention on upgrade only 
  281. function bb_upgrade_1040() { 
  282. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1230 ) 
  283. return; 
  284.  
  285. // Only do this when upgrading 
  286. if ( defined( 'BB_UPGRADING' ) && BB_UPGRADING ) { 
  287. $plugins = bb_get_option('active_plugins'); 
  288. if ( bb_get_option('akismet_key') && !in_array('core#akismet.php', $plugins) ) { 
  289. $plugins[] = 'core#akismet.php'; 
  290. if ( !in_array('core#bozo.php', $plugins) ) { 
  291. $plugins[] = 'core#bozo.php'; 
  292.  
  293. $new_plugins = array(); 
  294. foreach ($plugins as $plugin) { 
  295. if (substr($plugin, 0, 5) != 'core#') { 
  296. if ($plugin != 'akismet.php' && $plugin != 'bozo.php') { 
  297. $new_plugins[] = 'user#' . $plugin; 
  298. } else { 
  299. $new_plugins[] = $plugin; 
  300.  
  301. bb_update_option( 'active_plugins', $new_plugins ); 
  302.  
  303. bb_update_option( 'bb_db_version', 1230 ); 
  304.  
  305. return 'Done activating Akismet and Bozo plugins and converting active plugins to new convention on upgrade only: ' . __FUNCTION__; 
  306.  
  307. // Update active theme if present 
  308. function bb_upgrade_1050() { 
  309. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1234 ) 
  310. return; 
  311.  
  312. // Only do this when upgrading 
  313. if ( defined( 'BB_UPGRADING' ) && BB_UPGRADING ) { 
  314. if ( $theme = bb_get_option( 'bb_active_theme' ) ) { 
  315. bb_update_option( 'bb_active_theme', bb_theme_basename( $theme ) ); 
  316.  
  317. bb_update_option( 'bb_db_version', 1234 ); 
  318.  
  319. return 'Done updating active theme if present: ' . __FUNCTION__; 
  320.  
  321. function bb_upgrade_1070() { 
  322. global $bbdb; 
  323. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1467 ) 
  324. return; 
  325.  
  326. $bbdb->query( "UPDATE `$bbdb->tags` SET `raw_tag` = TRIM(`raw_tag`)" ); 
  327.  
  328. bb_update_option( 'bb_db_version', 1467 ); 
  329.  
  330. return 'Whitespace trimmed from raw_tag: ' . __FUNCTION__; 
  331.  
  332. function bb_upgrade_1080() { 
  333. global $bbdb, $wp_taxonomy_object; 
  334. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1526 ) 
  335. return; 
  336.  
  337. $offset = 0; 
  338. while ( $tags = (array) $bbdb->get_results( "SELECT * FROM $bbdb->tags LIMIT $offset, 100" ) ) { 
  339. if ( !ini_get('safe_mode') ) set_time_limit(600); 
  340. $wp_taxonomy_object->defer_term_counting(true); 
  341. for ( $i = 0; isset($tags[$i]); $i++ ) { 
  342. $bbdb->insert( $bbdb->terms, array(  
  343. 'name' => $tags[$i]->raw_tag,  
  344. 'slug' => $tags[$i]->tag 
  345. ) ); 
  346. $term_id = $bbdb->insert_id; 
  347. $bbdb->insert( $bbdb->term_taxonomy, array( 
  348. 'term_id' => $term_id,  
  349. 'taxonomy' => 'bb_topic_tag',  
  350. 'description' => '' 
  351. ) ); 
  352. $term_taxonomy_id = $bbdb->insert_id; 
  353. $topics = (array) $bbdb->get_results( $bbdb->prepare( "SELECT user_id, topic_id FROM $bbdb->tagged WHERE tag_id = %d", $tags[$i]->tag_id ) ); 
  354. for ( $j = 0; isset($topics[$j]); $j++ ) { 
  355. $bbdb->insert( $bbdb->term_relationships, array( 
  356. 'object_id' => $topics[$j]->topic_id,  
  357. 'term_taxonomy_id' => $term_taxonomy_id,  
  358. 'user_id' => $topics[$j]->user_id 
  359. ) ); 
  360. $wp_taxonomy_object->update_term_count( array( $term_taxonomy_id ), 'bb_topic_tag' ); 
  361. $wp_taxonomy_object->defer_term_counting(false); 
  362. $offset += 100; 
  363.  
  364. bb_update_option( 'bb_db_version', 1526 ); 
  365.  
  366. return 'Tags copied to taxonomy tables: ' . __FUNCTION__; 
  367.  
  368. function bb_upgrade_1090() { 
  369. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1589 ) 
  370. return; 
  371.  
  372. global $bbdb; 
  373.  
  374. $users = (array) $bbdb->get_results( "SELECT `ID`, `user_login` FROM $bbdb->users WHERE `display_name` = '' OR `display_name` IS NULL;" ); 
  375.  
  376. if ($users) { 
  377. foreach ($users as $user) { 
  378. $bbdb->query( "UPDATE $bbdb->users SET `display_name` = '" . $user->user_login . "' WHERE ID = " . $user->ID . ";" ); 
  379. unset($user, $users); 
  380.  
  381. bb_update_option( 'bb_db_version', 1589 ); 
  382.  
  383. return 'Display names populated: ' . __FUNCTION__; 
  384.  
  385. function bb_upgrade_1100() { 
  386. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 1638 ) 
  387. return; 
  388.  
  389. global $bbdb; 
  390.  
  391. $bbdb->query( "DROP INDEX forum_stickies ON $bbdb->topics" ); 
  392.  
  393. bb_update_option( 'bb_db_version', 1638 ); 
  394.  
  395. return 'Index forum_stickies dropped: ' . __FUNCTION__; 
  396.  
  397. function bb_upgrade_1110() { 
  398. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 2077 ) 
  399. return; 
  400.  
  401. // No matter what happens, update the db version 
  402. bb_update_option( 'bb_db_version', 2077 ); 
  403.  
  404. if ( !defined( 'BB_PLUGIN_DIR' ) ) { 
  405. return; 
  406.  
  407. if ( !BB_PLUGIN_DIR ) { 
  408. return; 
  409.  
  410. if ( file_exists( BB_PLUGIN_DIR ) ) { 
  411. return; 
  412.  
  413. // Just suppress errors as this is not critical 
  414. if ( @mkdir( BB_PLUGIN_DIR, 0755 ) ) { 
  415. return 'Making plugin directory at ' . BB_PLUGIN_DIR . ': ' . __FUNCTION__; 
  416.  
  417. return; 
  418.  
  419. function bb_upgrade_1120() { 
  420. if ( ( $dbv = bb_get_option_from_db( 'bb_db_version' ) ) && $dbv >= 2078 ) { 
  421. return; 
  422.  
  423. // No matter what happens, update the db version 
  424. bb_update_option( 'bb_db_version', 2078 ); 
  425.  
  426. if ( !defined( 'BB_THEME_DIR' ) ) { 
  427. return; 
  428.  
  429. if ( !BB_THEME_DIR ) { 
  430. return; 
  431.  
  432. if ( file_exists( BB_THEME_DIR ) ) { 
  433. return; 
  434.  
  435. // Just suppress errors as this is not critical 
  436. if ( @mkdir( BB_THEME_DIR, 0755 ) ) { 
  437. return 'Making theme directory at ' . BB_THEME_DIR . ': ' . __FUNCTION__; 
  438.  
  439. return; 
  440.  
  441. // Subscription Option 
  442. function bb_upgrade_1130() { 
  443. if ( $dbv = bb_get_option_from_db( 'bb_db_version' ) && $dbv >= 2471 ) 
  444. return; 
  445.  
  446. // If the option is already there, then return 
  447. if ( bb_get_option( 'enable_subscriptions' ) ) 
  448. return; 
  449.  
  450. bb_update_option( 'enable_subscriptions', 1 ); 
  451.  
  452. bb_update_option( 'bb_db_version', 2471 ); 
  453.  
  454. return 'Added subscriptions option and set its value to true: ' . __FUNCTION__; 
  455.  
  456. function bb_deslash($content) { 
  457. // Note: \\\ inside a regex denotes a single backslash. 
  458.  
  459. // Replace one or more backslashes followed by a single quote with 
  460. // a single quote. 
  461. $content = preg_replace("/\\\+'/", "'", $content); 
  462.  
  463. // Replace one or more backslashes followed by a double quote with 
  464. // a double quote. 
  465. $content = preg_replace('/\\\+"/', '"', $content); 
  466.  
  467. // Replace one or more backslashes with one backslash. 
  468. $content = preg_replace("/\\\+/", "\\", $content); 
  469.  
  470. return $content; 
  471.  
  472. function bb_update_db_version() { 
  473. bb_update_option( 'bb_db_version', bb_get_option( 'bb_db_version' ) ); 
  474. ?> 
.