diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2011-08-25 11:04:55 -0700 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2011-08-25 11:04:55 -0700 |
commit | 7be23080f34a8f92ca1f8d49c3aa0e6ce3472f4c (patch) | |
tree | d7b4ef2923b6aa2fc67a18a02da57121c76057f0 /mod | |
parent | dccc333c765bb28da55b4a55d9c916acdb88413a (diff) | |
parent | 51f3c3ea8549d465fafa9c1817aa6f8cf334a404 (diff) | |
download | elgg-7be23080f34a8f92ca1f8d49c3aa0e6ce3472f4c.tar.gz elgg-7be23080f34a8f92ca1f8d49c3aa0e6ce3472f4c.tar.bz2 |
Merge branch 'master' of github.com:brettp/Elgg
Diffstat (limited to 'mod')
-rw-r--r-- | mod/blog/start.php | 34 |
1 files changed, 29 insertions, 5 deletions
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'); } } |