Commit 5ac59aac authored by Dries's avatar Dries

- Applied patch #4949: node_prepare() wastes resources.  Patch by Goba.
parent 6f80df77
......@@ -219,8 +219,8 @@ function blog_page() {
}
function blog_content($node) {
return node_prepare($node);
function blog_content($node, $main = 0) {
return node_prepare($node, $main);
}
function blog_view($node, $main = 0, $page = 0) {
......@@ -233,7 +233,7 @@ function blog_view($node, $main = 0, $page = 0) {
drupal_set_breadcrumb($breadcrumb);
}
// prepare the node content
$node = blog_content($node);
$node = blog_content($node, $main);
// print the node
return theme("node", $node, $main, $page);
}
......
......@@ -219,8 +219,8 @@ function blog_page() {
}
function blog_content($node) {
return node_prepare($node);
function blog_content($node, $main = 0) {
return node_prepare($node, $main);
}
function blog_view($node, $main = 0, $page = 0) {
......@@ -233,7 +233,7 @@ function blog_view($node, $main = 0, $page = 0) {
drupal_set_breadcrumb($breadcrumb);
}
// prepare the node content
$node = blog_content($node);
$node = blog_content($node, $main);
// print the node
return theme("node", $node, $main, $page);
}
......
......@@ -342,7 +342,7 @@ function book_next($node) {
}
}
function book_content($node) {
function book_content($node, $main = 0) {
$op = $_POST["op"];
/*
......@@ -376,14 +376,14 @@ function book_content($node) {
ob_end_clean();
}
else {
$node = node_prepare($node);
$node = node_prepare($node, $main);
}
return $node;
}
function book_view($node, $main = 0, $page = 0) {
$node = book_content($node);
$node = book_content($node, $main);
/*
** Display the node. If not displayed on the main page, we render
** the node as a page in the book with extra links to the previous
......
......@@ -342,7 +342,7 @@ function book_next($node) {
}
}
function book_content($node) {
function book_content($node, $main = 0) {
$op = $_POST["op"];
/*
......@@ -376,14 +376,14 @@ function book_content($node) {
ob_end_clean();
}
else {
$node = node_prepare($node);
$node = node_prepare($node, $main);
}
return $node;
}
function book_view($node, $main = 0, $page = 0) {
$node = book_content($node);
$node = book_content($node, $main);
/*
** Display the node. If not displayed on the main page, we render
** the node as a page in the book with extra links to the previous
......
......@@ -140,8 +140,8 @@ function forum_link($type, $node = 0, $main = 0) {
return $links;
}
function forum_content($node) {
return node_prepare($node);
function forum_content($node, $main = 0) {
return node_prepare($node, $main);
}
function forum_view($node, $main = 0, $page = 0) {
......@@ -164,7 +164,7 @@ function forum_view($node, $main = 0, $page = 0) {
drupal_set_breadcrumb($breadcrumb);
}
return theme("node", forum_content($node), $main, $page);
return theme("node", forum_content($node, $main), $main, $page);
}
function forum_validate(&$node) {
......
......@@ -140,8 +140,8 @@ function forum_link($type, $node = 0, $main = 0) {
return $links;
}
function forum_content($node) {
return node_prepare($node);
function forum_content($node, $main = 0) {
return node_prepare($node, $main);
}
function forum_view($node, $main = 0, $page = 0) {
......@@ -164,7 +164,7 @@ function forum_view($node, $main = 0, $page = 0) {
drupal_set_breadcrumb($breadcrumb);
}
return theme("node", forum_content($node), $main, $page);
return theme("node", forum_content($node, $main), $main, $page);
}
function forum_validate(&$node) {
......
......@@ -411,18 +411,16 @@ function node_view($node, $main = 0, $page = 0) {
** Default behavior:
*/
return theme("node", node_prepare($node), $main, $page);
return theme("node", node_prepare($node, $main), $main, $page);
}
}
function node_prepare($node) {
if ($node->teaser == $node->body) {
// Only invoke check_output() once for performance's sake:
$node->teaser = $node->body = check_output($node->teaser);
function node_prepare($node, $main = 0) {
if ($main == 0) {
$node->body = check_output($node->body);
}
else {
$node->teaser = check_output($node->teaser);
$node->body = check_output($node->body);
}
return $node;
}
......
......@@ -411,18 +411,16 @@ function node_view($node, $main = 0, $page = 0) {
** Default behavior:
*/
return theme("node", node_prepare($node), $main, $page);
return theme("node", node_prepare($node, $main), $main, $page);
}
}
function node_prepare($node) {
if ($node->teaser == $node->body) {
// Only invoke check_output() once for performance's sake:
$node->teaser = $node->body = check_output($node->teaser);
function node_prepare($node, $main = 0) {
if ($main == 0) {
$node->body = check_output($node->body);
}
else {
$node->teaser = check_output($node->teaser);
$node->body = check_output($node->body);
}
return $node;
}
......
......@@ -96,7 +96,7 @@ function page_link($type) {
return $links;
}
function page_content($node) {
function page_content($node, $main = 0) {
/*
** Extract the page body. If body is dynamic (using PHP code), the body
** will be generated.
......@@ -104,7 +104,7 @@ function page_content($node) {
if ($node->format == 0) {
// HTML type
$node = node_prepare($node);
$node = node_prepare($node, $main);
}
else {
// PHP type
......@@ -118,7 +118,7 @@ function page_content($node) {
function page_view($node, $main = 0, $page = 0) {
// prepare the node content
$node = page_content($node);
$node = page_content($node, $main);
// print the node
return theme("node", $node, $main, $page);
}
......
......@@ -96,7 +96,7 @@ function page_link($type) {
return $links;
}
function page_content($node) {
function page_content($node, $main = 0) {
/*
** Extract the page body. If body is dynamic (using PHP code), the body
** will be generated.
......@@ -104,7 +104,7 @@ function page_content($node) {
if ($node->format == 0) {
// HTML type
$node = node_prepare($node);
$node = node_prepare($node, $main);
}
else {
// PHP type
......@@ -118,7 +118,7 @@ function page_content($node) {
function page_view($node, $main = 0, $page = 0) {
// prepare the node content
$node = page_content($node);
$node = page_content($node, $main);
// print the node
return theme("node", $node, $main, $page);
}
......
......@@ -90,7 +90,7 @@ function story_form(&$node, &$help, &$error) {
return $output;
}
function story_content($node) {
return node_prepare($node);
function story_content($node, $main = 0) {
return node_prepare($node, $main);
}
?>
......@@ -90,7 +90,7 @@ function story_form(&$node, &$help, &$error) {
return $output;
}
function story_content($node) {
return node_prepare($node);
function story_content($node, $main = 0) {
return node_prepare($node, $main);
}
?>
......@@ -242,7 +242,7 @@ table {
/*
** Module specific styles
*/
#aggregator .info {
#aggregator .feed {
background-color: #eee;
border: 1px solid #ccc;
padding: 1em;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment