Common Fixes for Snapshot V.4.X.X

This page contains the most common problems related to the Snapshot backup plugin V.4.X.X.X and how to solve them.

General Problems #

In general, Snapshot gets some errors when WordPress is with limited access to the resources of the server. You can check if your WordPress installation has the necessary resources available in the following path:

Your WP Admin > Tools > Site Health > Info > Server

After access the path above you can check if your site has the necessary resource available. If not, you’ll need to do some additional configurations on your site. The additional configurations that you can put on wp-config.php file should be made according to the plugin API return that occurs when the backups fail and not get complete.

See the snippet below for learn how and when to do these additional configurations:

<?php
// ALL CONTENT OF THE ORIGINAL FILE GOES HERE…
// Displays More Details in the Logs
define('SNAPSHOT4_FILELIST_LOG_VERBOSE', true); // Comment or remove this after the debug session
define('SNAPSHOT4_FILE_ZIPSTREAM_LOG_VERBOSE', true); // Comment or remove this after the debug session
// Utils when occurring the error: snapshot_failed_FetchFileslist
define( 'SNAPSHOT4_CHUNKED_ZIPSTREAMING_LARGE', true );
// Utils when occurring the error: snapshot_failed_SiteNotRespondedError
define( 'WP_MEMORY_LIMIT', '1024M' ); // PHP memory limit – memory_limit
set_time_limit(1000); // PHP time limit – max_execution_time
/* That's all, stop editing! Happy blogging. */
view raw wp-config.php hosted with ❤ by GitHub

API Problems #

In some cases, the backup gets stuck on 0% or maybe the plugin gets some message like this:

A connection with the API couldn't be established.

To solve these problems, you can put the IP’s from Snapshot API in the allowed list on your server firewall or ask your host company to do this. If you use Cloudflare firewall or any other service like this, also put these IP’s in the allowed list of these services.

List of IP’s to put in the allowed list of your firewalls:

52.57.5.20
34.196.51.17
18.204.159.253

After implementing these recommendations above, you probably should be able to connect with the Snapshot API.

Database Problems #

This section contains some fixes that need access to the database of the site.

Schedule #

Sometimes, when you tried to change the backup schedule date you gets this error:

Request for a backup schedule was not successful.

It uses to occur when the wp_snapshot_backup_schedule option gets corrupted on your database and the biggest problem is that when this occur, generally even the manual backup not works and gets stuck on 14%.

To solve this, you can search in the wp_options table (if you use a custom prefix, replace wp_ by it) for an option name called wp_snapshot_backup_schedule and delete it – see the following screenshot for more details…

If you don’t have access to the database but have (S)FTP access, use the snippet below:

<?php
/**
* Plugin Name: [GS] Delete wp_snapshot_backup_schedule option
* Plugin URI: https://glaubersilva.me/
* Description: Sometimes the schedule option get corrupted in the database and when you try to exchange the date-time in Snapshot you get the message: "Request for a backup schedule was not successful." – This plugin can help you to solve this problem.
* Author: Glauber Silva
* Author URI: https://glaubersilva.me/
* License: GPLv2 or later
*
* @package GS_Delete_wp_snapshot_backup_schedule_Option
*/
defined( 'ABSPATH' ) || exit;
/**
* Add this file in you /wp-content/mu-plugins folder
* To delete the option, access: YOUR-DOMAIN.COM/?delete=wp_snapshot_backup_schedule
* After that, delete this file!
*/
function gs_delete_snapshot_schedule_option(){
if ( isset( $_REQUEST['delete'] ) && 'wp_snapshot_backup_schedule' === $_REQUEST['delete'] ) {
$response = delete_option( $_REQUEST['delete'] );
if ( $response ){
echo 'The <b>wp_snapshot_backup_schedule</b> option was successfully deleted.<br><br>';
echo '<b>ATTENTION:</b> remember to remove this plugin now that the option already is deleted! ;)<br><br>';
exit;
}
}
}
add_action( 'init', 'gs_delete_snapshot_schedule_option' );

Read the description and the comments of the Snippet above to learn how to use this option correctly. For more information about the folder mu-plugins, click here.

Views #

Another common problem is the error of backup when the database contains some views, the snippet below solves this problem.

IMPORTANT: You can install the snippet gs-snapshot-skip-views.php in your WordPress site like a normal plugin, but I recommend that you installing it like a must-use plugin to avoid that it was disabled by mistake. 😉

<?php
/**
* Plugin Name: [GS] Snapshot Skip Views
* Plugin URI: https://glaubersilva.me/
* Description: Snapshot can't backup views, just tables. Views generate errors that stop the backup like this: "Unreachable table PREFIX_affiliate_wp_campaigns". So this snippet solves this problem.
* Author: Glauber Silva
* Author URI: https://glaubersilva.me/
* License: GPLv2 or later
*
* @package GS_Snapshot_Skip_Views
*/
defined( 'ABSPATH' ) || exit;
function gs_skip_views_on_snapshot_backup( $tables ) {
/**
* Check all views in your database (via phpMyAdmin or other) and put them here – separate by a comma and without the database prefix.
*/
$views = array(
'affiliate_wp_campaigns',
);
foreach( $tables as $id => $table ){
foreach( $views as $view ){
if( false !== strpos( $table, $view ) ){
unset( $tables[ $id ] );
}
}
}
return $tables;
}
add_filter( 'snapshot_tables_for_backup', 'gs_skip_views_on_snapshot_backup' );

Leave a Reply