Esempio n. 1
0
 /**
  * Return the current instance of WPRP_Backups
  *
  * @static
  * @access public
  */
 public static function get_instance()
 {
     if (empty(self::$instance)) {
         self::$instance = new WPRP_Backups();
     }
     return self::$instance;
 }
Esempio n. 2
0
/**
 * Run any update code and update the current version in the db
 *
 * @access public
 * @return void
 */
function wprp_update()
{
    /**
     * Remove the old _wpremote_backups directory
     */
    $uploads_dir = wp_upload_dir();
    $old_wpremote_dir = trailingslashit($uploads_dir['basedir']) . '_wpremote_backups';
    if (file_exists($old_wpremote_dir)) {
        WPRP_Backups::rmdir_recursive($old_wpremote_dir);
    }
    // If BackUpWordPress isn't installed then lets just delete the whole backups directory
    if (!defined('HMBKP_PLUGIN_PATH') && ($path = get_option('hmbkp_path'))) {
        WPRP_Backups::rmdir_recursive($path);
        delete_option('hmbkp_path');
        delete_option('hmbkp_default_path');
        delete_option('hmbkp_plugin_version');
    }
    // Update the version stored in the db
    if (get_option('wprp_plugin_version') !== WPRP_VERSION) {
        update_option('wprp_plugin_version', WPRP_VERSION);
    }
}
Esempio n. 3
0
         WPRP_Backups::get_instance()->set_is_using_file_manifest(true);
     }
     $actions[$action] = WPRP_Backups::get_instance()->do_backup();
     break;
 case 'get_backup':
     $actions[$action] = WPRP_Backups::get_instance()->get_backup();
     break;
 case 'delete_backup':
     $actions[$action] = WPRP_Backups::get_instance()->cleanup();
     break;
 case 'backup_heartbeat':
     WPRP_Backups::get_instance()->set_is_using_file_manifest(true);
     if (in_array(WPR_API_Request::get_arg('backup_type'), array('complete', 'database', 'file'))) {
         WPRP_Backups::get_instance()->set_type(WPR_API_Request::get_arg('backup_type'));
     }
     $actions[$action] = WPRP_Backups::get_instance()->backup_heartbeat();
     break;
 case 'supports_backups':
     $actions[$action] = true;
     break;
 case 'get_site_info':
     $actions[$action] = array('site_url' => get_site_url(), 'home_url' => get_home_url(), 'admin_url' => get_admin_url(), 'backups' => function_exists('_wprp_get_backups_info') ? _wprp_get_backups_info() : array(), 'web_host' => _wprp_integration_get_web_host(), 'summary' => _wprp_get_content_summary());
     break;
 case 'get_option':
     $actions[$action] = get_option(sanitize_text_field(WPR_API_Request::get_arg('option_name')));
     break;
 case 'update_option':
     $actions[$action] = update_option(sanitize_text_field(WPR_API_Request::get_arg('option_name')), WPR_API_Request::get_arg('option_value'));
     break;
 case 'delete_option':
     $actions[$action] = delete_option(sanitize_text_field(WPR_API_Request::get_arg('option_name')));