Plugin Directory

Changeset 3429296


Ignore:
Timestamp:
12/29/2025 09:21:29 PM (3 months ago)
Author:
surflabtech
Message:

v2.2.8

Location:
surflink
Files:
301 added
6 edited

Legend:

Unmodified
Added
Removed
  • surflink/trunk/includes/class-surfl-backup-helper.php

    r3429290 r3429296  
    692692    public function write_backup_header($fp, $mysql_version)
    693693    {
     694       global $wpdb;
     695       
    694696        $header = "-- SurfLink\n";
    695697        $header .= "-- site_url: " . site_url() . "\n";
     698        $header .= "-- prefix: " .home_url() . "\n";
    696699        $header .= "-- WordPress Database Backup\n";
    697700        $header .= "-- Version " . get_bloginfo('version') . "\n";
  • surflink/trunk/includes/class-surfl-br-loader.php

    r3428130 r3429296  
    12011201                wp_send_json_success([
    12021202                    'status' => $last_state['status'],
    1203                     'message' => '' . ('Current Table ' . $last_state['processed_table'] . '. Processed ' . $last_state['last_row_offset'] . ' rows. of ' . $last_state['total_rows'] ?? 'Initializing...'),
     1203                    'message' => '' . ($last_state['processed_table'] . '. Processed ' . $last_state['last_row_offset'] . ' rows. of ' . $last_state['total_rows'] ?? 'Initializing...'),
    12041204                    'subdir' => $last_state['subdir'],
    12051205                    'type' => $type,
  • surflink/trunk/includes/class-surfl-restore-db.php

    r3429290 r3429296  
    5353        $fp = null;
    5454        $temp_path = WP_CONTENT_DIR . '/surflink/backup/restore/temp';
    55         throw new Exception('Invalid backup file: This backup was not generated by the SurfLink plugin.');
    5655        // Disable query monitor during restore
    5756        add_filter( 'qm/enable', '__return_false', PHP_INT_MAX );
     
    139138                $second_line = fgets( $fp );
    140139                // Expected format: -- site_url: https://example.com
    141                 if ( preg_match( '/^--\\s*site_url:\\s*(.+)$/', trim( $second_line ), $matches ) ) {
    142                     $backup_site_url = untrailingslashit( trim( $matches[1] ) );
    143                     $current_site_url = untrailingslashit( site_url() );
    144                     // Compare URLs
    145                     if ( $backup_site_url !== $current_site_url ) {
    146                         fclose( $fp );
    147                         throw new Exception('Backup site URL does not match the current site.');
    148                     }
     140                if ( !preg_match( '/^--\\s*site_url:\\s*(.+)$/', trim( $second_line ), $matches ) ) {
     141                    fclose( $fp );
     142                    throw new Exception('Invalid backup file header: Missing site URL.');
     143                }
     144                $backup_site_url = untrailingslashit( trim( $matches[1] ) );
     145                $current_site_url = untrailingslashit( site_url() );
     146                // Compare URLs
     147                if ( $backup_site_url !== $current_site_url ) {
     148                    fclose( $fp );
     149                    throw new Exception('Backup site URL does not match the current site.');
     150                }
     151                // ---- Line 3: table prefix ----
     152                $third_line = fgets( $fp );
     153                if ( !preg_match( '/^--\\s*prefix:\\s*([a-zA-Z0-9_]+)$/', trim( $third_line ), $matches ) ) {
     154                    fclose( $fp );
     155                    throw new Exception('Invalid backup file: Missing or invalid table prefix header.');
     156                }
     157                $backup_prefix = $matches[1];
     158                $current_prefix = $wpdb->base_prefix;
     159                // Strict compare (recommended)
     160                if ( $backup_prefix !== $current_prefix ) {
     161                    fclose( $fp );
     162                    throw new Exception('Backup table prefix does not match the current site.');
    149163                }
    150164                $position = ftell( $fp );
  • surflink/trunk/readme.txt

    r3429290 r3429296  
    66**Requires PHP:** 7.4   
    77**Tested up to:** 6.9 
    8 **Stable tag:** 2.2.7
     8**Stable tag:** 2.2.8
    99**License:** GPLv3 or later 
    1010**License URI:** https://opensource.org/licenses/GPL-3.0 
     
    114114Yes! Database operations are powerful. Entering a wrong search or replace string could break your site. **Always** perform a Backup (using Module 3) before running a Search & Replace operation. Use the "Dry Run" feature first to verify what will be changed.
    115115
    116 **Why can’t I restore the database backup on a different domain?**
    117 At the moment, SurfLink database restore only works on the same domain where the backup was created.This is a current technical limitation, not a permanent restriction. Support for restoring backups on a different domain (for example: staging, localhost, or a new production domain) is planned for a future release.
     116**Why can’t I restore the database backup on a different domain or table prefix?**
     117At the moment, SurfLink database restore only works on the same domain where the backup was created.This is a current technical limitation, not a permanent restriction. Support for restoring backups on a different domain or prefix(for example: staging, localhost, or a new production domain) is planned for a future release.
    118118Current recommendations:
    119 1. Restore the database on the original domain
     1191. Restore the database on the original domain and table prefix.
    1201202. Use a site migration plugin if you are moving to a new domain
    121121
     
    140140
    141141== Changelog ==
     142
     143= 2.2.7 =
     144* Fixed: Critical bug fixed.
    142145
    143146= 2.2.7 =
  • surflink/trunk/surf-link.php

    r3429290 r3429296  
    77 * Author: SurfLab
    88 * Author URI: https://surflabtech.com
    9  * Version: 2.2.7
     9 * Version: 2.2.8
    1010 * Text Domain: surflink
    1111 * License: GPL-3.0-or-later
     
    6767    }
    6868    if ( !defined( 'SURFL_VERSION' ) ) {
    69         define( 'SURFL_VERSION', '2.2.7' );
     69        define( 'SURFL_VERSION', '2.2.8' );
    7070    }
    7171    if ( !defined( 'SURFL_PLUGIN' ) ) {
     
    9999        }
    100100        if ( !defined( 'SURFL_VERSION' ) ) {
    101             define( 'SURFL_VERSION', '2.2.7' );
     101            define( 'SURFL_VERSION', '2.2.8' );
    102102        }
    103103        if ( !defined( 'SURFL_SITE_URL' ) ) {
  • surflink/trunk/templates/surfl-restore-backup-html.php

    r3429290 r3429296  
    1414           
    1515
    16             <p class="surfl-flex-center" style="margin-top: 1rem;margin-bottom: 1rem;"> <span class="dashicons dashicons-warning"></span> Database restore works only on the original domain (cross-domain support coming soon).</p>
     16            <p class="surfl-flex-center" style="margin-top: 1rem;margin-bottom: 1rem;"> <span class="dashicons dashicons-warning"></span> Database restore works only on the original domain and table prefix(cross-domain support coming soon).</p>
    1717        <?php require_once SURFL_PATH . 'templates/surfl-backup-table.php' ?>
    1818
Note: See TracChangeset for help on using the changeset viewer.