summaryrefslogtreecommitdiffstats
path: root/wp-inst
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-12-20 15:12:04 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-12-20 15:12:04 +0000
commitcc83ad3fc583dc8492842143d030ebb15275b02b (patch)
tree20b31056c7dbf1950c00808564595721d18c44fa /wp-inst
parent85a3cd1e5bd9e8861b2034402518891c5f905dac (diff)
downloadwordpress-mu-cc83ad3fc583dc8492842143d030ebb15275b02b.tar.gz
wordpress-mu-cc83ad3fc583dc8492842143d030ebb15275b02b.tar.xz
wordpress-mu-cc83ad3fc583dc8492842143d030ebb15275b02b.zip
WP Merge
Cache fixes git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@477 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst')
-rw-r--r--wp-inst/wp-admin/admin-db.php2
-rw-r--r--wp-inst/wp-admin/admin-functions.php2
-rw-r--r--wp-inst/wp-admin/inline-uploading.php14
-rw-r--r--wp-inst/wp-content/themes/default/attachment.php4
-rw-r--r--wp-inst/wp-includes/cache.php2
-rw-r--r--wp-inst/wp-includes/comment-functions.php2
-rw-r--r--wp-inst/wp-includes/functions.php4
-rw-r--r--wp-inst/wp-includes/pluggable-functions.php6
-rw-r--r--wp-inst/wp-includes/registration-functions.php2
-rw-r--r--wp-inst/wp-includes/template-functions-post.php2
-rw-r--r--wp-inst/wp-includes/wpmu-functions.php31
11 files changed, 43 insertions, 28 deletions
diff --git a/wp-inst/wp-admin/admin-db.php b/wp-inst/wp-admin/admin-db.php
index f764d3f..73b59f3 100644
--- a/wp-inst/wp-admin/admin-db.php
+++ b/wp-inst/wp-admin/admin-db.php
@@ -242,7 +242,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = $id AND meta_key = '{$wpdb->prefix}capabilities'");
wp_cache_delete($id, 'users');
- wp_cache_delete($user->user_login, 'users');
+ wp_cache_delete($user->user_login, 'userlogins');
do_action('delete_user', $id);
diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php
index cd7f083..d0d08d2 100644
--- a/wp-inst/wp-admin/admin-functions.php
+++ b/wp-inst/wp-admin/admin-functions.php
@@ -93,7 +93,7 @@ function fix_attachment_links($post_ID) {
return;
$i = 0;
- $search = "# id=(\"|)(\d+)\\1#i";
+ $search = "# id=(\"|')p(\d+)\\1#i";
foreach ( $anchor_matches[0] as $anchor ) {
if ( 0 == preg_match($search, $anchor, $id_matches) )
continue;
diff --git a/wp-inst/wp-admin/inline-uploading.php b/wp-inst/wp-admin/inline-uploading.php
index 053746c..065855a 100644
--- a/wp-inst/wp-admin/inline-uploading.php
+++ b/wp-inst/wp-admin/inline-uploading.php
@@ -235,7 +235,7 @@ srcb[{$ID}] = '{$image['guid']}';
$xpadding = (128 - $image['uwidth']) / 2;
$ypadding = (96 - $image['uheight']) / 2;
$style .= "#target{$ID} img { padding: {$ypadding}px {$xpadding}px; }\n";
- $script .= "aa[{$ID}] = '<a id=\"{$ID}\" rel=\"attachment\" class=\"imagelink\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$image['post_title']}\">';
+ $script .= "aa[{$ID}] = '<a id=\"p{$ID}\" rel=\"attachment\" class=\"imagelink\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$image['post_title']}\">';
ab[{$ID}] = '<a class=\"imagelink\" href=\"{$image['guid']}\" onclick=\"doPopup({$ID});return false;\" title=\"{$image['post_title']}\">';
imga[{$ID}] = '<img id=\"image{$ID}\" src=\"$src\" alt=\"{$image['post_title']}\" $height_width />';
imgb[{$ID}] = '<img id=\"image{$ID}\" src=\"{$image['guid']}\" alt=\"{$image['post_title']}\" $height_width />';
@@ -258,15 +258,15 @@ imgb[{$ID}] = '<img id=\"image{$ID}\" src=\"{$image['guid']}\" alt=\"{$image['po
$filename = basename($attachment['guid']);
$icon = get_attachment_icon($ID);
$toggle_icon = "<a id=\"I{$ID}\" onclick=\"toggleOtherIcon({$ID});return false;\" href=\"javascript:void()\">$__using_title</a>";
- $script .= "aa[{$ID}] = '<a id=\"{$ID}\" rel=\"attachment\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">{$attachment['post_title']}</a>';
-ab[{$ID}] = '<a id=\"{$ID}\" href=\"{$filename}\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">{$attachment['post_title']}</a>';
+ $script .= "aa[{$ID}] = '<a id=\"p{$ID}\" rel=\"attachment\" href=\"$href\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">{$attachment['post_title']}</a>';
+ab[{$ID}] = '<a id=\"p{$ID}\" href=\"{$filename}\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">{$attachment['post_title']}</a>';
title[{$ID}] = '{$attachment['post_title']}';
filename[{$ID}] = '{$filename}';
icon[{$ID}] = '{$icon}';
";
$html .= "<div id='target{$ID}' class='attwrap left'>
<div id='div{$ID}' class='otherwrap usingtext' onmousedown=\"selectLink({$ID})\" onclick=\"doPopup({$ID});return false;\">
- <a id=\"{$ID}\" href=\"{$attachment['guid']}\" onmousedown=\"selectLink({$ID});\" onclick=\"return false;\">{$attachment['post_title']}</a>
+ <a id=\"p{$ID}\" href=\"{$attachment['guid']}\" onmousedown=\"selectLink({$ID});\" onclick=\"return false;\">{$attachment['post_title']}</a>
</div>
{$noscript}
</div>
@@ -349,7 +349,7 @@ function toggleLink(n) {
function toggleOtherLink(n) {
od=document.getElementById('div'+n);
ol=document.getElementById('L'+n);
- oi=document.getElementById(n);
+ oi=document.getElementById('p'+n);
ih=oi.innerHTML;
if ( ol.innerHTML == linkedtofile ) {
od.innerHTML = aa[n];
@@ -358,7 +358,7 @@ function toggleOtherLink(n) {
od.innerHTML = ab[n];
ol.innerHTML = linkedtofile;
}
- oi=document.getElementById(n);
+ oi=document.getElementById('p'+n);
oi.innerHTML = ih;
}
function toggleImage(n) {
@@ -374,7 +374,7 @@ function toggleImage(n) {
}
function toggleOtherIcon(n) {
od = document.getElementById('div'+n);
- o = document.getElementById(n);
+ o = document.getElementById('p'+n);
oi = document.getElementById('I'+n);
if ( oi.innerHTML == usingtitle ) {
o.innerHTML = filename[n];
diff --git a/wp-inst/wp-content/themes/default/attachment.php b/wp-inst/wp-content/themes/default/attachment.php
index 559a8e4..b8f3347 100644
--- a/wp-inst/wp-content/themes/default/attachment.php
+++ b/wp-inst/wp-content/themes/default/attachment.php
@@ -8,10 +8,12 @@
<div class="alignleft">&nbsp;</div>
<div class="alignright">&nbsp;</div>
</div>
+<?php $attachment_link = get_the_attachment_link($post->ID, true, array(450, 800)); // This also populates the iconsize for the next line ?>
+<?php $_post = &get_post($post->ID); $classname = ($_post->iconsize[0] <= 128 ? 'small' : '') . 'attachment'; // This lets us style narrow icons specially ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> &raquo; <a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="entrytext">
- <p class="<?php $link = get_the_attachment_link($post->ID, true, array(450, 800)); /* Doing this now populates the imagesize stuff */ echo $post->iconsize[0] <= 128 ? 'small' : ''; ?>attachment"><?php echo get_the_attachment_link($post->ID, true, array(450, 800)); ?><br /><?php echo basename($post->guid); ?></p>
+ <p class="<?php echo $classname; ?>"><?php echo $attachment_link; ?><br /><?php echo basename($post->guid); ?></p>
<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
diff --git a/wp-inst/wp-includes/cache.php b/wp-inst/wp-includes/cache.php
index 3dba09a..ffb6756 100644
--- a/wp-inst/wp-includes/cache.php
+++ b/wp-inst/wp-includes/cache.php
@@ -58,7 +58,7 @@ class WP_Object_Cache {
var $cache = array ();
var $dirty_objects = array ();
var $non_existant_objects = array ();
- var $global_groups = array ('users', 'usermeta', 'site-options');
+ var $global_groups = array ('users', 'userlogins', 'usermeta', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details');
var $blog_id;
var $cold_cache_hits = 0;
var $warm_cache_hits = 0;
diff --git a/wp-inst/wp-includes/comment-functions.php b/wp-inst/wp-includes/comment-functions.php
index a056835..21b9a99 100644
--- a/wp-inst/wp-includes/comment-functions.php
+++ b/wp-inst/wp-includes/comment-functions.php
@@ -74,6 +74,8 @@ function wp_insert_comment($commentdata) {
$comment_date = current_time('mysql');
if ( ! isset($comment_date_gmt) )
$comment_date_gmt = gmdate('Y-m-d H:i:s', strtotime($comment_date) );
+ if ( ! isset($comment_parent) )
+ $comment_parent = 0;
$result = $wpdb->query("INSERT INTO $wpdb->comments
(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id)
diff --git a/wp-inst/wp-includes/functions.php b/wp-inst/wp-includes/functions.php
index d4b5f78..8cd8503 100644
--- a/wp-inst/wp-includes/functions.php
+++ b/wp-inst/wp-includes/functions.php
@@ -2219,7 +2219,7 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
$user = get_userdata($user_id);
wp_cache_delete($user_id, 'users');
- wp_cache_delete($user->user_login, 'users');
+ wp_cache_delete($user->user_login, 'userlogins');
return true;
}
@@ -2241,7 +2241,7 @@ function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
$user = get_userdata($user_id);
wp_cache_delete($user_id, 'users');
- wp_cache_delete($user->user_login, 'users');
+ wp_cache_delete($user->user_login, 'userlogins');
return true;
}
diff --git a/wp-inst/wp-includes/pluggable-functions.php b/wp-inst/wp-includes/pluggable-functions.php
index f30db71..6a99d69 100644
--- a/wp-inst/wp-includes/pluggable-functions.php
+++ b/wp-inst/wp-includes/pluggable-functions.php
@@ -58,7 +58,7 @@ function get_userdata( $user_id ) {
} //end if
wp_cache_add($user_id, $user, 'users');
- wp_cache_add($user->user_login, $user, 'users');
+ wp_cache_add($user->user_login, $user, 'userlogins');
return $user;
}
@@ -78,7 +78,7 @@ function get_userdatabylogin($user_login) {
if ( empty( $user_login ) )
return false;
- $userdata = wp_cache_get($user_login, 'users');
+ $userdata = wp_cache_get($user_login, 'userlogins');
if ( $userdata )
return $userdata;
@@ -106,7 +106,7 @@ function get_userdatabylogin($user_login) {
}
wp_cache_add($user->ID, $user, 'users');
- wp_cache_add($user->user_login, $user, 'users');
+ wp_cache_add($user->user_login, $user, 'userlogins');
return $user;
diff --git a/wp-inst/wp-includes/registration-functions.php b/wp-inst/wp-includes/registration-functions.php
index bafce85..3adc184 100644
--- a/wp-inst/wp-includes/registration-functions.php
+++ b/wp-inst/wp-includes/registration-functions.php
@@ -70,7 +70,7 @@ function wp_insert_user($userdata) {
}
wp_cache_delete($user_id, 'users');
- wp_cache_delete($user_login, 'users');
+ wp_cache_delete($user_login, 'userlogins');
if ( $update )
do_action('profile_update', $user_id);
diff --git a/wp-inst/wp-includes/template-functions-post.php b/wp-inst/wp-includes/template-functions-post.php
index c851947..a13fa87 100644
--- a/wp-inst/wp-includes/template-functions-post.php
+++ b/wp-inst/wp-includes/template-functions-post.php
@@ -534,7 +534,7 @@ function get_attachment_icon($id = 0, $fullsize = false, $max_dims = false) {
}
}
- $icon = "<img src=\"{$src}\" title=\"{$post->post_title}\" {$constraint}/>";
+ $icon = "<img src=\"{$src}\" title=\"{$post->post_title}\" alt=\"{$post->post_title}\" {$constraint}/>";
return apply_filters('attachment_icon', $icon, $post->ID);
}
diff --git a/wp-inst/wp-includes/wpmu-functions.php b/wp-inst/wp-includes/wpmu-functions.php
index fc376c9..e23b3ef 100644
--- a/wp-inst/wp-includes/wpmu-functions.php
+++ b/wp-inst/wp-includes/wpmu-functions.php
@@ -8,10 +8,9 @@ function wpmu_update_blogs_date() {
global $wpdb;
$wpdb->query( "UPDATE {$wpdb->blogs} SET last_updated = NOW() WHERE blog_id = '{$wpdb->blogid}'" );
- $blog = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$wpdb->blogid}'" );
- $key = md5( $blog->domain . $blog->path );
- wp_cache_set($key, serialize( $blog ), 'blog-lookup');
+ refresh_blog_details( $wpdb->blogid );
}
+
add_action('comment_post', 'wpmu_update_blogs_date');
add_action('delete_post', 'wpmu_update_blogs_date');
add_action('delete_comment', 'wpmu_update_blogs_date');
@@ -395,9 +394,25 @@ function get_blog_details( $id ) {
$details = $wpdb->get_row( "SELECT * FROM $wpdb->blogs WHERE blog_id = '$id'" );
$details->blogname = stripslashes( $wpdb->get_var( "SELECT option_value FROM {$wpmuBaseTablePrefix}{$id}_options WHERE option_name = 'blogname'" ) );
$details->siteurl = $wpdb->get_var( "SELECT option_value FROM {$wpmuBaseTablePrefix}{$id}_options WHERE option_name = 'siteurl'" );
-
wp_cache_set( $id, serialize( $details ), 'blog-details' );
+ $key = md5( $details->domain . $details->path );
+ wp_cache_set( $key, serialize( $details ), 'blog-lookup' );
+
+ return $details;
+}
+
+function refresh_blog_details( $id ) {
+ global $wpdb, $wpmuBaseTablePrefix;
+
+ $details = $wpdb->get_row( "SELECT * FROM $wpdb->blogs WHERE blog_id = '$id'" );
+ $details->blogname = stripslashes( $wpdb->get_var( "SELECT option_value FROM {$wpmuBaseTablePrefix}{$id}_options WHERE option_name = 'blogname'" ) );
+ $details->siteurl = $wpdb->get_var( "SELECT option_value FROM {$wpmuBaseTablePrefix}{$id}_options WHERE option_name = 'siteurl'" );
+ wp_cache_set( $id , serialize( $details ), 'blog-details' );
+
+ $key = md5( $details->domain . $details->path );
+ wp_cache_set( $key , serialize( $details ), 'blog-lookup' );
+
return $details;
}
@@ -642,9 +657,7 @@ function is_archived( $id ) {
function update_archived( $id, $archived ) {
global $wpdb;
$wpdb->query( "UPDATE {$wpdb->blogs} SET archived = '{$archived}' WHERE blog_id = '$id'" );
- $blog = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '$id'" );
- $key = md5( $blog->domain . $blog->path );
- wp_cache_set($key, serialize( $blog ), 'blog-lookup');
+ refresh_blog_details( $id );
return $archived;
}
@@ -652,9 +665,7 @@ function update_archived( $id, $archived ) {
function update_blog_status( $id, $pref, $value ) {
global $wpdb;
$wpdb->query( "UPDATE {$wpdb->blogs} SET {$pref} = '{$value}' WHERE blog_id = '$id'" );
- $blog = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '$id'" );
- $key = md5( $blog->domain . $blog->path );
- wp_cache_set($key, serialize( $blog ), 'blog-lookup');
+ refresh_blog_details( $id );
return $value;
}