mirror of
git://develop.git.wordpress.org/
synced 2025-01-19 05:38:07 +01:00
Page caching fixes. Mosquito bugs 920, 927, and 934.
git-svn-id: https://develop.svn.wordpress.org/trunk@2421 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d2b598c1c3
commit
3bacf431ae
@ -997,8 +997,11 @@ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args
|
|||||||
function get_page_uri($page_id) {
|
function get_page_uri($page_id) {
|
||||||
global $wpdb, $cache_pages;
|
global $wpdb, $cache_pages;
|
||||||
|
|
||||||
|
$dates = ",UNIX_TIMESTAMP(post_modified) AS time_modified";
|
||||||
|
$dates .= ",UNIX_TIMESTAMP(post_date) AS time_created";
|
||||||
|
|
||||||
if (!isset($cache_pages[$page_id])) {
|
if (!isset($cache_pages[$page_id])) {
|
||||||
$cache_pages[$page_id] = $wpdb->get_row("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = '$page_id'");
|
$cache_pages[$page_id] = $wpdb->get_row("SELECT ID, post_title, post_name, post_parent $dates FROM $wpdb->posts WHERE ID = '$page_id'");
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = $cache_pages[$page_id];
|
$page = $cache_pages[$page_id];
|
||||||
@ -1010,7 +1013,12 @@ function get_page_uri($page_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while ($page->post_parent != 0) {
|
while ($page->post_parent != 0) {
|
||||||
$page = $wpdb->get_row("SELECT post_name, post_parent FROM $wpdb->posts WHERE ID = '$page->post_parent'");
|
if (isset($cache_pages[$page->post_parent])) {
|
||||||
|
$page = $cache_pages[$page->post_parent];
|
||||||
|
} else {
|
||||||
|
$page = $wpdb->get_row("SELECT ID, post_title, post_name, post_parent $dates FROM $wpdb->posts WHERE ID = '$page->post_parent'");
|
||||||
|
$cache_pages[$page->ID] = $page;
|
||||||
|
}
|
||||||
$uri = urldecode($page->post_name) . "/" . $uri;
|
$uri = urldecode($page->post_name) . "/" . $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,8 +264,6 @@ function the_meta() {
|
|||||||
function get_pages($args = '') {
|
function get_pages($args = '') {
|
||||||
global $wpdb, $cache_pages;
|
global $wpdb, $cache_pages;
|
||||||
|
|
||||||
if (!isset($cache_pages) || empty($cache_pages)) {
|
|
||||||
|
|
||||||
parse_str($args, $r);
|
parse_str($args, $r);
|
||||||
|
|
||||||
if (!isset($r['child_of'])) $r['child_of'] = 0;
|
if (!isset($r['child_of'])) $r['child_of'] = 0;
|
||||||
@ -299,15 +297,17 @@ function get_pages($args = '') {
|
|||||||
"$exclusions " .
|
"$exclusions " .
|
||||||
"ORDER BY " . $r['sort_column'] . " " . $r['sort_order']);
|
"ORDER BY " . $r['sort_column'] . " " . $r['sort_order']);
|
||||||
|
|
||||||
$cache_pages = array();
|
// Update page cache.
|
||||||
if (count($pages)) {
|
if (count($pages)) {
|
||||||
foreach($pages as $page) {
|
foreach($pages as $page) {
|
||||||
$cache_pages[$page->ID] = $page;
|
$cache_pages[$page->ID] = $page;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $cache_pages;
|
if ( empty($pages) )
|
||||||
|
$pages = array();
|
||||||
|
|
||||||
|
return $pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
function wp_list_pages($args = '') {
|
function wp_list_pages($args = '') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user