How to replace the post content in batches using Discuz (use SQL to update the database)

Source: Internet
Author: User

Today, a friend's Discuz X2 Forum needs to replace the content of posts in batches. There are tens of thousands of posts. In the beginning, words are filtered and the results are ineffective. They can only be replaced by databases in batches, for more information, see.

The Discuz X2 Forum provides the database SQL statement operation function in the background. However, this function is disabled by default for security reasons. You must modify the configuration file as follows:

Find the Forum program file config/config_global.php, open the file in notepad, and find $ _ config ['security'] ['querysafe '] ['status'] to set it to 0, continue to search for $ _ config ['admincp'] ['runquery'] and set it to 1. (For security reasons, we recommend that you change the values of these two parameters after the SQL statement is executed)

The following describes how to modify the content of Discuz X2 in batches:

1. Go to the Discuz X2 backend → webmaster → database → upgrade

2. Enter the following statement and submit it:
Copy codeThe Code is as follows:
UPDATE pre_forum_post SET message = REPLACE (message, "" content to be replaced "", "" New Content "");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.