LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-17-2020, 10:30 PM   #16
xray55
Member
 
Registered: Aug 2019
Posts: 45

Original Poster
Rep: Reputation: Disabled

Alright, so I think:


Code:
UPDATE xf_post SET message = REGEX_REPLACE(...)
-> REGEX_REPLACE( message , '(https://domain1.com/forums/)showthread\\.php\\?[0-9]+)-([\\w-]+)' , '\\1index.php?threads/\\3.\\2' )
-> ;
or test first


Code:
UPDATE xf_post SET message = REGEX_REPLACE(...)
-> SELECT message , message2=REGEX_REPLACE(...) FROM xf_post WHERE message LIKE '%domain1.com/forums/showthread.php%' LIMIT 0,10
-> ;

Last edited by xray55; 02-17-2020 at 10:31 PM.
 
Old 02-19-2020, 09:42 AM   #17
boughtonp
Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 255

Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by scasey View Post
I'll leave it to a mod to explain why such things (private solutions to questions) are frowned on at LQ
I don't do private solutions - I charge for my time and focused attention, but the results being published is a condition of anything I do.

Quote:
PM is not available in either direction until one has a certain number of posts (I believe its 100, but you can find that in the FAQs yourself).
Searching the FAQ suggests it's only available to subscribers - though based on this other FAQ section its (also) available after making 1,000 posts.

Since I've been able to turn PMs on in Edit Options, I suspect both of the above are outdated and your 100 posts is more accurate.

*shrug*

 
1 members found this post helpful.
Old 02-19-2020, 09:42 AM   #18
boughtonp
Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 255

Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by xray55 View Post
Alright, so I think:
Code:
UPDATE xf_post SET message = REGEX_REPLACE(...)
-> REGEX_REPLACE( message , '(https://domain1.com/forums/)showthread\\.php\\?[0-9]+)-([\\w-]+)' , '\\1index.php?threads/\\3.\\2' )
-> ;


Generally "..." means "insert something here" - i.e. change "REGEX_REPLACE(...)" to "REGEX_REPLACE( message , '(https://domain1.com/forums/)showthread\\.php\\?[0-9]+)-([\\w-]+)' , '\\1index.php?threads/\\3.\\2' )" not put one after the other.

However, I'm not sure you even need to be writing your own queries - according to this community XenForo vB4 importer there's now an official importer available - in which case that tool should be what you use, and it should handle updating link for you. (If it doesn't, that's a bug in the importer which should be reported to XenForo.)
 
Old 02-19-2020, 10:45 AM   #19
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.7.1908
Posts: 4,405

Rep: Reputation: 1563Reputation: 1563Reputation: 1563Reputation: 1563Reputation: 1563Reputation: 1563Reputation: 1563Reputation: 1563Reputation: 1563Reputation: 1563Reputation: 1563
Quote:
Originally Posted by boughtonp View Post
I don't do private solutions - I charge for my time and focused attention, but the results being published is a condition of anything I do.


Searching the FAQ suggests it's only available to subscribers - though based on this other FAQ section its (also) available after making 1,000 posts.

Since I've been able to turn PMs on in Edit Options, I suspect both of the above are outdated and your 100 posts is more accurate.

*shrug*

Yes. I wasn't speaking to you, but to the OP. Sorry that wasn't clear.

I'm not sure where I found the 100 posts thing, but the subject has come up before with relative newbies, who usually also need to be educated about how LQ works.

To xray55 (again): You need to just experiment until you get the results you want. You have the data, we don't.
boughtonp showed you how to do that in #6
Quote:
But before you do that, it's often a good idea to test these types of things with by previewing the result in a select statement, e.g:

Code:
SELECT message , message2=REGEX_REPLACE(...) FROM xf_post WHERE message LIKE '%showthread.php%' LIMIT 0,10
Then you can check that the replace works as expected.
Broken down:
SELECT just prints output to the screen
First, print the contents of the message column
Second, print the contents of the column after applying your code
FROM the xf_post table
WHERE the message column contains the string "showthread.php" within it.

Last edited by scasey; 02-19-2020 at 10:46 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
interesting MySQL query/view query :s mjh Programming 3 03-25-2008 08:30 AM
mysql use output of one query in another query secretlydead Programming 2 11-19-2007 02:25 AM
non Recursive query and Recursive query prashsharma Linux - Server 1 06-27-2007 10:33 AM
Database Programming (database to database transaction) johncsl82 Programming 7 02-02-2007 09:20 AM
help with mysql query: return nth rows in query hawarden Programming 2 07-31-2006 07:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration