Hey guys, I'm thinking to remove some old links (ex domains) from 2 different forums. Example, for subtitles for movies for text files (like srt, txt, notepad) there is an option to replace characters or words (Edit/Replace/Find What/Replace With) , so I'm wondering if there is something like that on smf? Or if I enter in word censoring exact word or domain, will it remove existing word/domain and without causing some mess? Replacing with something else will be awesome.
You can use the word censoring, I've done that sometimes as a temporary measure. A real search and replace would have to be done through the database though.
Quote from: Aleksi "Lex" Kilpinen on January 12, 2018, 11:42:32 AM
You can use the word censoring, I've done that sometimes as a temporary measure. A real search and replace would have to be done through the database though.
Is that simple to do, or very complex thing?
which part?
Quote from: Illori on January 12, 2018, 11:57:59 AM
which part?
This?
QuoteA real search and replace would have to be done through the database though.
If you have access to the DB unload, this is how I do a DB search and replace (in Linux but you may adapt it) - this example builds my clone DB and imports it:
# Unload the current database
mysqldump -u root -passwd smf209 > /SQL/database_smf209_`date '+%d-%m-%Y'`.sql
# Convert the table prefix to the clone
sed 's/`smf209_/`smfclone1_/g' /SQL/database_smf209_`date '+%d-%m-%Y'`.sql > /SQL/smfclone1.sql
# Drop and Recreate the clone database
mysql -u root -passwd < /root/data/mysql.batch
# Reload the clone database
mysql -u root -passwd smfclone1 < /SQL/smfclone1.sql (drop database smfclone1; create database smfclone1;)
Ummm.... what? That has nothing to do with what the op is asking.
Efk... something like
UPDATE smf_messages SET body REPLACE(body,'original string','new string');
:-[ :-[
i just glanced at the previous post about seraching and replacing data in the DB.
please delete my posts.
long night ... whoops.
I have a utility that I use to setup test environments after restoring the DB from prod. I got sick of clicking on a link in test & finding myself on my prod site.
It does ***ALL*** paths ***AND*** URLs in the settings table, the themes table, the messages table, the PMs table & even member signatures (some folks on my forum actually promote their own "tips & tricks" threads in their signatures).
It has a "do it" flag, which if set to "no" can be used to preview the changes.
It is extremely helpful. OTOH, it is extremely dangerous & should be used with extreme caution. Uh... backup your DB first. Then back it up again...
I have it up on Github. Link here:
https://github.com/sbulen/sjrbTools/blob/master/SMF_URLs_Paths.php
Shawn, It think that the op was looking to replace URLs in messages not the system URLs and paths
Yes, it does messages too. It can be pared back.
Been doing this by exporting the single message table, then notepad++ and using the excellent find \ replace functions then reuploading the table.
As always, the start of of any table or db editing process is a backup :O)
A10,doing it Inline, in phpmyadmin is 1000 Times simpler and faster
Thank you guys. :)
As always, any time you do anything directly to your database - Backup, backup and backup again. :)
Did you get all the answers you needed, or is there something we can still help you with?
I guess this is all. In about 2-4 weeks my colleague will read this topic and will work on it. :)
I'll mark this solved for now then, but you are free to mark this not solved again if you want to continue from here later. :)