diff options
Diffstat (limited to 'mod/blog')
-rw-r--r-- | mod/blog/lib/blog.php | 3 | ||||
-rw-r--r-- | mod/blog/start.php | 34 |
2 files changed, 32 insertions, 5 deletions
diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php index b7b1a2baa..f24e6f58d 100644 --- a/mod/blog/lib/blog.php +++ b/mod/blog/lib/blog.php @@ -67,6 +67,9 @@ function blog_get_page_content_list($container_guid = NULL) { $loggedin_userid = elgg_get_logged_in_user_guid(); if ($container_guid) { + // access check for closed groups + group_gatekeeper(); + $options['container_guid'] = $container_guid; $container = get_entity($container_guid); if (!$container) { diff --git a/mod/blog/start.php b/mod/blog/start.php index b9911aa74..2d8f75ed2 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -225,11 +225,35 @@ function blog_ecml_views_hook($hook, $entity_type, $return_value, $params) { } /** - * When upgrading, check if the ElggBlog class has been registered as this - * was added in Elgg 1.8 + * Upgrade from 1.7 to 1.8. */ -function blog_run_upgrades() { - if (!update_subtype('object', 'blog', 'ElggBlog')) { - add_subtype('object', 'blog', 'ElggBlog'); +function blog_run_upgrades($event, $type, $details) { + $blog_upgrade_version = get_plugin_setting('upgrade_version', 'blogs'); + + if (!$blog_upgrade_version) { + // When upgrading, check if the ElggBlog class has been registered as this + // was added in Elgg 1.8 + if (!update_subtype('object', 'blog', 'ElggBlog')) { + add_subtype('object', 'blog', 'ElggBlog'); + } + + // only run this on the first migration to 1.8 + // add excerpt to all blogs that don't have it. + $ia = elgg_set_ignore_access(true); + $options = array( + 'type' => 'object', + 'subtype' => 'blog' + ); + + $blogs = new ElggBatch('elgg_get_entities', $options); + foreach ($blogs as $blog) { + if (!$blog->excerpt) { + $blog->excerpt = elgg_get_excerpt($blog->description); + } + } + + elgg_set_ignore_access($ia); + + elgg_set_plugin_setting('upgrade_version', 1, 'blogs'); } } |