Plugin Directory

Changeset 3406676


Ignore:
Timestamp:
12/01/2025 10:16:53 AM (3 months ago)
Author:
instawp
Message:

Update to version 0.1.2.2 from GitHub

Location:
instawp-connect
Files:
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • instawp-connect/tags/0.1.2.2/assets/js/common.js

    r3252174 r3406676  
    1414            success: function (response) {
    1515                console.log(response)
    16                 if (el.attr('target') === 'cache') {
     16                if (el.attr('target') === 'cache' || el.attr('target') === 'cdn-cache') {
    1717                    const urlObj = new URL(window.location.href);
    1818                    urlObj.searchParams.delete('instawp-cache-cleared');
     
    2525            error: function (jqXHR, textStatus, errorThrown) {
    2626                console.log(errorThrown);
     27                // Show error for cdn-cache type
     28                if (el.attr('target') === 'cdn-cache' && jqXHR.responseJSON?.data?.message) {
     29                    alert(jqXHR.responseJSON.data.message);
     30                }
    2731            }
    2832        });
  • instawp-connect/tags/0.1.2.2/includes/apis/class-instawp-rest-api-manage.php

    r3218292 r3406676  
    2121        ) );
    2222
     23        register_rest_route( $this->namespace . '/' . $this->version_2 . '/manage', '/purge-cdn-cache', array(
     24            'methods'             => 'POST',
     25            'callback'            => array( $this, 'purge_cdn_cache' ),
     26            'permission_callback' => '__return_true',
     27        ) );
     28
    2329        register_rest_route( $this->namespace . '/' . $this->version_2 . '/manage', '/inventory', array(
    2430            'methods'             => 'GET',
     
    150156
    151157        return $this->send_response( $response );
     158    }
     159
     160    /**
     161     * Handle response for CDN cache purge endpoint.
     162     * Purges the InstaWP CDN (Bunny) cache for sites hosted with InstaWP.
     163     *
     164     * @param WP_REST_Request $request
     165     *
     166     * @return WP_REST_Response
     167     */
     168    public function purge_cdn_cache( WP_REST_Request $request ) {
     169
     170        $response = $this->validate_api_request( $request );
     171        if ( is_wp_error( $response ) ) {
     172            return $this->throw_error( $response );
     173        }
     174
     175        $result = instawp_purge_cdn_cache();
     176
     177        if ( is_wp_error( $result ) ) {
     178            return $this->send_response( array(
     179                'success' => false,
     180                'message' => $result->get_error_message(),
     181            ) );
     182        }
     183
     184        return $this->send_response( array(
     185            'success' => isset( $result['success'] ) && $result['success'],
     186            'message' => $result['message'] ?? __( 'CDN cache purge request sent.', 'instawp-connect' ),
     187        ) );
    152188    }
    153189
  • instawp-connect/tags/0.1.2.2/includes/class-instawp-ajax.php

    r3378575 r3406676  
    8686            $response  = $cache_api->clean();
    8787
     88            // Also purge InstaCDN (silent - don't block on errors)
     89            $cdn_result = instawp_purge_cdn_cache();
     90            if ( ! is_wp_error( $cdn_result ) && ! empty( $cdn_result['success'] ) ) {
     91                $response[] = array( 'name' => 'InstaCDN' );
     92            }
     93
     94            set_transient( 'instawp_cache_purged', $response, 300 );
     95            wp_send_json_success( $response );
     96        } elseif ( $type === 'cdn-cache' ) {
     97            // InstaCDN-only purge (show error if not InstaSite)
     98            $result = instawp_purge_cdn_cache();
     99
     100            if ( is_wp_error( $result ) ) {
     101                wp_send_json_error( array( 'message' => $result->get_error_message() ) );
     102            }
     103
     104            if ( ! is_array( $result ) || empty( $result['success'] ) ) {
     105                $message = is_array( $result ) && isset( $result['message'] )
     106                    ? $result['message']
     107                    : __( 'This site is not hosted with InstaWP.', 'instawp-connect' );
     108                wp_send_json_error( array( 'message' => $message ) );
     109            }
     110
     111            $response = array( array( 'name' => 'InstaCDN' ) );
    88112            set_transient( 'instawp_cache_purged', $response, 300 );
    89113            wp_send_json_success( $response );
  • instawp-connect/tags/0.1.2.2/includes/class-instawp-hooks.php

    r3394048 r3406676  
    289289                        array(
    290290                            'parent' => 'instawp',
     291                            'id'     => 'instawp-clear-cdn-cache',
     292                            'title'  => __( 'Purge InstaCDN', 'instawp-connect' ),
     293                            'href'   => '#',
     294                            'meta'   => array(
     295                                'class'  => 'instawp-tools',
     296                                'target' => 'cdn-cache',
     297                            ),
     298                        )
     299                    );
     300
     301                    $admin_bar->add_menu(
     302                        array(
     303                            'parent' => 'instawp',
    291304                            'id'     => 'instawp-tools',
    292305                            'title'  => __( 'Tools', 'instawp-connect' ),
  • instawp-connect/tags/0.1.2.2/includes/class-instawp-tools.php

    r3397881 r3406676  
    212212
    213213            // Validate against protected directories using canonicalized paths
    214             if ( $canonical_path === $canonical_wp_content_dir ||
     214            if ( false === strpos( $canonical_path, 'plugins/iwp-' ) && ( $canonical_path === $canonical_wp_content_dir ||
    215215                $canonical_path === $canonical_abspath ||
    216216                ( $canonical_plugins_dir !== false && $canonical_path === $canonical_plugins_dir ) ||
     
    226226                ( $canonical_uploads_dir !== false && strpos( $canonical_path . '/', $canonical_uploads_dir . '/' ) === 0 ) ||
    227227                ( $canonical_wp_admin !== false && strpos( $canonical_path . '/', $canonical_wp_admin . '/' ) === 0 ) ||
    228                 ( $canonical_wp_includes !== false && strpos( $canonical_path . '/', $canonical_wp_includes . '/' ) === 0 ) ) {
     228                ( $canonical_wp_includes !== false && strpos( $canonical_path . '/', $canonical_wp_includes . '/' ) === 0 ) ) ) {
    229229                $result['message'] = __( 'Cannot remove protected WordPress directories', 'instawp-connect' );
    230230                Helper::add_error_log( $result );
     
    21822182                    glob( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'mu-plugins-*' ),
    21832183                    glob( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'themes-*' ),
     2184                    glob( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'iwp-demo-helper-*' ),
     2185                    glob( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'iwp-migration-helper-*' ),
    21842186                ) as $folder_to_del ) {
    21852187                    $folders[] = $folder_to_del;
  • instawp-connect/tags/0.1.2.2/includes/functions.php

    r3394048 r3406676  
    863863
    864864        return false;
     865    }
     866}
     867
     868
     869if ( ! function_exists( 'instawp_purge_cdn_cache' ) ) {
     870    /**
     871     * Purge CDN cache for the connected site via InstaWP API.
     872     * Only works for sites hosted with InstaWP.
     873     *
     874     * @return array|WP_Error Response from API or error
     875     */
     876    function instawp_purge_cdn_cache() {
     877        $connect_id = instawp()->connect_id;
     878
     879        if ( empty( $connect_id ) ) {
     880            return new WP_Error( 'no_connect_id', __( 'Site is not connected to InstaWP.', 'instawp-connect' ) );
     881        }
     882
     883        $response = Curl::do_curl(
     884            "connects/{$connect_id}/purge-cache",
     885            array(),
     886            array(),
     887            'POST'
     888        );
     889
     890        return $response;
    865891    }
    866892}
  • instawp-connect/tags/0.1.2.2/instawp-connect.php

    r3397881 r3406676  
    99 * Plugin Name:       InstaWP Connect
    1010 * Description:       1-click WordPress plugin for Staging, Migrations, Management, Sync and Companion plugin for InstaWP.
    11  * Version:           0.1.2.1
     11 * Version:           0.1.2.2
    1212 * Author:            InstaWP Team
    1313 * Author URI:        https://instawp.com/
     
    2929global $wpdb;
    3030
    31 defined( 'INSTAWP_PLUGIN_VERSION' ) || define( 'INSTAWP_PLUGIN_VERSION', '0.1.2.1' );
     31defined( 'INSTAWP_PLUGIN_VERSION' ) || define( 'INSTAWP_PLUGIN_VERSION', '0.1.2.2' );
    3232defined( 'INSTAWP_API_DOMAIN_PROD' ) || define( 'INSTAWP_API_DOMAIN_PROD', 'https://app.instawp.io' );
    3333
  • instawp-connect/tags/0.1.2.2/iwp-dest/index.php

    r3308480 r3406676  
    44
    55if ( ! defined( 'IWP_PLUGIN_DIR' ) ) {
    6     define( 'IWP_PLUGIN_DIR', dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR );
    7 }
    8 
    9 include_once IWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'functions-pull-push.php';
     6    define( 'IWP_PLUGIN_DIR', dirname( __DIR__ ) . DIRECTORY_SEPARATOR );
     7}
     8
     9require_once IWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'functions-pull-push.php';
    1010
    1111if ( ! isset( $_SERVER['HTTP_X_IWP_MIGRATE_KEY'] ) || empty( $migrate_key = $_SERVER['HTTP_X_IWP_MIGRATE_KEY'] ) ) {
     
    2222    header( 'x-iwp-status: false' );
    2323    header( 'x-iwp-message: Could not find wp-config.php in the parent directories.' );
    24     echo "Could not find wp-config.php in the parent directories.";
     24    echo 'Could not find wp-config.php in the parent directories.';
    2525    exit( 2 );
    2626}
     
    226226    if ( extension_loaded( 'mysqli' ) ) {
    227227
    228         if ( isset( $_SERVER['HTTP_X_IWP_PROGRESS'] ) ) {
    229             $log_content = "x-iwp-progress: {$_SERVER['HTTP_X_IWP_PROGRESS']}\n";
     228        $iwp_progress = isset( $_SERVER['HTTP_X_IWP_PROGRESS'] ) ? (int) $_SERVER['HTTP_X_IWP_PROGRESS'] : 0;
     229        if ( 0 < $iwp_progress ) {
     230            $log_content = "x-iwp-progress: {$iwp_progress}\n";
    230231            file_put_contents( $log_file_path, $log_content, FILE_APPEND );
    231232        }
    232233
    233         if ( isset( $_SERVER['HTTP_X_IWP_PROGRESS'] ) && $_SERVER['HTTP_X_IWP_PROGRESS'] == 100 ) {
    234 
    235             // Retaining user after migration
    236             if ( $retain_user ) {
    237 
    238                 $user_details_data  = isset( $user_details['data'] ) ? (array) $user_details['data'] : array();
    239                 $user_details_caps  = isset( $user_details['caps'] ) ? (array) $user_details['caps'] : array();
    240                 $user_details_roles = isset( $user_details['roles'] ) ? (array) $user_details['roles'] : array();
    241 
    242                 $user_data = array(
    243                     'user_login'          => isset( $user_details_data['user_login'] ) ? $user_details_data['user_login'] : '',
    244                     'user_pass'           => isset( $user_details_data['user_pass'] ) ? base64_decode( $user_details_data['user_pass'] ) : '',
    245                     'user_nicename'       => isset( $user_details_data['user_nicename'] ) ? $user_details_data['user_nicename'] : '',
    246                     'user_email'          => isset( $user_details_data['user_email'] ) ? $user_details_data['user_email'] : '',
    247                     'user_url'            => isset( $user_details_data['user_url'] ) ? $user_details_data['user_url'] : '',
    248                     'user_registered'     => isset( $user_details_data['user_registered'] ) ? $user_details_data['user_registered'] : '',
    249                     'user_activation_key' => isset( $user_details_data['user_activation_key'] ) ? $user_details_data['user_activation_key'] : '',
    250                     'user_status'         => isset( $user_details_data['user_status'] ) ? $user_details_data['user_status'] : '',
    251                     'display_name'        => isset( $user_details_data['display_name'] ) ? $user_details_data['display_name'] : '',
    252                 );
    253 
    254                 $fields = implode( ', ', array_keys( $user_data ) );
    255                 $values = "'" . implode( "', '", array_map( array( $mysqli, 'real_escape_string' ), $user_data ) ) . "'";
    256                 $query  = "INSERT INTO {$table_prefix}users ($fields) VALUES ($values)";
    257 
    258                 $query_response = $mysqli->query( $query );
    259 
    260                 if ( $query_response ) {
    261                     $user_id = $mysqli->insert_id;
    262 
    263                     if ( $user_id ) {
    264                         // Set user capabilities
    265                         $caps_key   = $mysqli->real_escape_string( $table_prefix . 'capabilities' );
    266                         $caps_value = $mysqli->real_escape_string( iwp_maybe_serialize( $user_details_caps ) );
    267                         $caps_query = "INSERT INTO {$table_prefix}usermeta (user_id, meta_key, meta_value) VALUES ($user_id, '$caps_key', '$caps_value')";
    268                         $mysqli->query( $caps_query );
    269 
    270                         // Set user roles
    271                         $roles_key   = $mysqli->real_escape_string( $table_prefix . 'user_level' );
    272                         $roles_value = $mysqli->real_escape_string( max( array_keys( $user_details_roles ) ) );
    273                         $roles_query = "INSERT INTO {$table_prefix}usermeta (user_id, meta_key, meta_value) VALUES ($user_id, '$roles_key', '$roles_value')";
    274                         $mysqli->query( $roles_query );
     234        if ( 100 === $iwp_progress ) {
     235
     236            try {
     237                // Retaining user after migration
     238                if ( isset( $retain_user ) && $retain_user && isset( $user_details ) && is_array( $user_details ) && ! empty( $user_details['data'] ) ) {
     239
     240                    $user_details_data  = isset( $user_details['data'] ) ? (array) $user_details['data'] : array();
     241                    $user_details_caps  = isset( $user_details['caps'] ) ? (array) $user_details['caps'] : array();
     242                    $user_details_roles = isset( $user_details['roles'] ) ? (array) $user_details['roles'] : array();
     243
     244                    $user_data = array(
     245                        'user_login'          => isset( $user_details_data['user_login'] ) ? $user_details_data['user_login'] : '',
     246                        'user_pass'           => isset( $user_details_data['user_pass'] ) ? base64_decode( $user_details_data['user_pass'] ) : '',
     247                        'user_nicename'       => isset( $user_details_data['user_nicename'] ) ? $user_details_data['user_nicename'] : '',
     248                        'user_email'          => isset( $user_details_data['user_email'] ) ? $user_details_data['user_email'] : '',
     249                        'user_url'            => isset( $user_details_data['user_url'] ) ? $user_details_data['user_url'] : '',
     250                        'user_registered'     => isset( $user_details_data['user_registered'] ) ? $user_details_data['user_registered'] : '',
     251                        'user_activation_key' => isset( $user_details_data['user_activation_key'] ) ? $user_details_data['user_activation_key'] : '',
     252                        'user_status'         => isset( $user_details_data['user_status'] ) ? $user_details_data['user_status'] : '',
     253                        'display_name'        => isset( $user_details_data['display_name'] ) ? $user_details_data['display_name'] : '',
     254                    );
     255
     256                    $fields = implode( ', ', array_keys( $user_data ) );
     257                    $values = "'" . implode( "', '", array_map( array( $mysqli, 'real_escape_string' ), $user_data ) ) . "'";
     258                    $query  = "INSERT INTO {$table_prefix}users ($fields) VALUES ($values)";
     259
     260                    $query_response = $mysqli->query( $query );
     261
     262                    if ( $query_response ) {
     263                        $user_id = $mysqli->insert_id;
     264
     265                        if ( $user_id ) {
     266                            // Set user capabilities
     267                            $caps_key   = $mysqli->real_escape_string( $table_prefix . 'capabilities' );
     268                            $caps_value = $mysqli->real_escape_string( iwp_maybe_serialize( $user_details_caps ) );
     269                            $caps_query = "INSERT INTO {$table_prefix}usermeta (user_id, meta_key, meta_value) VALUES ($user_id, '$caps_key', '$caps_value')";
     270                            $mysqli->query( $caps_query );
     271
     272                            // Set user roles
     273                            $roles_key   = $mysqli->real_escape_string( $table_prefix . 'user_level' );
     274                            $roles_value = $mysqli->real_escape_string( max( array_keys( $user_details_roles ) ) );
     275                            $roles_query = "INSERT INTO {$table_prefix}usermeta (user_id, meta_key, meta_value) VALUES ($user_id, '$roles_key', '$roles_value')";
     276                            $mysqli->query( $roles_query );
     277                        }
    275278                    }
    276                 }
    277 
    278                 if ( $mysqli->error ) {
    279                     file_put_contents( $log_file_path, "insert response: " . $mysqli->error . "\n", FILE_APPEND );
    280                 }
     279
     280                    if ( $mysqli->error ) {
     281                        file_put_contents( $log_file_path, 'insert response: ' . $mysqli->error . "\n", FILE_APPEND );
     282                    }
     283                }
     284            } catch ( \Throwable $th ) {
     285                file_put_contents( $log_file_path, 'iwp-dest retain user exception: ' . $th->getMessage() . "\n", FILE_APPEND );
    281286            }
    282287
     
    284289            // update instawp_api_options after the push db finished
    285290            if ( ! empty( $instawp_api_options ) ) {
     291                file_put_contents( $log_file_path, 'Going to update instawp_api_options' . "\n", FILE_APPEND );
     292
    286293                $is_insert_failed = false;
    287294
     
    294301                    }
    295302                } catch ( Exception $e ) {
    296                     file_put_contents( $log_file_path, "insert exception: " . $e->getMessage() . "\n", FILE_APPEND );
     303                    file_put_contents( $log_file_path, 'insert exception: ' . $e->getMessage() . "\n", FILE_APPEND );
    297304
    298305                    $is_insert_failed = true;
     
    318325                // Remove trailing index.php
    319326                $mysqli->query( "UPDATE `{$table_prefix}options` SET `option_value` = TRIM(TRAILING '/' FROM REPLACE(option_value, '/index.php', '')) WHERE `option_name` IN ('siteurl', 'home')" );
     327            } else {
     328                file_put_contents( $log_file_path, 'instawp_api_options not found to update' . "\n", FILE_APPEND );
    320329            }
    321330        }
     
    323332        $mysqli->close();
    324333    } else {
     334
     335        file_put_contents( $log_file_path, 'mysql extension not loaded. skipping reset instawp_api_options and retain users' . "\n", FILE_APPEND );
    325336        mysql_close( $connection );
    326337    }
    327338
    328 //  if ( file_exists( $file_save_path ) ) {
    329 //      unlink( $file_save_path );
    330 //  }
     339    // if ( file_exists( $file_save_path ) ) {
     340    // unlink( $file_save_path );
     341    // }
    331342}
    332343
     
    340351
    341352            if ( $res === true || $zip->status == 0 ) {
    342                 $extracted_files = [];
    343                 for ( $i = 0; $i < $zip->numFiles; $i ++ ) {
     353                $extracted_files = array();
     354                for ( $i = 0; $i < $zip->numFiles; $i++ ) {
    344355                    $file_name = $zip->getNameIndex( $i );
    345356
     
    348359                            $extracted_files[] = $file_name;
    349360                        }
    350                     } else if ( ! in_array( $file_name, $excluded_paths ) && ! str_contains( $file_name, 'instawp-autologin' ) ) {
     361                    } elseif ( ! in_array( $file_name, $excluded_paths ) && ! str_contains( $file_name, 'instawp-autologin' ) ) {
    351362                        $extracted_files[] = $file_name;
    352363                    }
     
    366377            } else {
    367378                echo "Couldn't extract $file_save_path.zip.\n";
    368                 echo "ZipArchive Error (status): " . $zip->status . " - " . zipStatusString( $zip->status ) . "\n";
    369                 echo "ZipArchive System Error (statusSys): " . $zip->statusSys . "\n";
     379                echo 'ZipArchive Error (status): ' . $zip->status . ' - ' . zipStatusString( $zip->status ) . "\n";
     380                echo 'ZipArchive System Error (statusSys): ' . $zip->statusSys . "\n";
    370381
    371382                header( 'x-iwp-status: false' );
     
    374385            }
    375386        } catch ( Exception $e ) {
    376             echo "Error: " . $e->getMessage();
     387            echo 'Error: ' . $e->getMessage();
    377388
    378389            header( 'x-iwp-status: false' );
     
    383394        try {
    384395            $phar            = new PharData( $file_save_path );
    385             $extracted_files = [];
     396            $extracted_files = array();
    386397
    387398            try {
     
    394405                    $extracted_files[] = $file_name;
    395406                }
    396 
    397407            } catch ( Throwable $e ) {
    398408                header( 'x-iwp-status: false' );
     
    412422            }
    413423        } catch ( Exception $e ) {
    414             echo "Error: " . $e->getMessage();
     424            echo 'Error: ' . $e->getMessage();
    415425
    416426            header( 'x-iwp-status: false' );
     
    479489    );
    480490
    481     $current_domain = str_replace( [ 'https://', 'http://' ], '', rtrim( $home_url, '/\\' ) );
     491    $current_domain = str_replace( array( 'https://', 'http://' ), '', rtrim( $home_url, '/\\' ) );
    482492    $wp_config      = preg_replace(
    483493        "/'DOMAIN_CURRENT_SITE',\s*'[^']*'/",
     
    499509
    500510        foreach ( $config_lines as $key => $line ) {
    501             if ( str_contains( $line, "DB_COLLATE" ) ) {
     511            if ( str_contains( $line, 'DB_COLLATE' ) ) {
    502512                $line_number = $key;
    503513                break;
     
    509519        }
    510520
    511         file_put_contents( $wp_config_path, implode( "", $config_lines ) );
     521        file_put_contents( $wp_config_path, implode( '', $config_lines ) );
    512522    }
    513523}
     
    515525header( 'x-iwp-status: true' );
    516526header( 'x-iwp-message: Success! ' . $file_relative_path );
    517 
  • instawp-connect/tags/0.1.2.2/languages/instawp-connect.pot

    r3397881 r3406676  
    66"Content-Type: text/plain; charset=UTF-8\n"
    77"Content-Transfer-Encoding: 8bit\n"
    8 "POT-Creation-Date: 2025-11-17 09:17+0000\n"
     8"POT-Creation-Date: 2025-11-27 14:14+0000\n"
    99"X-Poedit-Basepath: ..\n"
    1010"X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
     
    1818msgstr ""
    1919
    20 #: admin/class-instawp-admin.php:76, includes/class-instawp-hooks.php:325, includes/class-instawp-setting.php:38, includes/class-instawp-tools.php:1853
     20#: admin/class-instawp-admin.php:76, includes/class-instawp-hooks.php:325, includes/class-instawp-setting.php:38, includes/class-instawp-tools.php:1847
    2121msgid "Create Staging"
    2222msgstr ""
     
    794794msgstr ""
    795795
    796 #: includes/class-instawp-tools.php:1195
     796#: includes/class-instawp-tools.php:1189
    797797msgid "API key not found"
    798798msgstr ""
    799799
    800 #: includes/class-instawp-tools.php:1490
     800#: includes/class-instawp-tools.php:1484
    801801msgid "Root directory for this WordPress installation could not find."
    802802msgstr ""
    803803
    804 #: includes/class-instawp-tools.php:1514
     804#: includes/class-instawp-tools.php:1508
    805805msgid "Tracking database could not found."
    806806msgstr ""
    807807
    808 #: includes/class-instawp-tools.php:1523
     808#: includes/class-instawp-tools.php:1517
    809809msgid "API Signature and others data could not set properly"
    810810msgstr ""
    811811
    812 #: includes/class-instawp-tools.php:1539
     812#: includes/class-instawp-tools.php:1533
    813813msgid "InstaWP could not access or read required files from your WordPress directory due to file permission issue."
    814814msgstr ""
    815815
    816 #: includes/class-instawp-tools.php:1541
     816#: includes/class-instawp-tools.php:1535
    817817msgid "Learn more."
    818818msgstr ""
    819819
    820 #: includes/class-instawp-tools.php:1757
     820#: includes/class-instawp-tools.php:1751
    821821msgid "Launch %s"
    822822msgstr ""
    823823
     824#: includes/class-instawp-tools.php:1842
     825msgid "Please create staging sites first."
     826msgstr ""
     827
     828#: includes/class-instawp-tools.php:1843
     829msgid "Skip"
     830msgstr ""
     831
     832#: includes/class-instawp-tools.php:1844
     833msgid "Do you really want to disconnect the plugin? It will completely remove the existing staging sites from the plugin."
     834msgstr ""
     835
     836#: includes/class-instawp-tools.php:1845
     837msgid "Do you still want to disconnect the plugin?"
     838msgstr ""
     839
    824840#: includes/class-instawp-tools.php:1848
    825 msgid "Please create staging sites first."
     841msgid "Next Step"
    826842msgstr ""
    827843
    828844#: includes/class-instawp-tools.php:1849
    829 msgid "Skip"
     845msgid "Calculating size"
    830846msgstr ""
    831847
    832848#: includes/class-instawp-tools.php:1850
    833 msgid "Do you really want to disconnect the plugin? It will completely remove the existing staging sites from the plugin."
    834 msgstr ""
    835 
    836 #: includes/class-instawp-tools.php:1851
    837 msgid "Do you still want to disconnect the plugin?"
    838 msgstr ""
    839 
    840 #: includes/class-instawp-tools.php:1854
    841 msgid "Next Step"
    842 msgstr ""
    843 
    844 #: includes/class-instawp-tools.php:1855
    845 msgid "Calculating size"
    846 msgstr ""
    847 
    848 #: includes/class-instawp-tools.php:1856
    849849msgid "Copied"
    850850msgstr ""
    851851
    852 #: includes/class-instawp-tools.php:1916
     852#: includes/class-instawp-tools.php:1910
    853853msgid "Zip archive is not opening."
    854854msgstr ""
    855855
    856 #: includes/class-instawp-tools.php:1969
     856#: includes/class-instawp-tools.php:1963
    857857msgid "No compression method find."
    858858msgstr ""
    859859
    860 #: includes/class-instawp-tools.php:2016
     860#: includes/class-instawp-tools.php:2010
    861861msgid "Site ID not found in site create response."
    862862msgstr ""
    863863
    864 #: includes/class-instawp-tools.php:2054
     864#: includes/class-instawp-tools.php:2048
    865865msgid "SFTP login failed."
    866866msgstr ""
    867867
    868 #: includes/class-instawp-tools.php:2065
     868#: includes/class-instawp-tools.php:2059
    869869msgid "SFTP upload failed for files."
    870870msgstr ""
    871871
    872 #: includes/class-instawp-tools.php:2073
     872#: includes/class-instawp-tools.php:2067
    873873msgid "SFTP upload failed for database."
    874874msgstr ""
  • instawp-connect/tags/0.1.2.2/readme.txt

    r3397881 r3406676  
    55Tested up to: 6.8
    66Requires PHP: 7.0
    7 Stable tag: 0.1.2.1
     7Stable tag: 0.1.2.2
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
     
    9999== Changelog ==
    100100
     101= 0.1.2.2 - 01 December 2025 =
     102- Fixed: 403 error on migration cleanup API call.
     103- Added: Purge cdn cache
     104
    101105= 0.1.2.1 - 18 November 2025 =
    102106- Fixed: Cleanup of migration backup files.
  • instawp-connect/trunk/assets/js/common.js

    r3252174 r3406676  
    1414            success: function (response) {
    1515                console.log(response)
    16                 if (el.attr('target') === 'cache') {
     16                if (el.attr('target') === 'cache' || el.attr('target') === 'cdn-cache') {
    1717                    const urlObj = new URL(window.location.href);
    1818                    urlObj.searchParams.delete('instawp-cache-cleared');
     
    2525            error: function (jqXHR, textStatus, errorThrown) {
    2626                console.log(errorThrown);
     27                // Show error for cdn-cache type
     28                if (el.attr('target') === 'cdn-cache' && jqXHR.responseJSON?.data?.message) {
     29                    alert(jqXHR.responseJSON.data.message);
     30                }
    2731            }
    2832        });
  • instawp-connect/trunk/includes/apis/class-instawp-rest-api-manage.php

    r3218292 r3406676  
    2121        ) );
    2222
     23        register_rest_route( $this->namespace . '/' . $this->version_2 . '/manage', '/purge-cdn-cache', array(
     24            'methods'             => 'POST',
     25            'callback'            => array( $this, 'purge_cdn_cache' ),
     26            'permission_callback' => '__return_true',
     27        ) );
     28
    2329        register_rest_route( $this->namespace . '/' . $this->version_2 . '/manage', '/inventory', array(
    2430            'methods'             => 'GET',
     
    150156
    151157        return $this->send_response( $response );
     158    }
     159
     160    /**
     161     * Handle response for CDN cache purge endpoint.
     162     * Purges the InstaWP CDN (Bunny) cache for sites hosted with InstaWP.
     163     *
     164     * @param WP_REST_Request $request
     165     *
     166     * @return WP_REST_Response
     167     */
     168    public function purge_cdn_cache( WP_REST_Request $request ) {
     169
     170        $response = $this->validate_api_request( $request );
     171        if ( is_wp_error( $response ) ) {
     172            return $this->throw_error( $response );
     173        }
     174
     175        $result = instawp_purge_cdn_cache();
     176
     177        if ( is_wp_error( $result ) ) {
     178            return $this->send_response( array(
     179                'success' => false,
     180                'message' => $result->get_error_message(),
     181            ) );
     182        }
     183
     184        return $this->send_response( array(
     185            'success' => isset( $result['success'] ) && $result['success'],
     186            'message' => $result['message'] ?? __( 'CDN cache purge request sent.', 'instawp-connect' ),
     187        ) );
    152188    }
    153189
  • instawp-connect/trunk/includes/class-instawp-ajax.php

    r3378575 r3406676  
    8686            $response  = $cache_api->clean();
    8787
     88            // Also purge InstaCDN (silent - don't block on errors)
     89            $cdn_result = instawp_purge_cdn_cache();
     90            if ( ! is_wp_error( $cdn_result ) && ! empty( $cdn_result['success'] ) ) {
     91                $response[] = array( 'name' => 'InstaCDN' );
     92            }
     93
     94            set_transient( 'instawp_cache_purged', $response, 300 );
     95            wp_send_json_success( $response );
     96        } elseif ( $type === 'cdn-cache' ) {
     97            // InstaCDN-only purge (show error if not InstaSite)
     98            $result = instawp_purge_cdn_cache();
     99
     100            if ( is_wp_error( $result ) ) {
     101                wp_send_json_error( array( 'message' => $result->get_error_message() ) );
     102            }
     103
     104            if ( ! is_array( $result ) || empty( $result['success'] ) ) {
     105                $message = is_array( $result ) && isset( $result['message'] )
     106                    ? $result['message']
     107                    : __( 'This site is not hosted with InstaWP.', 'instawp-connect' );
     108                wp_send_json_error( array( 'message' => $message ) );
     109            }
     110
     111            $response = array( array( 'name' => 'InstaCDN' ) );
    88112            set_transient( 'instawp_cache_purged', $response, 300 );
    89113            wp_send_json_success( $response );
  • instawp-connect/trunk/includes/class-instawp-hooks.php

    r3394048 r3406676  
    289289                        array(
    290290                            'parent' => 'instawp',
     291                            'id'     => 'instawp-clear-cdn-cache',
     292                            'title'  => __( 'Purge InstaCDN', 'instawp-connect' ),
     293                            'href'   => '#',
     294                            'meta'   => array(
     295                                'class'  => 'instawp-tools',
     296                                'target' => 'cdn-cache',
     297                            ),
     298                        )
     299                    );
     300
     301                    $admin_bar->add_menu(
     302                        array(
     303                            'parent' => 'instawp',
    291304                            'id'     => 'instawp-tools',
    292305                            'title'  => __( 'Tools', 'instawp-connect' ),
  • instawp-connect/trunk/includes/class-instawp-tools.php

    r3397881 r3406676  
    212212
    213213            // Validate against protected directories using canonicalized paths
    214             if ( $canonical_path === $canonical_wp_content_dir ||
     214            if ( false === strpos( $canonical_path, 'plugins/iwp-' ) && ( $canonical_path === $canonical_wp_content_dir ||
    215215                $canonical_path === $canonical_abspath ||
    216216                ( $canonical_plugins_dir !== false && $canonical_path === $canonical_plugins_dir ) ||
     
    226226                ( $canonical_uploads_dir !== false && strpos( $canonical_path . '/', $canonical_uploads_dir . '/' ) === 0 ) ||
    227227                ( $canonical_wp_admin !== false && strpos( $canonical_path . '/', $canonical_wp_admin . '/' ) === 0 ) ||
    228                 ( $canonical_wp_includes !== false && strpos( $canonical_path . '/', $canonical_wp_includes . '/' ) === 0 ) ) {
     228                ( $canonical_wp_includes !== false && strpos( $canonical_path . '/', $canonical_wp_includes . '/' ) === 0 ) ) ) {
    229229                $result['message'] = __( 'Cannot remove protected WordPress directories', 'instawp-connect' );
    230230                Helper::add_error_log( $result );
     
    21822182                    glob( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'mu-plugins-*' ),
    21832183                    glob( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'themes-*' ),
     2184                    glob( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'iwp-demo-helper-*' ),
     2185                    glob( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'iwp-migration-helper-*' ),
    21842186                ) as $folder_to_del ) {
    21852187                    $folders[] = $folder_to_del;
  • instawp-connect/trunk/includes/functions.php

    r3394048 r3406676  
    863863
    864864        return false;
     865    }
     866}
     867
     868
     869if ( ! function_exists( 'instawp_purge_cdn_cache' ) ) {
     870    /**
     871     * Purge CDN cache for the connected site via InstaWP API.
     872     * Only works for sites hosted with InstaWP.
     873     *
     874     * @return array|WP_Error Response from API or error
     875     */
     876    function instawp_purge_cdn_cache() {
     877        $connect_id = instawp()->connect_id;
     878
     879        if ( empty( $connect_id ) ) {
     880            return new WP_Error( 'no_connect_id', __( 'Site is not connected to InstaWP.', 'instawp-connect' ) );
     881        }
     882
     883        $response = Curl::do_curl(
     884            "connects/{$connect_id}/purge-cache",
     885            array(),
     886            array(),
     887            'POST'
     888        );
     889
     890        return $response;
    865891    }
    866892}
  • instawp-connect/trunk/instawp-connect.php

    r3397881 r3406676  
    99 * Plugin Name:       InstaWP Connect
    1010 * Description:       1-click WordPress plugin for Staging, Migrations, Management, Sync and Companion plugin for InstaWP.
    11  * Version:           0.1.2.1
     11 * Version:           0.1.2.2
    1212 * Author:            InstaWP Team
    1313 * Author URI:        https://instawp.com/
     
    2929global $wpdb;
    3030
    31 defined( 'INSTAWP_PLUGIN_VERSION' ) || define( 'INSTAWP_PLUGIN_VERSION', '0.1.2.1' );
     31defined( 'INSTAWP_PLUGIN_VERSION' ) || define( 'INSTAWP_PLUGIN_VERSION', '0.1.2.2' );
    3232defined( 'INSTAWP_API_DOMAIN_PROD' ) || define( 'INSTAWP_API_DOMAIN_PROD', 'https://app.instawp.io' );
    3333
  • instawp-connect/trunk/iwp-dest/index.php

    r3308480 r3406676  
    44
    55if ( ! defined( 'IWP_PLUGIN_DIR' ) ) {
    6     define( 'IWP_PLUGIN_DIR', dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR );
    7 }
    8 
    9 include_once IWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'functions-pull-push.php';
     6    define( 'IWP_PLUGIN_DIR', dirname( __DIR__ ) . DIRECTORY_SEPARATOR );
     7}
     8
     9require_once IWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'functions-pull-push.php';
    1010
    1111if ( ! isset( $_SERVER['HTTP_X_IWP_MIGRATE_KEY'] ) || empty( $migrate_key = $_SERVER['HTTP_X_IWP_MIGRATE_KEY'] ) ) {
     
    2222    header( 'x-iwp-status: false' );
    2323    header( 'x-iwp-message: Could not find wp-config.php in the parent directories.' );
    24     echo "Could not find wp-config.php in the parent directories.";
     24    echo 'Could not find wp-config.php in the parent directories.';
    2525    exit( 2 );
    2626}
     
    226226    if ( extension_loaded( 'mysqli' ) ) {
    227227
    228         if ( isset( $_SERVER['HTTP_X_IWP_PROGRESS'] ) ) {
    229             $log_content = "x-iwp-progress: {$_SERVER['HTTP_X_IWP_PROGRESS']}\n";
     228        $iwp_progress = isset( $_SERVER['HTTP_X_IWP_PROGRESS'] ) ? (int) $_SERVER['HTTP_X_IWP_PROGRESS'] : 0;
     229        if ( 0 < $iwp_progress ) {
     230            $log_content = "x-iwp-progress: {$iwp_progress}\n";
    230231            file_put_contents( $log_file_path, $log_content, FILE_APPEND );
    231232        }
    232233
    233         if ( isset( $_SERVER['HTTP_X_IWP_PROGRESS'] ) && $_SERVER['HTTP_X_IWP_PROGRESS'] == 100 ) {
    234 
    235             // Retaining user after migration
    236             if ( $retain_user ) {
    237 
    238                 $user_details_data  = isset( $user_details['data'] ) ? (array) $user_details['data'] : array();
    239                 $user_details_caps  = isset( $user_details['caps'] ) ? (array) $user_details['caps'] : array();
    240                 $user_details_roles = isset( $user_details['roles'] ) ? (array) $user_details['roles'] : array();
    241 
    242                 $user_data = array(
    243                     'user_login'          => isset( $user_details_data['user_login'] ) ? $user_details_data['user_login'] : '',
    244                     'user_pass'           => isset( $user_details_data['user_pass'] ) ? base64_decode( $user_details_data['user_pass'] ) : '',
    245                     'user_nicename'       => isset( $user_details_data['user_nicename'] ) ? $user_details_data['user_nicename'] : '',
    246                     'user_email'          => isset( $user_details_data['user_email'] ) ? $user_details_data['user_email'] : '',
    247                     'user_url'            => isset( $user_details_data['user_url'] ) ? $user_details_data['user_url'] : '',
    248                     'user_registered'     => isset( $user_details_data['user_registered'] ) ? $user_details_data['user_registered'] : '',
    249                     'user_activation_key' => isset( $user_details_data['user_activation_key'] ) ? $user_details_data['user_activation_key'] : '',
    250                     'user_status'         => isset( $user_details_data['user_status'] ) ? $user_details_data['user_status'] : '',
    251                     'display_name'        => isset( $user_details_data['display_name'] ) ? $user_details_data['display_name'] : '',
    252                 );
    253 
    254                 $fields = implode( ', ', array_keys( $user_data ) );
    255                 $values = "'" . implode( "', '", array_map( array( $mysqli, 'real_escape_string' ), $user_data ) ) . "'";
    256                 $query  = "INSERT INTO {$table_prefix}users ($fields) VALUES ($values)";
    257 
    258                 $query_response = $mysqli->query( $query );
    259 
    260                 if ( $query_response ) {
    261                     $user_id = $mysqli->insert_id;
    262 
    263                     if ( $user_id ) {
    264                         // Set user capabilities
    265                         $caps_key   = $mysqli->real_escape_string( $table_prefix . 'capabilities' );
    266                         $caps_value = $mysqli->real_escape_string( iwp_maybe_serialize( $user_details_caps ) );
    267                         $caps_query = "INSERT INTO {$table_prefix}usermeta (user_id, meta_key, meta_value) VALUES ($user_id, '$caps_key', '$caps_value')";
    268                         $mysqli->query( $caps_query );
    269 
    270                         // Set user roles
    271                         $roles_key   = $mysqli->real_escape_string( $table_prefix . 'user_level' );
    272                         $roles_value = $mysqli->real_escape_string( max( array_keys( $user_details_roles ) ) );
    273                         $roles_query = "INSERT INTO {$table_prefix}usermeta (user_id, meta_key, meta_value) VALUES ($user_id, '$roles_key', '$roles_value')";
    274                         $mysqli->query( $roles_query );
     234        if ( 100 === $iwp_progress ) {
     235
     236            try {
     237                // Retaining user after migration
     238                if ( isset( $retain_user ) && $retain_user && isset( $user_details ) && is_array( $user_details ) && ! empty( $user_details['data'] ) ) {
     239
     240                    $user_details_data  = isset( $user_details['data'] ) ? (array) $user_details['data'] : array();
     241                    $user_details_caps  = isset( $user_details['caps'] ) ? (array) $user_details['caps'] : array();
     242                    $user_details_roles = isset( $user_details['roles'] ) ? (array) $user_details['roles'] : array();
     243
     244                    $user_data = array(
     245                        'user_login'          => isset( $user_details_data['user_login'] ) ? $user_details_data['user_login'] : '',
     246                        'user_pass'           => isset( $user_details_data['user_pass'] ) ? base64_decode( $user_details_data['user_pass'] ) : '',
     247                        'user_nicename'       => isset( $user_details_data['user_nicename'] ) ? $user_details_data['user_nicename'] : '',
     248                        'user_email'          => isset( $user_details_data['user_email'] ) ? $user_details_data['user_email'] : '',
     249                        'user_url'            => isset( $user_details_data['user_url'] ) ? $user_details_data['user_url'] : '',
     250                        'user_registered'     => isset( $user_details_data['user_registered'] ) ? $user_details_data['user_registered'] : '',
     251                        'user_activation_key' => isset( $user_details_data['user_activation_key'] ) ? $user_details_data['user_activation_key'] : '',
     252                        'user_status'         => isset( $user_details_data['user_status'] ) ? $user_details_data['user_status'] : '',
     253                        'display_name'        => isset( $user_details_data['display_name'] ) ? $user_details_data['display_name'] : '',
     254                    );
     255
     256                    $fields = implode( ', ', array_keys( $user_data ) );
     257                    $values = "'" . implode( "', '", array_map( array( $mysqli, 'real_escape_string' ), $user_data ) ) . "'";
     258                    $query  = "INSERT INTO {$table_prefix}users ($fields) VALUES ($values)";
     259
     260                    $query_response = $mysqli->query( $query );
     261
     262                    if ( $query_response ) {
     263                        $user_id = $mysqli->insert_id;
     264
     265                        if ( $user_id ) {
     266                            // Set user capabilities
     267                            $caps_key   = $mysqli->real_escape_string( $table_prefix . 'capabilities' );
     268                            $caps_value = $mysqli->real_escape_string( iwp_maybe_serialize( $user_details_caps ) );
     269                            $caps_query = "INSERT INTO {$table_prefix}usermeta (user_id, meta_key, meta_value) VALUES ($user_id, '$caps_key', '$caps_value')";
     270                            $mysqli->query( $caps_query );
     271
     272                            // Set user roles
     273                            $roles_key   = $mysqli->real_escape_string( $table_prefix . 'user_level' );
     274                            $roles_value = $mysqli->real_escape_string( max( array_keys( $user_details_roles ) ) );
     275                            $roles_query = "INSERT INTO {$table_prefix}usermeta (user_id, meta_key, meta_value) VALUES ($user_id, '$roles_key', '$roles_value')";
     276                            $mysqli->query( $roles_query );
     277                        }
    275278                    }
    276                 }
    277 
    278                 if ( $mysqli->error ) {
    279                     file_put_contents( $log_file_path, "insert response: " . $mysqli->error . "\n", FILE_APPEND );
    280                 }
     279
     280                    if ( $mysqli->error ) {
     281                        file_put_contents( $log_file_path, 'insert response: ' . $mysqli->error . "\n", FILE_APPEND );
     282                    }
     283                }
     284            } catch ( \Throwable $th ) {
     285                file_put_contents( $log_file_path, 'iwp-dest retain user exception: ' . $th->getMessage() . "\n", FILE_APPEND );
    281286            }
    282287
     
    284289            // update instawp_api_options after the push db finished
    285290            if ( ! empty( $instawp_api_options ) ) {
     291                file_put_contents( $log_file_path, 'Going to update instawp_api_options' . "\n", FILE_APPEND );
     292
    286293                $is_insert_failed = false;
    287294
     
    294301                    }
    295302                } catch ( Exception $e ) {
    296                     file_put_contents( $log_file_path, "insert exception: " . $e->getMessage() . "\n", FILE_APPEND );
     303                    file_put_contents( $log_file_path, 'insert exception: ' . $e->getMessage() . "\n", FILE_APPEND );
    297304
    298305                    $is_insert_failed = true;
     
    318325                // Remove trailing index.php
    319326                $mysqli->query( "UPDATE `{$table_prefix}options` SET `option_value` = TRIM(TRAILING '/' FROM REPLACE(option_value, '/index.php', '')) WHERE `option_name` IN ('siteurl', 'home')" );
     327            } else {
     328                file_put_contents( $log_file_path, 'instawp_api_options not found to update' . "\n", FILE_APPEND );
    320329            }
    321330        }
     
    323332        $mysqli->close();
    324333    } else {
     334
     335        file_put_contents( $log_file_path, 'mysql extension not loaded. skipping reset instawp_api_options and retain users' . "\n", FILE_APPEND );
    325336        mysql_close( $connection );
    326337    }
    327338
    328 //  if ( file_exists( $file_save_path ) ) {
    329 //      unlink( $file_save_path );
    330 //  }
     339    // if ( file_exists( $file_save_path ) ) {
     340    // unlink( $file_save_path );
     341    // }
    331342}
    332343
     
    340351
    341352            if ( $res === true || $zip->status == 0 ) {
    342                 $extracted_files = [];
    343                 for ( $i = 0; $i < $zip->numFiles; $i ++ ) {
     353                $extracted_files = array();
     354                for ( $i = 0; $i < $zip->numFiles; $i++ ) {
    344355                    $file_name = $zip->getNameIndex( $i );
    345356
     
    348359                            $extracted_files[] = $file_name;
    349360                        }
    350                     } else if ( ! in_array( $file_name, $excluded_paths ) && ! str_contains( $file_name, 'instawp-autologin' ) ) {
     361                    } elseif ( ! in_array( $file_name, $excluded_paths ) && ! str_contains( $file_name, 'instawp-autologin' ) ) {
    351362                        $extracted_files[] = $file_name;
    352363                    }
     
    366377            } else {
    367378                echo "Couldn't extract $file_save_path.zip.\n";
    368                 echo "ZipArchive Error (status): " . $zip->status . " - " . zipStatusString( $zip->status ) . "\n";
    369                 echo "ZipArchive System Error (statusSys): " . $zip->statusSys . "\n";
     379                echo 'ZipArchive Error (status): ' . $zip->status . ' - ' . zipStatusString( $zip->status ) . "\n";
     380                echo 'ZipArchive System Error (statusSys): ' . $zip->statusSys . "\n";
    370381
    371382                header( 'x-iwp-status: false' );
     
    374385            }
    375386        } catch ( Exception $e ) {
    376             echo "Error: " . $e->getMessage();
     387            echo 'Error: ' . $e->getMessage();
    377388
    378389            header( 'x-iwp-status: false' );
     
    383394        try {
    384395            $phar            = new PharData( $file_save_path );
    385             $extracted_files = [];
     396            $extracted_files = array();
    386397
    387398            try {
     
    394405                    $extracted_files[] = $file_name;
    395406                }
    396 
    397407            } catch ( Throwable $e ) {
    398408                header( 'x-iwp-status: false' );
     
    412422            }
    413423        } catch ( Exception $e ) {
    414             echo "Error: " . $e->getMessage();
     424            echo 'Error: ' . $e->getMessage();
    415425
    416426            header( 'x-iwp-status: false' );
     
    479489    );
    480490
    481     $current_domain = str_replace( [ 'https://', 'http://' ], '', rtrim( $home_url, '/\\' ) );
     491    $current_domain = str_replace( array( 'https://', 'http://' ), '', rtrim( $home_url, '/\\' ) );
    482492    $wp_config      = preg_replace(
    483493        "/'DOMAIN_CURRENT_SITE',\s*'[^']*'/",
     
    499509
    500510        foreach ( $config_lines as $key => $line ) {
    501             if ( str_contains( $line, "DB_COLLATE" ) ) {
     511            if ( str_contains( $line, 'DB_COLLATE' ) ) {
    502512                $line_number = $key;
    503513                break;
     
    509519        }
    510520
    511         file_put_contents( $wp_config_path, implode( "", $config_lines ) );
     521        file_put_contents( $wp_config_path, implode( '', $config_lines ) );
    512522    }
    513523}
     
    515525header( 'x-iwp-status: true' );
    516526header( 'x-iwp-message: Success! ' . $file_relative_path );
    517 
  • instawp-connect/trunk/languages/instawp-connect.pot

    r3397881 r3406676  
    66"Content-Type: text/plain; charset=UTF-8\n"
    77"Content-Transfer-Encoding: 8bit\n"
    8 "POT-Creation-Date: 2025-11-17 09:17+0000\n"
     8"POT-Creation-Date: 2025-11-27 14:14+0000\n"
    99"X-Poedit-Basepath: ..\n"
    1010"X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
     
    1818msgstr ""
    1919
    20 #: admin/class-instawp-admin.php:76, includes/class-instawp-hooks.php:325, includes/class-instawp-setting.php:38, includes/class-instawp-tools.php:1853
     20#: admin/class-instawp-admin.php:76, includes/class-instawp-hooks.php:325, includes/class-instawp-setting.php:38, includes/class-instawp-tools.php:1847
    2121msgid "Create Staging"
    2222msgstr ""
     
    794794msgstr ""
    795795
    796 #: includes/class-instawp-tools.php:1195
     796#: includes/class-instawp-tools.php:1189
    797797msgid "API key not found"
    798798msgstr ""
    799799
    800 #: includes/class-instawp-tools.php:1490
     800#: includes/class-instawp-tools.php:1484
    801801msgid "Root directory for this WordPress installation could not find."
    802802msgstr ""
    803803
    804 #: includes/class-instawp-tools.php:1514
     804#: includes/class-instawp-tools.php:1508
    805805msgid "Tracking database could not found."
    806806msgstr ""
    807807
    808 #: includes/class-instawp-tools.php:1523
     808#: includes/class-instawp-tools.php:1517
    809809msgid "API Signature and others data could not set properly"
    810810msgstr ""
    811811
    812 #: includes/class-instawp-tools.php:1539
     812#: includes/class-instawp-tools.php:1533
    813813msgid "InstaWP could not access or read required files from your WordPress directory due to file permission issue."
    814814msgstr ""
    815815
    816 #: includes/class-instawp-tools.php:1541
     816#: includes/class-instawp-tools.php:1535
    817817msgid "Learn more."
    818818msgstr ""
    819819
    820 #: includes/class-instawp-tools.php:1757
     820#: includes/class-instawp-tools.php:1751
    821821msgid "Launch %s"
    822822msgstr ""
    823823
     824#: includes/class-instawp-tools.php:1842
     825msgid "Please create staging sites first."
     826msgstr ""
     827
     828#: includes/class-instawp-tools.php:1843
     829msgid "Skip"
     830msgstr ""
     831
     832#: includes/class-instawp-tools.php:1844
     833msgid "Do you really want to disconnect the plugin? It will completely remove the existing staging sites from the plugin."
     834msgstr ""
     835
     836#: includes/class-instawp-tools.php:1845
     837msgid "Do you still want to disconnect the plugin?"
     838msgstr ""
     839
    824840#: includes/class-instawp-tools.php:1848
    825 msgid "Please create staging sites first."
     841msgid "Next Step"
    826842msgstr ""
    827843
    828844#: includes/class-instawp-tools.php:1849
    829 msgid "Skip"
     845msgid "Calculating size"
    830846msgstr ""
    831847
    832848#: includes/class-instawp-tools.php:1850
    833 msgid "Do you really want to disconnect the plugin? It will completely remove the existing staging sites from the plugin."
    834 msgstr ""
    835 
    836 #: includes/class-instawp-tools.php:1851
    837 msgid "Do you still want to disconnect the plugin?"
    838 msgstr ""
    839 
    840 #: includes/class-instawp-tools.php:1854
    841 msgid "Next Step"
    842 msgstr ""
    843 
    844 #: includes/class-instawp-tools.php:1855
    845 msgid "Calculating size"
    846 msgstr ""
    847 
    848 #: includes/class-instawp-tools.php:1856
    849849msgid "Copied"
    850850msgstr ""
    851851
    852 #: includes/class-instawp-tools.php:1916
     852#: includes/class-instawp-tools.php:1910
    853853msgid "Zip archive is not opening."
    854854msgstr ""
    855855
    856 #: includes/class-instawp-tools.php:1969
     856#: includes/class-instawp-tools.php:1963
    857857msgid "No compression method find."
    858858msgstr ""
    859859
    860 #: includes/class-instawp-tools.php:2016
     860#: includes/class-instawp-tools.php:2010
    861861msgid "Site ID not found in site create response."
    862862msgstr ""
    863863
    864 #: includes/class-instawp-tools.php:2054
     864#: includes/class-instawp-tools.php:2048
    865865msgid "SFTP login failed."
    866866msgstr ""
    867867
    868 #: includes/class-instawp-tools.php:2065
     868#: includes/class-instawp-tools.php:2059
    869869msgid "SFTP upload failed for files."
    870870msgstr ""
    871871
    872 #: includes/class-instawp-tools.php:2073
     872#: includes/class-instawp-tools.php:2067
    873873msgid "SFTP upload failed for database."
    874874msgstr ""
  • instawp-connect/trunk/readme.txt

    r3397881 r3406676  
    55Tested up to: 6.8
    66Requires PHP: 7.0
    7 Stable tag: 0.1.2.1
     7Stable tag: 0.1.2.2
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
     
    9999== Changelog ==
    100100
     101= 0.1.2.2 - 01 December 2025 =
     102- Fixed: 403 error on migration cleanup API call.
     103- Added: Purge cdn cache
     104
    101105= 0.1.2.1 - 18 November 2025 =
    102106- Fixed: Cleanup of migration backup files.
Note: See TracChangeset for help on using the changeset viewer.