From f8c689b4f0b0740f4079bebc6d55155de6e0b70e Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 30 Jan 2007 01:43:39 +0000 Subject: [PATCH] Remove notoptions caching. Multile rewrite_rules options were being created. See #3692 #2268 git-svn-id: http://svn.automattic.com/wordpress/trunk@4831 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-form-advanced.php | 7 +++++++ wp-admin/upgrade-schema.php | 14 ++++++++++++++ wp-includes/functions.php | 19 ++++--------------- wp-includes/post.php | 4 ++++ wp-includes/version.php | 2 +- wp-includes/wp-db.php | 2 ++ wp-settings.php | 2 ++ 7 files changed, 34 insertions(+), 16 deletions(-) diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 1426ece5e..77e8abe93 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -75,6 +75,13 @@ addLoadEvent(focusit); +
+

+
+

+
+
+

diff --git a/wp-admin/upgrade-schema.php b/wp-admin/upgrade-schema.php index afd66765f..bf2180f96 100644 --- a/wp-admin/upgrade-schema.php +++ b/wp-admin/upgrade-schema.php @@ -120,6 +120,20 @@ CREATE TABLE $wpdb->posts ( KEY post_name (post_name), KEY type_status_date (post_type,post_status,post_date,ID) ); +CREATE TABLE $wpdb->tags ( + tag_id bigint(20) unsigned NOT NULL auto_increment, + tag varchar(30) NOT NULL default '', + raw_tag varchar(50) NOT NULL default '', + tag_count bigint(20) unsigned NOT NULL default '0', + PRIMARY KEY (tag_id) +); +CREATE TABLE $wpdb->tagged ( + tag_id bigint(20) unsigned NOT NULL default '0', + post_id bigint(20) unsigned NOT NULL default '0', + PRIMARY KEY (tag_id,post_id), + KEY tag_id_index (tag_id), + KEY post_id_index (post_id) +); CREATE TABLE $wpdb->users ( ID bigint(20) unsigned NOT NULL auto_increment, user_login varchar(60) NOT NULL default '', diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 88b9b785d..077873b7b 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -203,10 +203,6 @@ function is_serialized_string($data) { function get_option($setting) { global $wpdb; - // prevent non-existent options from triggering multiple queries - if ( true === wp_cache_get($setting, 'notoptions') ) - return false; - $value = wp_cache_get($setting, 'options'); if ( false === $value ) { @@ -219,8 +215,7 @@ function get_option($setting) { if( is_object( $row) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values $value = $row->option_value; wp_cache_set($setting, $value, 'options'); - } else { // option does not exist, so we must cache its non-existence - wp_cache_set($setting, true, 'notoptions'); + } else { return false; } } @@ -279,9 +274,6 @@ function update_option($option_name, $newvalue) { return true; } - if ( true === wp_cache_get($option_name, 'notoptions') ) - wp_cache_delete($option_name, 'notoptions'); - $_newvalue = $newvalue; $newvalue = maybe_serialize($newvalue); @@ -301,12 +293,9 @@ function update_option($option_name, $newvalue) { function add_option($name, $value = '', $description = '', $autoload = 'yes') { global $wpdb; - // Make sure the option doesn't already exist we can check the cache before we ask for a db query - if ( true === wp_cache_get($name, 'notoptions') ) - wp_cache_delete($name, 'notoptions'); - else - if ( false !== get_option($name) ) - return; + // Make sure the option doesn't already exist + if ( false !== get_option($name) ) + return; $value = maybe_serialize($value); diff --git a/wp-includes/post.php b/wp-includes/post.php index f1c620286..2f2373a29 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -522,6 +522,9 @@ function wp_insert_post($postarr = array()) { } $post_cat = $post_category[0]; + if ( empty($post_tags) ) + $post_tags = array(); + if ( empty($post_author) ) $post_author = $user_ID; @@ -646,6 +649,7 @@ function wp_insert_post($postarr = array()) { } wp_set_post_categories($post_ID, $post_category); + wp_set_post_tags($post_ID, $post_tags); if ( 'page' == $post_type ) { clean_page_cache($post_ID); diff --git a/wp-includes/version.php b/wp-includes/version.php index 1f55e5174..8511a66c3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -3,6 +3,6 @@ // This holds the version number in a separate file so we can bump it without cluttering the SVN $wp_version = '2.2-bleeding'; -$wp_db_version = 4772; +$wp_db_version = 4815; ?> diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index a267be093..c2b35f005 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -34,6 +34,8 @@ class wpdb { var $optiongroups; var $optiongroup_options; var $postmeta; + var $tags; + var $tagged; /** * Connects to the database server and selects a database diff --git a/wp-settings.php b/wp-settings.php index 3141bd35e..8e246a2d8 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -116,6 +116,8 @@ $wpdb->links = $wpdb->prefix . 'links'; $wpdb->options = $wpdb->prefix . 'options'; $wpdb->postmeta = $wpdb->prefix . 'postmeta'; $wpdb->usermeta = $wpdb->prefix . 'usermeta'; +$wpdb->tags = $wpdb->prefix . 'tags'; +$wpdb->tagged = $wpdb->prefix . 'tagged'; if ( defined('CUSTOM_USER_TABLE') ) $wpdb->users = CUSTOM_USER_TABLE;