OSTips – Search and Replace in any Joomla Database Table

Search and Replace in any Joomla Database Table

Replacing the content on one article or even two articles on your Joomla website is pretty simple, but what if you have to replace the plugin code on over a thousand articles in your Joomla site? How would you do it?

In this video, I’m going to show you how I replaced the plug-in code in over a thousand Joomla articles with a simple component from Regular Labs called DB Replacer.

Let’s find out!

“Hi, I’m Rod Martin, and this is OSTips from OS Training.

Here’s the scenario: a client of mine had thousands of podcasts, and of course we were using a particular plugin to play those podcasts. Well, they wanted a different one.  And literally it was around 3,000 articles that had this particular plug-in code embedded in every article.

So yes, we could have done a massive find and replace using phpmyadmin, but we wanted to be a little safer than that.  So we used the phenomenal DB Replacer from Regular Labs.  Let me show you how we did it.

I’m on a test Joomla site. I use it as a distribution, and I’ve set up an article called Regular Labs DB Replacer Test.  In this article, I’ve used their old name,  NoNumber.  Several years ago now, Peter decided to rebrand the business into Regular Labs, but for some reason I chose to use the word NoNumber.  Well of course, I need to replace that.  Obviously one instance of a change can be managed at the article level, but what happens as I mentioned in my introduction if you have thousands of instances of a particular piece of text or even plug-in code in your articles or modules?

Well DB Replacer to the rescue, and it’s really simple.

  • open DB Replacer
  • choose any table out of your entire database (content tables are chosen by default)

I can add additional “Where statements” if i want, but honestly the easiest thing to do is:

  • search for NoNumber (or the exact code or text you want to replace)
  • click Search button

You’ll see that it shows me all the places that text appears.

  • replace it with Regular Labs
  • click Search again

And now, it’s going to show me that it will replace NoNumber with Regular Labs.

  • click Replace
  • click OK to “Are you sure?”
  • <click OK to “Are you really sure?”

Know that doing this can potentially break your site. Typically when you’re replacing inside the content area, it’s probably less likely to break anything than when in other database areas, so trying this on a site that has been backed up or a duplicate version of your site would be a good idea.

  • go to my site
  • refresh your site page

There it is all updated!  I’m going to strongly encourage you to check out all of the documentation at:  www.regularlabs.com/extensions/dbreplacer

All right, well that’s it.  So obviously, this example involved just one article, but literally thousands and thousands of articles can be done using DB Replacer. And it’s not just articles. It’s any part of your Joomla database.

I can’t recommend this component enough, and as I mentioned just a moment ago, make sure you read the documentation.

Thanks for tuning in today.  This is OSTips from OSTraining, and I’m Rod Martin.

Author

  • Rod Martin

    Rod holds two masters degrees and has been training people how to do "things" for over 25 years. Originally from Australia, he grew up in Canada and now resides just outside Cincinnati, Ohio. He has worked in both the non-profit and for-profit worlds, in small companies and large corporations. His extensive open source experience includes WordPress, Joomla and Drupal and he really knows how to help you get the most out of the system you chose. Rod plays ice hockey a couple of times a week and rides his Goldwing motorcycle pretty much everywhere he can.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x