This section contains detailed articles elaborating on some of the common issues phpBB users encounter while using the product. Articles submitted by members of the community are checked for accuracy by the relevant phpBB Team. If you do not find the answer to your question here, we recommend looking through the Support Section as well as using the Site Wide Search.

phpBB 3.2+ Text Reparser

Description: phpBB 3.2 has a new Text Formatter which is required to cope with the various issues that there were with the old way BBCode was handled, this article explains how to reparse text using the CLI.

In Categories:

Link to this article: Select All
[url=]Knowledge Base - phpBB 3.2+ Text Reparser[/url]

phpBB 3.2+ Text Reparser

In comparison to earlier versions of phpBB, phpBB 3.2 has a new Text Formatter which is required to cope with the various issues that there were with the old way BBCode was handled. One major difference, and the one that this topic focusses on, is the way messages* are stored. While the old engine stored messages as partly parsed BBcode and HTML, the new Text Formatter stores them as XML. You can read more about this here.

If you have started your board with version phpBB 3.2.0 or later, you can stop here because this does not relate to your board. If you started your board with an earlier phpBB version or if you have converted your board from other board software to phpBB, you should read on.

Why Reparse?
phpBB 3.2+ assumes your posts are stored as XML created by the Text Formatter. It does include a way to render old-school posts, so do not worry. Even more, phpBB also ships with a reparser that will convert all your old messages in small batches through a phpBB Cron task ("scheduled task"), therefore most of the time you do not have to worry and the more users that visit your board, the more quickly the messages will be reparsed and everything will be converted without you even noticing. In most cases this Cron task approach is perfectly fine. But be honest: would you have read up to here when you were satisfied with this?

Sometimes you may want to speed things up, enforcing the reparsing. Some extensions already rely on the new way messages are stored and their number will probably grow with time. Now you can choose to lay back and wait until everything is automatically reparsed, or force it and for that we need to use the CLI.

CLI? What's that?
CLI stands for Command Line Interface. A small but very powerful way to manage some tasks on your board. Read more about the CLI here. You use it from a Command prompt or a Terminal window. There are essentially two ways to approach this: directly on the server your board runs on, or remotely from your own computer, connecting through SSH for example.

There are numerous ways to achieve this - there is no single or best answer as it depends on how much control you have over your hosting package, the software they use, etc. The best thing I can do to help is linking to some documentation: However, if you do not know much about this, you wouldd probably need to ask your host.

From this point on, I will assume you have Command Line access to your board as it is a requirement to do anything else, so if you do not have Command Line access there is no point in reading on. I'll write each CLI command within code-tags, thus:

Code: Select all

Write this in your console
Now, let us reparse
We are almost there! Once you have logged in to your board using the command line, you will need to navigate to your board folder. Usually it is located in /home/yourusername/public_html/ or /var/www/hml/
So, let us go there:

Code: Select all

cd /var/www/html/
Now we can run commands. The easiest approach would be to simply reparse all the rich text:

Code: Select all

php bin/phpbbcli.php reparser:reparse --ansi
You will see some reporting on all the rich text fields in phpBB; a progress bar, some ranges, etc. In essence, that is all there is to it - just let it run until it is finished. When you have a large board this might take some time so be patient.

There are also some other options available:

You can tell the reparser to only reparse post text and leave the rest to the cron:

Code: Select all

php bin/phpbbcli.php reparser:reparse post_text --ansi
Or just reparse the PMs:

Code: Select all

php bin/phpbbcli.php reparser:reparse pm_text --ansi
Usually you will want to reparse everything.

You can also run in safe-mode, ignoring any extensions you might have and ignoring the cache:

Code: Select all

php bin/phpbbcli.php --safe-mode reparser:reparse  --ansi
Or even combine that:

Code: Select all

php bin/phpbbcli.php --safe-mode reparser:reparse post_text --ansi
Once the process is finished, you will get a nice success message. Job done, hooray! :D

On a sidenote: you can see I add a parameter --ansi after each CLI command. That is just to format the output in a more readable way.

There is a lock
You may get a message saying that the reparser is still running. That probably will not be the case, but there is a lock in place, which could be due to an unfinished cron job. You can reset that through your database using this query:

Code: Select all

UPDATE phpbb_config SET config_value = '0' WHERE config_name = 'reparse_lock';
(change the phpbb_ to your table prefix)
Keep in mind that it's always recommended to back up your database before running a SQL query manually.

You can then re-run your reparsing command through the CLI.

Now, that is about it. Quite easy in the end once you have reached the CLI, isn't it?

* The term messages, in this context, relates to any BBCode enriched text such as signatures, PMs, forum descriptions etc.