Plugin Directory

Changeset 3176444


Ignore:
Timestamp:
10/27/2024 06:32:00 PM (17 months ago)
Author:
deltabackups
Message:

Updated readme 1.0.4

Location:
deltabackups
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • deltabackups/tags/1.0.4/deltabackups-main.php

    r3176208 r3176444  
    992992    // replace only first occurrence, create wp_options and all inserts to wp_options except wp_user_roles
    993993    $pattern = '/wp_posts|wp_postmeta|wp_commentmeta|wp_term_taxonomy|wp_options(?!.*wp_user_roles)/';
    994     // $patternDomain = '/wp_posts|wp_postmeta|wp_options(?=.*astra)|wp_options(?=.*elementor_log)/';
    995     $patternDomain = '/wp_posts|wp_postmeta|wp_options(?=.*elementor_log)/';
     994    $patternDomain = '/wp_posts|wp_postmeta|wp_options(?=.*astra)/';
     995    $patternDomainWpOptionsObject = '/wp_options(?=.*astra\-settings)/';
    996996
    997997    if (preg_match($pattern, $line)) {
    998998        if (!DTBPS_LOCAL_MODE && $backupSiteUrl !== "" && $backupSiteUrl !== $currentSiteUrl && preg_match($patternDomain, $line)) {
    999             // replace domains
    1000             $line = str_replace($backupSiteUrl, $currentSiteUrl, $line);
     999            // check if query matches
     1000            if (preg_match($patternDomainWpOptionsObject, $line)) {
     1001                $ptrn = '/s:\d+:\\\\"' . preg_quote($backupSiteUrl, '/') . '\/[^"]*\\\\";/';
     1002                preg_match_all($ptrn, $line, $matches, PREG_OFFSET_CAPTURE);
     1003
     1004                if (!empty($matches[0])) {
     1005                    $unique_matches = []; // Array to store unique matches
     1006
     1007                    foreach ($matches[0] as $match) {
     1008                            $matched_string = $match[0]; // The matched substring
     1009
     1010                            // Store unique matches using array_unique() and a simple array
     1011                            if (!in_array($matched_string, $unique_matches)) {
     1012                                $unique_matches[] = $matched_string; // Add only unique matched strings
     1013                            }
     1014                        }
     1015
     1016                    // Output unique matched strings
     1017                    foreach ($unique_matches as $unique_match) {
     1018                        $unserializedMatch = unserialize(str_replace('\"', '"', $unique_match));
     1019                        $replaced_unserialized_unique_match = str_replace($backupSiteUrl, $currentSiteUrl, $unserializedMatch);
     1020                        $serializedUnique = str_replace('"', '\"', serialize( $replaced_unserialized_unique_match));
     1021
     1022                        $line = str_replace($unique_match, $serializedUnique, $line);
     1023
     1024                    }
     1025                }
     1026            } else {
     1027                // plain replace domains
     1028                $line = str_replace($backupSiteUrl, $currentSiteUrl, $line);
     1029            }
     1030
    10011031        }
    10021032
  • deltabackups/tags/1.0.4/readme.txt

    r3176146 r3176444  
    5353Also tested with MySql and MariaDB.
    5454Worked ok with PHP 5.6 and all above, last tested with 8.3
     55Tested with Astra, Elementor, Spectra, Kadence, Woocommerce and many more plugins!
    5556
    5657= Is there a scheduling feature? =
  • deltabackups/trunk/deltabackups-main.php

    r3176208 r3176444  
    992992    // replace only first occurrence, create wp_options and all inserts to wp_options except wp_user_roles
    993993    $pattern = '/wp_posts|wp_postmeta|wp_commentmeta|wp_term_taxonomy|wp_options(?!.*wp_user_roles)/';
    994     // $patternDomain = '/wp_posts|wp_postmeta|wp_options(?=.*astra)|wp_options(?=.*elementor_log)/';
    995     $patternDomain = '/wp_posts|wp_postmeta|wp_options(?=.*elementor_log)/';
     994    $patternDomain = '/wp_posts|wp_postmeta|wp_options(?=.*astra)/';
     995    $patternDomainWpOptionsObject = '/wp_options(?=.*astra\-settings)/';
    996996
    997997    if (preg_match($pattern, $line)) {
    998998        if (!DTBPS_LOCAL_MODE && $backupSiteUrl !== "" && $backupSiteUrl !== $currentSiteUrl && preg_match($patternDomain, $line)) {
    999             // replace domains
    1000             $line = str_replace($backupSiteUrl, $currentSiteUrl, $line);
     999            // check if query matches
     1000            if (preg_match($patternDomainWpOptionsObject, $line)) {
     1001                $ptrn = '/s:\d+:\\\\"' . preg_quote($backupSiteUrl, '/') . '\/[^"]*\\\\";/';
     1002                preg_match_all($ptrn, $line, $matches, PREG_OFFSET_CAPTURE);
     1003
     1004                if (!empty($matches[0])) {
     1005                    $unique_matches = []; // Array to store unique matches
     1006
     1007                    foreach ($matches[0] as $match) {
     1008                            $matched_string = $match[0]; // The matched substring
     1009
     1010                            // Store unique matches using array_unique() and a simple array
     1011                            if (!in_array($matched_string, $unique_matches)) {
     1012                                $unique_matches[] = $matched_string; // Add only unique matched strings
     1013                            }
     1014                        }
     1015
     1016                    // Output unique matched strings
     1017                    foreach ($unique_matches as $unique_match) {
     1018                        $unserializedMatch = unserialize(str_replace('\"', '"', $unique_match));
     1019                        $replaced_unserialized_unique_match = str_replace($backupSiteUrl, $currentSiteUrl, $unserializedMatch);
     1020                        $serializedUnique = str_replace('"', '\"', serialize( $replaced_unserialized_unique_match));
     1021
     1022                        $line = str_replace($unique_match, $serializedUnique, $line);
     1023
     1024                    }
     1025                }
     1026            } else {
     1027                // plain replace domains
     1028                $line = str_replace($backupSiteUrl, $currentSiteUrl, $line);
     1029            }
     1030
    10011031        }
    10021032
  • deltabackups/trunk/readme.txt

    r3176146 r3176444  
    5353Also tested with MySql and MariaDB.
    5454Worked ok with PHP 5.6 and all above, last tested with 8.3
     55Tested with Astra, Elementor, Spectra, Kadence, Woocommerce and many more plugins!
    5556
    5657= Is there a scheduling feature? =
Note: See TracChangeset for help on using the changeset viewer.