2

We have a client who was getting errors when trying to add a lot of articles (like a dozen) to their live site in a short time span, but we found that after moving their site to a localhost they did not encounter the problem anymore. Now they are finished adding the articles on their localhost, and want to push the changes to the live site. The only change they have made is adding less than 100 articles.

My question is: do I have to migrate the entire site back from their localhost to the live server, or can I just export/import the database?

I understand there are Joomla extensions for migrating articles between different CMSs and between different releases of Joomla, but these two sites are exactly the same other than one has different database content. Importing the database seems like it would be the simplest solution, I just want to know if it actually works before plowing forward.

8
  • 1
    The text is in the database as is all the metadata. What is in the files is images and caches. So you need to copy all the images as files and maybe clear caches. Mar 26, 2019 at 17:51
  • It didn't occur to me that the images would be stored as files rather than in the database, but that makes sense. The articles in question are actually J2Store products, so they definitely have images. Do you happen to know where J2Store saves its uploaded images?
    – William
    Mar 26, 2019 at 18:00
  • 1
    No, I know nothing of J2Store but probably /images, if you browse the store your browser kind of has to know the url which contains the folder. But store components can be tricky. Mar 26, 2019 at 18:10
  • 1
    It looks like they are indeed in /images. Thanks, this is exactly what I needed to know, and I would've had a panic if I discovered this halfway through the process. If you want to write your comments as an answer I would accept it.
    – William
    Mar 26, 2019 at 18:14
  • 1
    Remember to take a backup, store components can be bit messy since they have lots of meta data. So you can actually lose data or mess up the store fairly easy by copying too much or too little. Mar 26, 2019 at 18:18

2 Answers 2

0

You don't need to copy the complete database. We've done this already for migrate from a 1.0 to a 2.5. You just need to copy the complete data set for the articles and import the via sql into the live site.

Keep in mind to not mess up with ids. We've done it with a small python script to avoid errors. The script takes the content from old db, finds the related entries in other tables and insert them into the new database tables.

So yes it is possible, but you have to carefully and know what you are doing.

Sorry can't find the script right know, I thought I had it on github but it isn't there.

0

I'm very curious to know what errors they're having when adding multiple articles to the website in a short time span. Could it be that there's a firewall causing these issues? Could it be that the live server is a mere shared hosting account with many other accounts competing for the same resources? In any case, I suggest you ask them to address this problem because it might be impacting the actual traffic to their website, including Google's indexing.

Now, going back to your question, there are multiple ways to copy the articles to the remote server, the easiest way is to create a dump of only the newly created articles from the #__content table and import them into the #__content table on the live website - this is a very delicate process as you need to ensure that all the IDs in newly copied content do not exist in the live table, otherwise, you will run into issues. A cleaner approach is to export the newly created content without IDs, and let MySQL create those IDs as the id is autonumbered. This is the most expedient solution if you're doing this one time.

If you have to do this on a regular basis, then you can create a PHP script that does the above and then run it every day/week/etc... If you're using Joomla 4, then you can use Joomla's API to create those articles on the fly (e.g. once they are created on the test website, then they are duplicated on the live website). I can think of other approaches, but these are the most straightforward.

I would like to stress the importance of resolving the issues that your client is having because it might be impacting other areas.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.