ThemeFuse / Unyson-Backups-Extension

Backup & Demo Content - This extension lets you create an automated backup schedule, import demo content or even create a demo content archive for migration purposes.
http://manual.unyson.io/en/latest/extension/backups/
10 stars 17 forks source link

Unspecified ajax error ( Backups 2.0.23 ) #46

Closed spatricius closed 6 years ago

spatricius commented 7 years ago

Hi,

I'm having a great fun using Backups extension! But I'm also having this error occurring every time somewhere near the end of demo content install process:

  1. this is the last success status response http://prnt.sc/epfpsx
  2. then, empty responses come http://prnt.sc/epfmtu
  3. the modal with error appears : <td valign="middle" class="fw-sole-modal-content fw-text-center"><span class="fw-text-danger dashicons dashicons-warning"></span></td>
  4. Session expired modal appears ( why? ) http://prnt.sc/epfntz

While everything seems to be imported properly ( maybe apart from thememods but that's for another subject ), this error is an ux waster.

Normally, I would expect a PHP error, but my logs are all clear. JS console shows no messages. Do you know what may cause this? How can I debug it?

Thanks!

GheorgheP commented 7 years ago

Debugging the backup is very funny as backup is working similarly in a parallel thread so you need to activate the WP_DEBUG_LOG in wp-config.php: https://codex.wordpress.org/Debugging_in_WordPress#WP_DEBUG_LOG So you'll get errors in /wp-content/debug.log.

Also you get this error during backup or demo installation process?

spatricius commented 7 years ago

Yeah, I've seen the code. I'm impressed with the architecture you guys did there, but also it makes problems tricky to debug.

The problem happens at demo installation during db restore. I tried debug.log, but nothing seems to be generating any kind of PHP error. Also I got no luck finding the cause by putting error_log in \wpdb::query ( all queries results are ok ).

What happens is wordpress logs user out on some stage ( why? ), therefore ajax response is 0 ( no wp_ajaxnopriv actions on status check present ) and installation stops with an error ( nevertheless, everything seems to be imported correctly ).

My db json file is about 5MB. The importer used to work correctly when that was smaller, so I guess this is some kind of performance related issue. But let me clear this should probably not be considered as a timeout issue, as it all happens in less than 60 seconds.

PS. Everything works fine when installing demo content on same page it was exported from.

GheorgheP commented 7 years ago

Hmmm, you say during import.

I had this problem before too, and really could not find the issue, but it wasn't even a big issue, as I refreshed my page and the content import was continuing without problems.

But I think it may be because when we import the backup it replaces all the tables in database, and even the row with database state so wordpress see that database state was changes and signs out you, and if you are not logged in, you cannot make a backup, that's why I just had to refresh the page to login and continue the backup.

The problem is that I cannot reproduce this problem to test it out.

spatricius commented 7 years ago

Well, it doesn't seem a big issue to me personally, but I believe this can be a user experience bummer.

Previously, I thought wp_users isn't touched at all during import, but since you say all the tables are replaced, then that's probably the cause. Still, I'm unable to find the piece of code that logs user out. Should it be \wp_clear_auth_cookie or \wp_destroy_current_session? Perhaps we could add a hook to relogin the user after this logging out happens to prevent error modal from showing up?

As far as reproducing the problem goes, it should be easy. I will send you my db json backup. It crashes everytime.

GheorgheP commented 7 years ago

The wp_users is not touched, as we do not replace the wp_users table.

spatricius commented 7 years ago

I've sent you the demo content file.

I've just noticed content exported from multisite imports without problems on another multisite, and content exported at single site installation imports flawlessly on single sites. I wasn't aware of that previously. I guess I overlooked this important detail.

Still, is it not supposed to work multisite -> single site, single site -> multisite ? ( content backup, not full )

spatricius commented 7 years ago

Hi,

Any luck recreating the issue? I sent you an e-mail 3 weeks ago. Have you received it?