Closed n0099 closed 1 year ago
I have been thinking about this for a long time but didn't get a chance to do it so far.
I was thinking of merging extensions like https://github.com/migratetoflarum/recalculate-meta and https://github.com/migratetoflarum/renumber-posts into a single big extension to re-generate everything pre-computed in Flarum.
The basic theory would be a command (ideally for the command line so no issue of timeout) that loops through posts, uses TextFormatter to unparse posts, and then immediately feeds the raw text back through TextFormatter.
The same extension could be used to rename domains in URLs for migrations and other general cleanup/rename operations.
I don't think such a script exists at this time unfortunately.
Without an extension the only solution is indeed to edit every post manually and change at least one character to make Flarum re-compile the post.
I agree, having a tool that reparses everything is a good idea. I wrote something like that for phpBB and in hindsight, I think that most of the original design decisions described in that post held up. You can check out the live code in phpBB's repository. It's only missing the ability to filter what posts get reparsed based on their content, e.g. only posts that contain <MEDIA
or ://
. Something that I added later but never got merged.
Anyway, here's a concise list of relevant observations:
If you tag me when you open a new branch for it, I'll keep an eye on it in case I have anything relevant to add.
I don't think such a script exists at this time unfortunately.
Now we have: https://github.com/club-1/flarum-ext-chore-commands
I've just add site defines for
s9e\TextFormatter\Plugins\MediaEmbed
in https://github.com/s9e/TextFormatter/pull/181, it's works fine for newly published or edited posts.But existing link in old posts which stored in database are not wrapped with
<SITE></SITE>
, so links will not transform to<iframe>
bys9e\TextFormatter\Renderer
.I guess the wrapping is done by
s9e\TextFormatter\Parser
, so I'm wondering how can I re-parse all posts without edit them one by one.