4

Context:

I have a client who came to me because their website has been hacked to hell in a handbasket. It's beyond salvageable. Server is rooted, core files changed, they are in the database, and so on.

  • I've decided to move them to a new host
  • Magento is installed and working.

I'm now trying to move all their products and customers over.

  • Playing with community addition here.
  • Their old Magento version is: 1.7.0.2
  • The new one is: 1.9.0.1

I'm running into brick walls because the migration path seems to be fragmented.

  • I need all the products.
  • I need all the customers.
  • I need to preserve the theme.

Hacked code aside, moving the products is killing me.

Question:

  • What process do I follow to get all products moved over? All data, images included.
  • What process do I follow to move all the attributes this previous install had.
  • What are the risks with just copying the database (outside of hacked code in the database.)
    • I figured this might be bad idea since the versions are changing...

Appreciate any advice, I've been reading documentation on these issues for a while now and it's brick wall after brick wall.

3
  • Thanks for the ideas guys! Sounds like everyone is saying "use the old database". Which gives me a starting point. I am not sure the extent to which it is hacked. I am just assuming "any part worth hacking". :) Feb 14, 2015 at 23:16
  • you need to go from the other side - how it was hacked? so obviously you can export your data and import to another database.
    – user2857
    Feb 15, 2015 at 13:18
  • It was hacked because the previous developer had everything owned by the web server and the file permissions as 777. It's been up for 2 years. I have found no less than 20 different sets of code with different purposes. Feb 15, 2015 at 18:58

3 Answers 3

4

Do you know which parts of the database are hacked? If the attributes are fine, maybe you could just run export and import them via SQL. Your products could be copied using the Magento Dataflow Profiles and so are the customers.

Of course, all of this depends on which parts of the database are hacked and the amount of attributes, products and customers that are in your shop.

About your last question, the version difference should not always be an issue, since Magento adds upgrade scripts for each new version. Of course testing this on a local installation or a test environment will be recommended :-)

I hope this will help you a bit. Good luck!

2
  • Are you suggesting copying the DB in small contextual sections and then running upgrade scripts? Feb 14, 2015 at 23:06
  • The upgrade scripts will run automatically as soon as you use the database in a newer Magento version. But the copying of the database depends on what parts of it are compromised, as Pronto and Andreas mention below. Feb 16, 2015 at 9:47
2

Well, it'll depend on whole lot of things. Easiest way would be to make a database dump and try upgrade it. This could be complicated because of the hack (I'm not sure what they did and how much of the database, if any, got compromised). One option is to try database repair tool and see what happens.

Once you get database fixed and manage to get updated Magento running, there're number of further options. Using Dataflow is one, using API calls is another and using direct database access is yet another. If databases is irretrievably broken, direct database access could be your only choice. I'm not going into details here, because I don't know your skill matrix.

With theme you need to check app/design/frontend/{package}/{theme} and perhaps app/design/frontend/{package}/default. I don't know what package you're using, so fill the blanks. BTW .. you need to review the template files, because Magento phtml files contain PHP code and thus may be contaminated.

1

As Arjen said, it all depends on what part of the database is compromised. If anyhow possible, I would try to reuse the old database after sanitizing it. Everything else makes much more work.

The different versions are no problem if you are upgrading - magento does this automatically.

Your Answer

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

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