Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 2788

phpBB Custom Coding • Some useful SQL

$
0
0
This first one will allow you to review the changes before committing them. As always make sure you have backup of database.

Code:

SELECT post_text, REGEXP_REPLACE(post_text,'What you are finding', 'What you are replacing it with') AS new_url FROM phpbb_posts  WHERE post_text REGEXP 'What you are replacing it with';

This will change all links http/https with or without www to one route:

Code:

UPDATE phpbb_posts SET post_text = REGEXP_REPLACE (post_text, # What you are finding, no trailing slash. If you remove anysubfolder remove the slash before it.   '(http|https)://(www\\.)?anydomainname\\.com/anysubfolder)', # What you are replacing it with, no trailing slash.'https://www.yourdomain.com/subfolder');

phpBB no longer uses f parameter for topic links. This will remove them from links stored in DB..

Code:

UPDATE phpbb_posts SET post_text = REGEXP_REPLACE (post_text, '(http|https)://(www\\.)?yourdomain\\.com/subfolder/viewtopic\\.php\\?f\\=([0-9]+)\\&amp\\;', 'https://www.yourdomain\\.com/subfolder/viewtopic.php?');

This will find broken bbcode, e.g. user removed end quote. The <t> is a post in plain text and since the brackets are not common character chances are it's broken or errant bbcode. You can refine with'%[/%','%[%', etc.

Code:

SELECT post_id FROM phpbb_posts WHERE post_text LIKE '%<t>%' AND (post_text LIKE '%[%' OR post_text LIKE '%]%'); 
Go to bottom of results and find the link for export under query result operations. On next page switch to custom and select CSV, under "Format-specific options" remove the values for columns. Export it. Open results in text editor, on new line and end of line you can insert html for link. Read the manual. :D

Statistics: Posted by thecoalman — Wed Oct 02, 2024 8:06 am



Viewing all articles
Browse latest Browse all 2788

Trending Articles