discourse/discourse — pull request #1034 by chrishunt (2013-06-16 00:46:55+00:00)
Title: Optionally rebake oneboxes with posts:rebake task

Should fix [meta/7255](http://meta.discourse.org/t/category-label-not-linking-correctly/7255)

We currently have a `posts:rebake` task that walks through each post and updates the markdown with the latest version. This task, however, does not update the oneboxes. It actually removes the oneboxes completely unless there is a cached version already, which is unlikely for older posts.

This PR updates the `posts:rebake` task so that we can optionally rebake the oneboxes as well. This is super useful if a onebox is broken and you want to refresh all of them through the site.

`posts:rebake` now has an optional parameter `invalidate_oneboxes`

```bash
$ bundle exec rake -T | grep rebake
rake posts:rebake[invalidate_oneboxes] # Update each post with latest markdown; optionally invalidate oneboxes.
```

If we call the task as normal, then we get the current behavior (oneboxes are *not* re-fetched)

```bash
$ bundle exec rake posts:rebake
```

If we call the task with `invalidate_oneboxes = true`, then all the oneboxes are refreshed as well:

```bash
$ bundle exec rake posts:rebake[true]
```