Commit 0544d005 authored by Dries's avatar Dries

- Made node_comment_mode() cache the mode when possible.  Patch from Marco's
  sandbox.
parent d1b2125b
......@@ -363,7 +363,11 @@ function node_filter_line($text) {
}
function node_comment_mode($nid) {
return db_result(db_query("SELECT comment FROM node WHERE nid = '%s'", $nid));
static $comment_mode;
if (!isset($comment_mode[$nid])) {
$comment_mode[$nid] = db_result(db_query("SELECT comment FROM node WHERE nid = '%s'", $nid));
}
return $comment_mode[$nid];
}
function node_filter($text) {
......
......@@ -363,7 +363,11 @@ function node_filter_line($text) {
}
function node_comment_mode($nid) {
return db_result(db_query("SELECT comment FROM node WHERE nid = '%s'", $nid));
static $comment_mode;
if (!isset($comment_mode[$nid])) {
$comment_mode[$nid] = db_result(db_query("SELECT comment FROM node WHERE nid = '%s'", $nid));
}
return $comment_mode[$nid];
}
function node_filter($text) {
......
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