Changeset 823

Show
Ignore:
Timestamp:
12/11/06 11:45:03 (2 years ago)
Author:
donncha
Message:

WP Merge to rev 4640

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-db.php

    r811 r823  
    139139        } 
    140140 
    141         wp_cache_delete($cat_ID, 'category'); 
    142         wp_cache_delete('get_categories', 'category'); 
     141        // Keep in mind when using this filter and altering the cat_ID that the two queries above 
     142        // have already taken place with the OLD cat_ID 
     143        // Also note that you may have post2cat entries with the old cat_ID if this is an update 
     144        $cat_ID = apply_filters('cat_id_filter', $cat_ID, $update); 
     145 
     146        clean_category_cache($cat_ID); 
    143147 
    144148        if ($update) { 
    145149                do_action('edit_category', $cat_ID); 
    146150        } else { 
    147                 wp_cache_delete('all_category_ids', 'category'); 
    148151                do_action('create_category', $cat_ID); 
    149152                do_action('add_category', $cat_ID); 
    150153        } 
    151         $cat_ID = apply_filters( "cat_id_filter", $cat_ID ); 
    152154 
    153155        return $cat_ID; 
     
    178180 
    179181        $cat_ID = (int) $cat_ID; 
    180  
    181         // Don't delete the default cat. 
    182         if ( $cat_ID == get_option('default_category') ) 
     182        $default_cat = get_option('default_category'); 
     183        $default_link_cat = get_option('default_link_category'); 
     184 
     185        // Don't delete either of the default cats 
     186        if ( $cat_ID == $default_cat || $cat_ID == $default_link_cat ) 
    183187                return 0; 
    184188 
    185         if ( $cat_ID == get_option('default_link_category') ) 
    186                 return 0; 
    187  
    188189        $category = get_category($cat_ID); 
    189190 
    190191        $parent = $category->category_parent; 
    191192 
    192         // Delete the category. 
     193        // Delete the category 
    193194        if ( !$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'") ) 
    194195                return 0; 
    195196 
    196         // Update children to point to new parent. 
     197        // Update children to point to new parent 
    197198        $wpdb->query("UPDATE $wpdb->categories SET category_parent = '$parent' WHERE category_parent = '$cat_ID'"); 
    198199 
    199         // Only set posts and links to the default category if they're not in another category already. 
    200         $default_cat = get_option('default_category'); 
     200        // Only set posts and links to the default category if they're not in another category already 
    201201        $posts = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id='$cat_ID'"); 
    202         if ( is_array($posts) ) foreach ($posts as $post_id) { 
     202        foreach ( (array) $posts as $post_id ) { 
    203203                $cats = wp_get_post_categories($post_id); 
    204204                if ( 1 == count($cats) ) 
     
    209209        } 
    210210 
    211         $default_link_cat = get_option('default_link_category'); 
    212211        $links = $wpdb->get_col("SELECT link_id FROM $wpdb->link2cat WHERE category_id='$cat_ID'"); 
    213         if ( is_array($links) ) foreach ($links as $link_id) { 
     212        foreach ( (array) $links as $link_id ) { 
    214213                $cats = wp_get_link_cats($link_id); 
    215214                if ( 1 == count($cats) ) 
     
    220219        } 
    221220 
    222         wp_cache_delete($cat_ID, 'category'); 
    223         wp_cache_delete('all_category_ids', 'category'); 
    224         wp_cache_delete('get_categories', 'category'); 
    225  
     221        clean_category_cache($cat_ID); 
    226222        do_action('delete_category', $cat_ID); 
    227  
    228223        return 1; 
    229224} 
     
    493488        } 
    494489 
    495         do_action('edit_link', $link_ID); 
    496490}       // wp_set_link_cats() 
    497491 
  • trunk/wp-admin/admin-functions.php

    r819 r823  
    864864        } else { 
    865865                return false; 
    866         } 
    867 } 
    868  
    869 function wp_create_thumbnail( $file, $max_side, $effect = '' ) { 
    870  
    871                 // 1 = GIF, 2 = JPEG, 3 = PNG 
    872  
    873         if ( file_exists( $file ) ) { 
    874                 $type = getimagesize( $file ); 
    875  
    876                 // if the associated function doesn't exist - then it's not 
    877                 // handle. duh. i hope. 
    878  
    879                 if (!function_exists( 'imagegif' ) && $type[2] == 1 ) { 
    880                         $error = __( 'Filetype not supported. Thumbnail not created.' ); 
    881                 } 
    882                 elseif (!function_exists( 'imagejpeg' ) && $type[2] == 2 ) { 
    883                         $error = __( 'Filetype not supported. Thumbnail not created.' ); 
    884                 } 
    885                 elseif (!function_exists( 'imagepng' ) && $type[2] == 3 ) { 
    886                         $error = __( 'Filetype not supported. Thumbnail not created.' ); 
    887                 } else { 
    888  
    889                         // create the initial copy from the original file 
    890                         if ( $type[2] == 1 ) { 
    891                                 $image = imagecreatefromgif( $file ); 
    892                         } 
    893                         elseif ( $type[2] == 2 ) { 
    894                                 $image = imagecreatefromjpeg( $file ); 
    895                         } 
    896                         elseif ( $type[2] == 3 ) { 
    897                                 $image = imagecreatefrompng( $file ); 
    898                         } 
    899  
    900                         if ( function_exists( 'imageantialias' )) 
    901                                 imageantialias( $image, TRUE ); 
    902  
    903                         $image_attr = getimagesize( $file ); 
    904  
    905                         // figure out the longest side 
    906  
    907                         if ( $image_attr[0] > $image_attr[1] ) { 
    908                                 $image_width = $image_attr[0]; 
    909                                 $image_height = $image_attr[1]; 
    910                                 $image_new_width = $max_side; 
    911  
    912                                 $image_ratio = $image_width / $image_new_width; 
    913                                 $image_new_height = $image_height / $image_ratio; 
    914                                 //width is > height 
    915                         } else { 
    916                                 $image_width = $image_attr[0]; 
    917                                 $image_height = $image_attr[1]; 
    918                                 $image_new_height = $max_side; 
    919  
    920                                 $image_ratio = $image_height / $image_new_height; 
    921                                 $image_new_width = $image_width / $image_ratio; 
    922                                 //height > width 
    923                         } 
    924  
    925                         $thumbnail = imagecreatetruecolor( $image_new_width, $image_new_height); 
    926                         @ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1] ); 
    927  
    928                         // If no filters change the filename, we'll do a default transformation. 
    929                         if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) ) 
    930                                 $thumb = preg_replace( '!(\.[^.]+)?$!', __( '.thumbnail' ).'$1', basename( $file ), 1 ); 
    931  
    932                         $thumbpath = str_replace( basename( $file ), $thumb, $file ); 
    933  
    934                         // move the thumbnail to it's final destination 
    935                         if ( $type[2] == 1 ) { 
    936                                 if (!imagegif( $thumbnail, $thumbpath ) ) { 
    937                                         $error = __( "Thumbnail path invalid" ); 
    938                                 } 
    939                         } 
    940                         elseif ( $type[2] == 2 ) { 
    941                                 if (!imagejpeg( $thumbnail, $thumbpath ) ) { 
    942                                         $error = __( "Thumbnail path invalid" ); 
    943                                 } 
    944                         } 
    945                         elseif ( $type[2] == 3 ) { 
    946                                 if (!imagepng( $thumbnail, $thumbpath ) ) { 
    947                                         $error = __( "Thumbnail path invalid" ); 
    948                                 } 
    949                         } 
    950  
    951                 } 
    952         } else { 
    953                 $error = __( 'File not found' ); 
    954         } 
    955  
    956         if (!empty ( $error ) ) { 
    957                 return $error; 
    958         } else { 
    959                 apply_filters( 'wp_create_thumbnail', $thumbpath ); 
    960                 return $thumbpath; 
    961866        } 
    962867} 
     
    20931998 
    20941999 
    2095 function wp_check_for_changed_slugs($post_id) { 
    2096         if ( !strlen($_POST['wp-old-slug']) ) 
    2097                 return $post_id; 
    2098  
    2099         $post = &get_post($post_id); 
    2100  
    2101         // we're only concerned with published posts 
    2102         if ( $post->post_status != 'publish' || $post->post_type != 'post' ) 
    2103                 return $post_id; 
    2104  
    2105         // only bother if the slug has changed 
    2106         if ( $post->post_name == $_POST['wp-old-slug'] ) 
    2107                 return $post_id; 
    2108  
    2109         $old_slugs = (array) get_post_meta($post_id, '_wp_old_slug'); 
    2110  
    2111         // if we haven't added this old slug before, add it now 
    2112         if ( !count($old_slugs) || !in_array($_POST['wp-old-slug'], $old_slugs) ) 
    2113                 add_post_meta($post_id, '_wp_old_slug', $_POST['wp-old-slug']); 
    2114  
    2115         // if the new slug was used previously, delete it from the list 
    2116         if ( in_array($post->post_name, $old_slugs) ) 
    2117                 delete_post_meta($post_id, '_wp_old_slug', $post->post_name); 
    2118  
    2119         return $post_id; 
    2120 } 
    2121  
    2122  
    21232000function wp_remember_old_slug() { 
    21242001        global $post; 
  • trunk/wp-admin/upload-functions.php

    r819 r823  
    221221                $id = wp_insert_attachment($attachment, $file, $post_id); 
    222222 
    223                 if ( preg_match('!^image/!', $attachment['post_mime_type']) ) { 
    224                         // Generate the attachment's postmeta. 
    225                         $imagesize = getimagesize($file); 
    226                         $imagedata['width'] = $imagesize['0']; 
    227                         $imagedata['height'] = $imagesize['1']; 
    228                         list($uwidth, $uheight) = get_udims($imagedata['width'], $imagedata['height']); 
    229                         $imagedata['hwstring_small'] = "height='$uheight' width='$uwidth'"; 
    230                         $imagedata['file'] = $file; 
    231  
    232                         wp_update_attachment_metadata( $id, $imagedata ); 
    233  
    234                         if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) { 
    235                                 if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 ) 
    236                                         $thumb = wp_create_thumbnail($file, 128); 
    237                                 elseif ( $imagedata['height'] > 96 ) 
    238                                         $thumb = wp_create_thumbnail($file, 96); 
    239  
    240                                 if ( @file_exists($thumb) ) { 
    241                                         $newdata = $imagedata; 
    242                                         $newdata['thumb'] = basename($thumb); 
    243                                         wp_update_attachment_metadata( $id, $newdata ); 
    244                                 } else { 
    245                                         $error = $thumb; 
    246                                 } 
    247                         } 
    248                 } else { 
    249                         wp_update_attachment_metadata( $id, array() ); 
    250                 } 
     223                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); 
    251224 
    252225                wp_redirect( get_option('siteurl') . "/wp-admin/upload.php?style=$style&tab=browse&action=view&ID=$id&post_id=$post_id"); 
  • trunk/wp-commentsrss2.php

    r816 r823  
    7777                        <?php 
    7878                        } // close check for password 
     79                        do_action('commentrss2_item', $comment->comment_ID, $comment->comment_post_ID); 
    7980                        ?> 
    8081        </item> 
  • trunk/wp-includes/category.php

    r811 r823  
    112112        if ( $hierarchical ) { 
    113113                foreach ( $categories as $k => $category ) { 
    114                         $progeny = $category->category_count; 
     114                        $progeny = 'link' == $type ? $category->link_count : $category->category_count; 
    115115                        if ( $children = _get_cat_children($category->cat_ID, $categories) ) { 
    116116                                foreach ( $children as $child ) 
    117                                         $progeny += $child->category_count; 
     117                                        $progeny += 'link' == $type ? $child->link_count : $child->category_count; 
    118118                        } 
    119119                        if ( !$progeny && $hide_empty ) 
    120120                                unset($categories[$k]); 
    121121                        else 
    122                                 $categories[$k]->category_count = $progeny; 
     122                                $categories[$k]->{'link' == $type ? 'link_count' : 'category_count'} = $progeny; 
    123123                } 
    124124        } 
     
    130130        return apply_filters('get_categories', $categories, $r); 
    131131} 
    132  
    133 function delete_get_categories_cache() { 
    134         wp_cache_delete('get_categories', 'category'); 
    135 } 
    136 add_action( 'wp_insert_post', 'delete_get_categories_cache' ); 
    137 add_action( 'edit_category', 'delete_get_categories_cache' ); 
    138 add_action( 'add_category', 'delete_get_categories_cache' ); 
    139 add_action( 'delete_category', 'delete_get_categories_cache' ); 
    140132 
    141133// Retrieves category data given a category ID or category object. 
     
    178170        $leaf_path  = sanitize_title(basename($category_paths)); 
    179171        $category_paths = explode('/', $category_paths); 
    180         foreach($category_paths as $pathdir) 
    181                 $full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir); 
     172        $full_path = ''; 
     173        foreach ( (array) $category_paths as $pathdir ) 
     174                $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir); 
    182175 
    183176        $categories = $wpdb->get_results("SELECT cat_ID, category_nicename, category_parent FROM $wpdb->categories WHERE category_nicename = '$leaf_path'"); 
  • trunk/wp-includes/comment.php

    r821 r823  
    433433        } 
    434434 
    435         if ( $wpdb->query($query) ) { 
    436                 do_action('wp_set_comment_status', $comment_id, $comment_status); 
    437  
    438                 $comment = get_comment($comment_id); 
    439                 $comment_post_ID = $comment->comment_post_ID; 
    440                 $c = $wpdb->get_row("SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'"); 
    441                 if ( is_object($c) ) 
    442                         $wpdb->query("UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'"); 
    443                 return true; 
    444         } else { 
     435        if ( !$wpdb->query($query) ) 
    445436                return false; 
    446         } 
     437 
     438        do_action('wp_set_comment_status', $comment_id, $comment_status); 
     439        $comment = get_comment($comment_id); 
     440        wp_update_comment_count($comment->comment_post_ID); 
     441        return true; 
    447442} 
    448443 
     
    493488        $wpdb->query("UPDATE $wpdb->posts SET comment_count = $count WHERE ID = '$post_id'"); 
    494489        $comment_count_cache[$post_id] = $count; 
     490 
     491        $post = get_post($post_id); 
     492        if ( 'page' == $post->post_type ) 
     493                clean_page_cache( $post_id ); 
     494        else 
     495                clean_post_cache( $post_id ); 
     496 
     497        do_action('edit_post', $post_id); 
     498 
    495499        return true; 
    496500} 
  • trunk/wp-includes/functions.php

    r810 r823  
    537537 
    538538function clean_post_cache($id) { 
    539         global $post_cache, $blog_id; 
     539        global $post_cache, $post_meta_cache, $category_cache, $blog_id; 
    540540 
    541541        if ( isset( $post_cache[$blog_id][$id] ) ) 
    542542                unset( $post_cache[$blog_id][$id] ); 
     543 
     544        if ( isset ($post_meta_cache[$blog_id][$id] ) ) 
     545                unset( $post_meta_cache[$blog_id][$id] ); 
     546 
     547        if ( isset( $category_cache[$blog_id][$id]) ) 
     548                unset ( $category_cache[$blog_id][$id] ); 
    543549} 
    544550 
     
    555561} 
    556562 
    557  
    558563function clean_page_cache($id) { 
    559         global $page_cache, $wpdb, $blog_id; 
     564        global $page_cache, $blog_id; 
    560565 
    561566        if ( isset( $page_cache[$blog_id][$id] ) ) 
    562567                unset( $page_cache[$blog_id][$id] ); 
    563568 
    564         $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type='page'"); 
    565         wp_cache_delete('all_page_ids','pages'); 
    566          
     569        wp_cache_delete($id, 'pages'); 
     570        wp_cache_delete( 'all_page_ids', 'pages' ); 
     571        wp_cache_delete( 'get_pages', 'page' ); 
    567572} 
    568573 
     
    669674function update_category_cache() { 
    670675        return true; 
     676} 
     677 
     678function clean_category_cache($id) { 
     679        wp_cache_delete($id, 'category'); 
     680        wp_cache_delete('all_category_ids', 'category'); 
     681        wp_cache_delete('get_categories', 'category'); 
    671682} 
    672683 
     
    11181129} 
    11191130 
     1131function wp_generate_attachment_metadata( $attachment_id, $file ) { 
     1132        $attachment = get_post( $attachment_id ); 
     1133 
     1134        $metadata = array(); 
     1135        if ( preg_match('!^image/!', get_post_mime_type( $attachment )) ) { 
     1136                $imagesize = getimagesize($file); 
     1137                $metadata['width'] = $imagesize['0']; 
     1138                $metadata['height'] = $imagesize['1']; 
     1139                list($uwidth, $uheight) = get_udims($metadata['width'], $metadata['height']); 
     1140                $metadata['hwstring_small'] = "height='$uheight' width='$uwidth'"; 
     1141                $metadata['file'] = $file; 
     1142 
     1143                if ( $metadata['width'] * $metadata['height'] < 3 * 1024 * 1024 ) { 
     1144                        if ( $metadata['width'] > 128 && $metadata['width'] >= $metadata['height'] * 4 / 3 ) 
     1145                                $thumb = wp_create_thumbnail($file, 128); 
     1146                        elseif ( $metadata['height'] > 96 ) 
     1147                                $thumb = wp_create_thumbnail($file, 96); 
     1148 
     1149                        if ( @file_exists($thumb) ) 
     1150                                $metadata['thumb'] = basename($thumb); 
     1151                } 
     1152        } 
     1153        return apply_filters( 'wp_generate_attachment_metadata', $metadata ); 
     1154} 
     1155 
     1156function wp_create_thumbnail( $file, $max_side, $effect = '' ) { 
     1157 
     1158                // 1 = GIF, 2 = JPEG, 3 = PNG 
     1159 
     1160        if ( file_exists( $file ) ) { 
     1161                $type = getimagesize( $file ); 
     1162 
     1163                // if the associated function doesn't exist - then it's not 
     1164                // handle. duh. i hope. 
     1165 
     1166                if (!function_exists( 'imagegif' ) && $type[2] == 1 ) { 
     1167                        $error = __( 'Filetype not supported. Thumbnail not created.' ); 
     1168                } 
     1169                elseif (!function_exists( 'imagejpeg' ) && $type[2] == 2 ) { 
     1170                        $error = __( 'Filetype not supported. Thumbnail not created.' ); 
     1171                } 
     1172                elseif (!function_exists( 'imagepng' ) && $type[2] == 3 ) { 
     1173                        $error = __( 'Filetype not supported. Thumbnail not created.' ); 
     1174                } else { 
     1175 
     1176                        // create the initial copy from the original file 
     1177                        if ( $type[2] == 1 ) { 
     1178                                $image = imagecreatefromgif( $file ); 
     1179                        } 
     1180                        elseif ( $type[2] == 2 ) { 
     1181                                $image = imagecreatefromjpeg( $file ); 
     1182                        } 
     1183                        elseif ( $type[2] == 3 ) { 
     1184                                $image = imagecreatefrompng( $file ); 
     1185                        } 
     1186 
     1187                        if ( function_exists( 'imageantialias' )) 
     1188                                imageantialias( $image, TRUE ); 
     1189 
     1190                        $image_attr = getimagesize( $file ); 
     1191 
     1192                        // figure out the longest side 
     1193 
     1194                        if ( $image_attr[0] > $image_attr[1] ) { 
     1195                                $image_width = $image_attr[0]; 
     1196                                $image_height = $image_attr[1]; 
     1197                                $image_new_width = $max_side; 
     1198 
     1199                                $image_ratio = $image_width / $image_new_width; 
     1200                                $image_new_height = $image_height / $image_ratio; 
     1201                                //width is > height 
     1202                        } else { 
     1203                                $image_width = $image_attr[0]; 
     1204                                $image_height = $image_attr[1]; 
     1205                                $image_new_height = $max_side; 
     1206 
     1207                                $image_ratio = $image_height / $image_new_height; 
     1208                                $image_new_width = $image_width / $image_ratio; 
     1209                                //height > width 
     1210                        } 
     1211 
     1212                        $thumbnail = imagecreatetruecolor( $image_new_width, $image_new_height); 
     1213                        @ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1] ); 
     1214 
     1215                        // If no filters change the filename, we'll do a default transformation. 
     1216                        if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) ) 
     1217                                $thumb = preg_replace( '!(\.[^.]+)?$!', __( '.thumbnail' ).'$1', basename( $file ), 1 ); 
     1218 
     1219                        $thumbpath = str_replace( basename( $file ), $thumb, $file ); 
     1220 
     1221                        // move the thumbnail to it's final destination 
     1222                        if ( $type[2] == 1 ) { 
     1223                                if (!imagegif( $thumbnail, $thumbpath ) ) { 
     1224                                        $error = __( "Thumbnail path invalid" ); 
     1225                                } 
     1226                        } 
     1227                        elseif ( $type[2] == 2 ) { 
     1228                                if (!imagejpeg( $thumbnail, $thumbpath ) ) { 
     1229                                        $error = __( "Thumbnail path invalid" ); 
     1230                                } 
     1231                        } 
     1232                        elseif ( $type[2] == 3 ) { 
     1233                                if (!imagepng( $thumbnail, $thumbpath ) ) { 
     1234                                        $error = __( "Thumbnail path invalid" ); 
     1235                                } 
     1236                        } 
     1237 
     1238                } 
     1239        } else { 
     1240                $error = __( 'File not found' ); 
     1241        } 
     1242 
     1243        if (!empty ( $error ) ) { 
     1244                return $error; 
     1245        } else { 
     1246                apply_filters( 'wp_create_thumbnail', $thumbpath ); 
     1247                return $thumbpath; 
     1248        } 
     1249} 
     1250 
    11201251function wp_explain_nonce($action) { 
    11211252        if ( $action !== -1 && preg_match('/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches) ) { 
  • trunk/wp-includes/general-template.php

    r821 r823  
    369369                        foreach ( $arcresults as $arcresult ) { 
    370370                                $url    = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth); 
    371                                 $date = sprintf(__('%1$d-%2$02d-%3$02d 00:00:00'), $arcresult->year, $arcresult->month, $arcresult->dayofmonth); 
     371                                $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth); 
    372372                                $text = mysql2date($archive_day_date_format, $date); 
    373373                                if ($show_post_count) 
     
    389389                                                $arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']); 
    390390                                                $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']); 
    391                                                 $url  = sprintf(__('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d'), get_option('home'), '', '?', '=', $arc_year, '&amp;', '=', $arcresult->week); 
     391                                                $url  = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', get_option('home'), '', '?', '=', $arc_year, '&amp;', '=', $arcresult->week); 
    392392                                                $text = $arc_week_start . $archive_week_separator . $arc_week_end; 
    393393                                                if ($show_post_count) 
  • trunk/wp-includes/post.php

    r821 r823  
    439439 
    440440        if ( 'page' == $post->post_type ) { 
    441                 wp_cache_delete( 'all_page_ids', 'pages' ); 
    442                 wp_cache_delete( 'get_pages', 'page' ); 
     441                clean_page_cache($postid); 
    443442                $wp_rewrite->flush_rules(); 
    444443        } 
     
    653652        if ( 'page' == $post_type ) { 
    654653                clean_page_cache($post_ID); 
    655                 wp_cache_delete($post_ID, 'pages'); 
     654                $wp_rewrite->flush_rules(); 
    656655        } else { 
    657656                clean_post_cache($post_ID); 
     
    692691                } 
    693692        } else if ($post_type == 'page') { 
    694                 wp_cache_delete( 'all_page_ids', 'pages' ); 
    695                 wp_cache_delete( 'get_pages', 'page' ); 
    696                 $wp_rewrite->flush_rules(); 
    697  
    698693                if ( !empty($page_template) ) 
    699694                        if ( ! update_post_meta($post_ID, '_wp_page_template',  $page_template)) 
     
    819814                $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status = 'publish' AND post_type = 'post' AND category_id = '$cat_id'"); 
    820815                $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); 
    821                 wp_cache_delete($cat_id, 'category'); 
     816                clean_category_cache($cat_id); 
    822817                do_action('edit_category', $cat_id); 
    823818        } 
    824  
    825         wp_cache_delete('get_categories', 'category'); 
    826  
    827         do_action('edit_post', $post_ID); 
    828819}       // wp_set_post_categories() 
    829820 
     
    11641155        return $pages; 
    11651156} 
    1166  
    1167 function delete_get_pages_cache() { 
    1168         wp_cache_delete( 'get_pages', 'page' ); 
    1169 } 
    1170 add_action( 'save_post', 'delete_get_pages_cache' ); 
    11711157 
    11721158function generate_page_uri_index() { 
     
    14401426} 
    14411427 
     1428function wp_check_for_changed_slugs($post_id) { 
     1429        if ( !strlen($_POST['wp-old-slug']) ) 
     1430                return $post_id; 
     1431 
     1432        $post = &get_post($post_id); 
     1433 
     1434        // we're only concerned with published posts 
     1435        if ( $post->post_status != 'publish' || $post->post_type != 'post' ) 
     1436                return $post_id; 
     1437 
     1438        // only bother if the slug has changed 
     1439        if ( $post->post_name == $_POST['wp-old-slug'] ) 
     1440                return $post_id; 
     1441 
     1442        $old_slugs = (array) get_post_meta($post_id, '_wp_old_slug'); 
     1443 
     1444        // if we haven't added this old slug before, add it now 
     1445        if ( !count($old_slugs) || !in_array($_POST['wp-old-slug'], $old_slugs) ) 
     1446                add_post_meta($post_id, '_wp_old_slug', $_POST['wp-old-slug']); 
     1447 
     1448        // if the new slug was used previously, delete it from the list 
     1449        if ( in_array($post->post_name, $old_slugs) ) 
     1450                delete_post_meta($post_id, '_wp_old_slug', $post->post_name); 
     1451 
     1452        return $post_id; 
     1453} 
     1454 
    14421455?> 
  • trunk/wp-includes/query.php

    r821 r823  
    820820                        $q['category_name'] = sanitize_title(basename($cat_paths)); 
    821821                        $cat_paths = explode('/', $cat_paths); 
    822                         foreach($cat_paths as $pathdir) 
    823                                 $cat_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir); 
     822                        $cat_path = ''; 
     823                        foreach ( (array) $cat_paths as $pathdir ) 
     824                                $cat_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir); 
    824825 
    825826                        //if we don't match the entire hierarchy fallback on just matching the nicename 
  • trunk/wp-includes/script-loader.php

    r819 r823  
    2323                $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4459'); 
    2424                $this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4583'); 
     25                $this->add( 'scriptaculous', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.6.1'); 
     26                $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/scriptaculous.js?load=builder,dragdrop', array('prototype'), '1.6.1'); 
     27                $this->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/scriptaculous.js?load=slider,effects', array('prototype'), '1.6.1'); 
     28                $this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/scriptaculous.js?load=controls', array('prototype'), '1.6.1'); 
     29                $this->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '1'); 
    2530                if ( is_admin() ) { 
    2631                        $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' ); 
  • trunk/xmlrpc.php

    r819 r823  
    883883                // Save the data 
    884884                $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id ); 
    885                 wp_update_attachment_metadata( $id, array() ); 
     885                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); 
    886886 
    887887                return apply_filters( 'wp_handle_upload', array( 'file' => $upload[ 'file' ], 'url' => $upload[ 'url' ], 'type' => $type ) );