Home > Article > Backend Development > Discuz method to replace post content in batches (using SQL to update the database)_PHP tutorial
Today, a friend's Discuz X2 forum needed to replace the content of posts in batches. The number of posts was tens of thousands. At first, I set up word filtering, but found that it had no effect. I could only replace it in batches through the database. Please read below for the specific method.
Discuz X2 forum backend provides the function of database SQL statement operation, but by default for security reasons, this function is turned off, so you must first modify the configuration file. The method is as follows:
Find the forum program file config/config_global.php, open the file with Notepad, then search for $_config['security']['querysafe']['status'] and set it to 0, continue to search for $_config[ 'admincp']['runquery'] just set it to 1. (For security reasons, it is recommended to change the values of these two parameters back after executing the SQL statement)
Here’s how to batch modify post content in Discuz X2:
1. Enter Discuz X2 backend → Webmaster → Database → Upgrade
2. Enter the following statement and submit: