Database restore does not work

wow, seriously messed up my zenphoto install while troubleshooting. tried and installed a fresh version of 1.2.9, the version of zenphoto i created the backups with. then dropped all tables regarding zenphoto.

now, when i try to restore the backup from within zenphoto (after setup created all tables and i chose "restore db" instead of "create admin user"), it gives me this:

INSERT INTO `zp_administrators` (`id`,`user`,`pass`,`name`,`email`,`rights`,`custom_data`,`valid`,`group`) VALUES ("1","administrators",NULL,"group","","81790","Benutzer mit vollen Privilegien.","0","") ) fehlgeschlagen. Fehler: Duplicate entry '1' for key 1

any clues?

Comments

  • Upon further investigation:

    * only the user appearing as the first value in "zdb"-backup gets inserted into "zp_administrators"
    * with a clean install of 1.2.9 on localhost i can replicate the described error upon database-restore
    * i also can't restore a database backup made under 1.3.1.2 within a zenphoto 1.3.1.2-installation

    … oh my god. I'm lost here.
  • The first error is somehow because there is already an entry in the Administrator's table for ID=1. I presume that is a bug somewhere but I am not sure what would cause it.

    Did you get the same error when you attempted to restore a 1.3.1.2 DB on 1.3.1.2? I have not tried exactly that, but backup and restore definately are working for me with the current development build.
  • Update:

    I have created a fresh install of v1.2.9. Did a backup and then a restore--no errors. Then I dropped all the tables, re-ran setup and clicked on the restore from DB link. The restore then also went without a hitch.

    I then did an upgrade to versin 1.3.1.2 with no issues. Did a backup (to be on the save side) then restored from the backup done on v1.2.0. Again no issues. Then did a restore from the 1.3.1.2 backup with no issues.

    Finally, I dropped the database tables and re-ran setup. Did a restore from the v1.3.1.2 backup without problems.

    Summary: I have no clue as to what went wrong for you. What version of PHP and MySQL are you running?
  • Wow, thanks so much sbillard. WOW. That's a lot of work for such a sloppy failure description.
    I'll look up the PHP and MySQL info for you – I would be very happy to sent you the DB backups in question btw. – I don't know if that would make it easier?
  • PHP: 5.2.14
    MySQ: 5.0.91
  • Gee. I was hoping these would be out of date versions. How big is your site? I am not sure it would be worth waiding through a huge backup, specially if this is a problem introduced at some distant past.
  • I hear what you're saying :/ … the backup file is 800 KB.
  • Hey there again! I managed to delete the user which would cause the "Duplicate entry '1' for key 1" (the very first "administrator" in the backup file).

    Now, the database backup runs "successful", though giving an error:

    Warning: Invalid argument supplied for foreach() in /homepages/20/d250315487/htdocs/efes/zenphoto/zp-core/utilities/backup_restore.php on line 270

    – i assume I have deleted to much from the backup?

    Can you give me a hint in which format the backup is written? As in "how much values belong to a user" – so I can try and delete the right amount of data? I hope you can understand me :/
  • What I previously posted was done with v1.3.1.2; using v1.2.9 (under which the backup was created), the DB restore runs successfully (without any error messages). However, I end up with 10 of 500 users in the DB, no zen-pages, no comments … and so on. Investigating! (without knowing what I'm doing here ;)
Sign In or Register to comment.