Plugin Directory

Changeset 2869535


Ignore:
Timestamp:
02/22/2023 05:29:08 PM (3 years ago)
Author:
zoneit
Message:
  • Bugs fixes and improvements
Location:
zoneit-backup
Files:
44 added
4 edited

Legend:

Unmodified
Added
Removed
  • zoneit-backup/trunk/includes/class-backup-core.php

    r2865347 r2869535  
    77 * Author: Zoneit Cloud
    88 * DateTime: 2022/11/06 16:38
    9  * Last Modified Time: 2023/02/16 02:48
     9 * Last Modified Time: 2023/02/22 20:57
    1010 * License: GPL-2.0+
    1111 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    259259       
    260260                        // final request to endpoint of internal zoneit cloud services
    261                         self::connect_zoneit_api();
     261                        $zoneit_cloud_id = get_transient('zoneit_cloud_id');
     262                        if(!empty($zoneit_cloud_id))
     263                        {
     264                            self::connect_zoneit_api( $zoneit_cloud_id );
     265                        }
    262266                    }
    263267                    else
     
    522526    /**
    523527     * Request to Zoneit cloud api
    524      */
    525     public static function connect_zoneit_api()
     528     *
     529     * @param UUID $zoneit_cloud_id
     530     *
     531     * @return void
     532     */
     533    public static function connect_zoneit_api( $zoneit_cloud_id )
    526534    {
    527535        $request = wp_remote_post("https://api.zoneit.cloud/v2/api/wp/backup/", [
    528536            'body' => [
     537                'backup_id' => $zoneit_cloud_id,
    529538                'token' => Zoneit_Backup_REST_API::generate_token(),
    530539                'domain' => Zoneit_Backup_REST_API::get_domain_name( get_site_url() ),
     
    532541            ]
    533542        ]);
    534         print_r($request);
    535543    }
    536544
  • zoneit-backup/trunk/includes/class-rest-api.php

    r2865347 r2869535  
    77 * Author: Rasool Vahdati
    88 * DateTime: 2022/10/08 11:55:03
    9  * Last Modified Time: 2023/02/16 02:48:30
     9 * Last Modified Time: 2023/02/22 20:51:30
    1010 * License: GPL-3.0+
    1111 */
     
    6666        $params = $request->get_params();
    6767        $generate_token = self::generate_token();
    68        
    6968        $results = array();
    7069
     
    7473            if( $user_token == $generate_token )
    7574            {
    76                 $backups_list = Backup_Core::get_backup_urls( 0, 1 ); // all service type and only last link
    77                 if( !is_null($url) )
    78                 {
    79                     $results = [
    80                         'status' => true,
    81                         'id' => $backups_list['zoneit_backup_id'],
    82                         'url' => $backups_list['backup_url'],
    83                     ];
     75                $urls = Backup_Core::get_backup_urls( 0, 1 ); // all service type and only last link
     76                if( !is_null($urls) )
     77                {
     78                    $results = $urls;
    8479                }
    8580                else
     
    121116            if( $user_token == $geneate_token )
    122117            {
    123                 if( !empty( Backup_Core::get( [ 'status' => 1 ] ) ) )
    124                 {
    125                     $results = [
    126                         'status' => false,
    127                         'msg' => __('There is a backup with \'in progress\' status. You cannot create a new backup until this backup is completed.', 'zoneit-backup')
    128                     ];
    129                     return new WP_REST_Response( $results, 200 );
     118                if(isset($params['backup_id']))
     119                {
     120                    if( !empty( Backup_Core::get( [ 'status' => 1 ] ) ) )
     121                    {
     122                        $results = [
     123                            'status' => false,
     124                            'msg' => __('There is a backup with \'in progress\' status. You cannot create a new backup until this backup is completed.', 'zoneit-backup')
     125                        ];
     126                        return new WP_REST_Response( $results, 200 );
     127                    }
     128                    else
     129                    {
     130                        set_transient('zoneit_cloud_id', sanitize_text_field( $params['backup_id'] ), 90 * MINUTE_IN_SECONDS ); // set receive backup_id for
     131                        Backup_Core::run_backup_event();
     132                        $results = [
     133                            'status' => true,
     134                            'msg' => __('The plugin is creating the backups of db and files...Please wait...', 'zoneit-backup')
     135                        ];
     136                        return new WP_REST_Response( $results, 200 );
     137                    }
    130138                }
    131139                else
    132140                {
    133                     Backup_Core::run_backup_event();
    134                     $results = [
    135                         'status' => true,
    136                         'msg' => __('The plugin is creating the backups of db and files...Please wait...', 'zoneit-backup')
    137                     ];
    138                     return new WP_REST_Response( $results, 200 );
     141                    return new WP_Error( 'error', __('Backup UUID not found', 'zoneit-backup'), array( 'status' => 400 ) );
    139142                }
    140143            }
  • zoneit-backup/trunk/readme.txt

    r2865347 r2869535  
    44Requires at least: 5.0
    55Tested up to: 6.1.1
    6 Stable tag: 1.1.1
     6Stable tag: 1.1.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4242== Changelog ==
    4343
     44= 1.1.2 =
     45* Bugs fixes and improvements
     46
    4447= 1.1.1 =
    4548* Bugs fixes and improvements
  • zoneit-backup/trunk/zoneit-backup.php

    r2865347 r2869535  
    33Plugin Name: Zoneit Backup
    44Description: This plugin is creating a backup from website files and db
    5 Version: 1.1.1
     5Version: 1.1.2
    66Author: Zoneit Cloud
    77Author URI: https://zoneit.cloud
Note: See TracChangeset for help on using the changeset viewer.