summaryrefslogtreecommitdiff
path: root/modules/blogapi/blogapi.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-08-30 15:22:29 +0000
committerDries Buytaert <dries@buytaert.net>2005-08-30 15:22:29 +0000
commitd9d6a6e05c7a3c9d55e0e143e23489d7ed64be4b (patch)
tree71f531bfe2bc3663ecca9138475ae5c34fd72f82 /modules/blogapi/blogapi.module
parent7e5d0c947a23c0931614b167b7107c97cdd82136 (diff)
downloadbrdo-d9d6a6e05c7a3c9d55e0e143e23489d7ed64be4b.tar.gz
brdo-d9d6a6e05c7a3c9d55e0e143e23489d7ed64be4b.tar.bz2
- Patch #7582 by Gerhard: improved node revisions!
All node revisions were stored in a serialized field in the node table and retrieved for _each_ page view although they are rarely needed. We created a separate revisions table which would be in principle identical to the node table, only that it could have several old copies of the same node. This also allows us to revision-related information, and to provide log entries to non-book pages when a new revision is being created. TODO: 1. Provide upgrade instructions for node module maintainers! 2. Upgrade modules that implement node types. 3. Provide an upgarde path for revisions. Dependency on the upgrade system.
Diffstat (limited to 'modules/blogapi/blogapi.module')
-rw-r--r--modules/blogapi/blogapi.module19
1 files changed, 12 insertions, 7 deletions
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index f42036d0e..3160539db 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -218,9 +218,9 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
return blogapi_error(t('You do not have permission to create the type of post you wanted to create.'));
}
- $nid = node_save($node);
- if ($nid) {
- watchdog('content', t('%type: added %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$nid"));
+ node_save(&$node);
+ if ($node->nid) {
+ watchdog('content', t('%type: added %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
return $nid;
}
@@ -276,9 +276,9 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont
foreach ($terms as $term) {
$node->taxonomy[] = $term->tid;
}
- $nid = node_save($node);
- if ($nid) {
- watchdog('content', t('%type: updated %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$nid"));
+ node_save(&$node);
+ if ($node->nid) {
+ watchdog('content', t('%type: updated %title using blog API.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
return true;
}
@@ -325,7 +325,12 @@ function blogapi_blogger_get_recent_posts($appkey, $blogid, $username, $password
}
$type = _blogapi_blogid($blogid);
- $result = db_query_range('SELECT n.nid, n.title,'. ($bodies ? ' n.body,' : '') ." n.created, u.name FROM {node} n, {users} u WHERE n.uid=u.uid AND n.type = '%s' AND n.uid = %d ORDER BY n.created DESC", $type, $user->uid, 0, $number_of_posts);
+ if ($bodies) {
+ $result = db_query_range("SELECT n.nid, n.title, r.body, n.created, u.name FROM {node} n, {node_revisions} r, {users} u WHERE n.uid = u.uid AND n.vid = r.vid AND n.type = '%s' AND n.uid = %d ORDER BY n.created DESC", $type, $user->uid, 0, $number_of_posts);
+ }
+ else {
+ $result = db_query_range("SELECT n.nid, n.title, n.created, u.name FROM {node} n, {users} u WHERE n.uid = u.uid AND n.type = '%s' AND n.uid = %d ORDER BY n.created DESC", $type, $user->uid, 0, $number_of_posts);
+ }
while ($blog = db_fetch_object($result)) {
$blogs[] = _blogapi_get_post($blog, $bodies);
}