Plugin Directory

Changeset 2346866


Ignore:
Timestamp:
07/26/2020 10:03:44 PM (6 years ago)
Author:
onionbazaar
Message:

update 1.0.1 to 1.0.2

Location:
backup-restore-manager
Files:
228 added
10 edited

Legend:

Unmodified
Added
Removed
  • backup-restore-manager/trunk/admin/schedule-sentence.php

    r2310552 r2346866  
    227227    $hmbkp_restoreinfo = null;
    228228    if ( strpos( $hmbkp_restore, 'complete' ) ) $hmbkp_restoreinfo = sprintf( esc_html__( '1. Move all files and folders within %s into a temporary subfolder, e.g. %s', 'backup-restore-manager' ), '<b>' . get_home_path() . '</b>', '<b>' . get_home_path() . 'temp/</b>' ) . '<br>
    229     ' . sprintf( esc_html__( '2. Extract the backup file into %s', 'backup-restore-manager' ), '<b>' . get_home_path() . '</b>' ) . '
     229    ' . sprintf( esc_html__( '2. Extract the backup file into %s', 'backup-restore-manager' ), '<b>' . get_home_path() . '</b> (use unzip with the -X flag to restore permissions and ownership)' ) . '
    230230    <br>
    231231    ' . sprintf( esc_html__( '3. Open your SQL Manager (usually phpmyadmin), delete + recreate your database (or create a new one) and import the sql-file from the backup (now located in %s). Delete the sql-file afterwards.', 'backup-restore-manager' ), '<b>' . get_home_path() . '</b>' ) . '<br>
     
    236236    ' . sprintf( esc_html__( '3. Update %s if your database name has changed.', 'backup-restore-manager' ), '<b>' . get_home_path() . 'wp-config.php</b>' ) . '<br>';
    237237    elseif ( strpos( $hmbkp_restore, 'file' ) ) $hmbkp_restoreinfo = sprintf( esc_html__( '1. Move all files and folders within %s into a temporary subfolder, e.g. %s', 'backup-restore-manager' ), '<b>' . get_home_path() . '</b>', '<b>' . get_home_path() . 'temp/</b>' ) . '<br>
    238     ' . sprintf( esc_html__( '2. Extract the backup file into %s', 'backup-restore-manager' ), '<b>' . get_home_path() . '</b>' ) . '   <br>
     238    ' . sprintf( esc_html__( '2. Extract the backup file into %s', 'backup-restore-manager' ), '<b>' . get_home_path() . '</b> (use unzip with the -X flag to restore permissions and ownership)' ) . ' <br>
    239239    ' . sprintf( esc_html__( '3. If your SQL credentials have changed since the backup, update %s accordingly', 'backup-restore-manager' ), '<b>' . get_home_path() . 'wp-config.php</b>' ) . '<br>
    240240    ' . esc_html__( '4. Delete the temporary subfolder from step 1 if the restore was successful', 'backup-restore-manager' );
     
    288288            <b>' . esc_html__( 'Restoring Backup..', 'backup-restore-manager' ) . '</b><br><br>
    289289            ' . $hmbkp_restore_file . '<br><br>
    290             <p style="margin: 10px;">' . esc_html__( 'Enter the following commands in the shell/console to restore this backup (Linux only):', 'backup-restore-manager' ) . '</p>
    291             <input type="text" style="width: 700px; padding: 3px; text-align: center; border: 1px solid #1d1d1d; background-color: #dcdcdc" value="chmod +x ' . plugin_dir_path(__DIR__) . 'restore.sh"><br>
    292             <input type="text" style="width: 700px; margin: 15px; padding: 3px; text-align: center; border: 1px solid #1d1d1d; background-color: #dcdcdc" value=". ' . plugin_dir_path(__DIR__) . 'restore.sh"><br>
     290            <p style="margin: 10px;">' . esc_html__( 'Enter the following command into the terminal to restore this backup:', 'backup-restore-manager' ) . '</p>
     291            <input type="text" style="width: 700px; margin-bottom: 15px; padding: 3px; text-align: center; border: 1px solid #1d1d1d; background-color: #dcdcdc" value="sudo bash ' . plugin_dir_path(__DIR__) . 'restore.sh"><br>
    293292            <form method="post" name="hmbkp_restore_confirm" action="' . $hmbkp_phpself . '?page=backup-restore-manager' . $hmbkp_schedule_id_str . '">
    294293            <input type="hidden" name="hmbkp_restore" value="' . $hmbkp_restore_file . '">
  • backup-restore-manager/trunk/backup-restore-manager.php

    r2310552 r2346866  
    44Plugin URI: https://wordpress.org/plugins/backup-restore-manager/
    55Description: Simple automated Backup and Restore of your WordPress Website.
    6 Version: 1.0.1
     6Version: 1.0.2
    77Author: OnionBazaar
    88Author URI: https://onionbazaar.org
  • backup-restore-manager/trunk/classes/class-path.php

    r2293954 r2346866  
    472472        }
    473473
     474        /* OBZMOD */
     475        // Don't remove the cron settings file
     476        if ( 'backup-restore-manager-cron' === $this->current()->getBasename() ) {
     477            return false;
     478        }
     479        /* OBZMOD */
     480
    474481        // Don't cleanup the backup running file
    475482        return ! preg_match( '/(.*-running)/', $this->current() );
  • backup-restore-manager/trunk/classes/class-plugin.php

    r2310552 r2346866  
    1010    const PLUGIN_VERSION = '3.6.4';
    1111    */
    12     const PLUGIN_VERSION = '1.0.1';
     12    const PLUGIN_VERSION = '1.0.2';
    1313    /* OBZMOD */
    1414    /**
     
    287287
    288288        // Fire the update action
    289         if ( self::PLUGIN_VERSION != get_option( 'hmbkp_plugin_version' ) ) {
     289        if ( self::PLUGIN_VERSION != get_option( 'obzbrm_plugin_version' ) ) {
    290290            update();
    291291        }
  • backup-restore-manager/trunk/functions/core.php

    r2293954 r2346866  
    99function update() {
    1010
    11     // Update from backUpWordPress 0.4.5
    12     if ( get_option( 'bkpwp_max_backups' ) ) {
    13 
    14         // Carry over the custom path
    15         if ( $legacy_path = get_option( 'bkpwppath' ) ) {
    16             update_option( 'hmbkp_path', $legacy_path );
    17         }
    18 
    19         // Options to remove
    20         $legacy_options = array(
    21             'bkpwp_archive_types',
    22             'bkpwp_automail_from',
    23             'bkpwp_domain',
    24             'bkpwp_domain_path',
    25             'bkpwp_easy_mode',
    26             'bkpwp_excludelists',
    27             'bkpwp_install_user',
    28             'bkpwp_listmax_backups',
    29             'bkpwp_max_backups',
    30             'bkpwp_presets',
    31             'bkpwp_reccurrences',
    32             'bkpwp_schedules',
    33             'bkpwp_calculation',
    34             'bkpwppath',
    35             'bkpwp_status_config',
    36             'bkpwp_status',
    37         );
    38 
    39         foreach ( $legacy_options as $option ) {
    40             delete_option( $option );
    41         }
    42 
    43         global $wp_roles;
    44 
    45         $wp_roles->remove_cap( 'administrator', 'manage_backups' );
    46         $wp_roles->remove_cap( 'administrator', 'download_backups' );
    47 
    48         wp_clear_scheduled_hook( 'bkpwp_schedule_bkpwp_hook' );
    49 
    50     }
    51 
    52     // Version 1 to 2
    53     if ( get_option( 'hmbkp_plugin_version' ) && version_compare( '2.0', get_option( 'hmbkp_plugin_version' ), '>' ) ) {
    54 
    55         /**
    56          * Setup a backwards compatible schedule
    57          */
    58         $legacy_schedule = new Scheduled_Backup( 'backup' );
    59 
    60         // Backup type
    61         if ( ( defined( 'HMBKP_FILES_ONLY' ) && HMBKP_FILES_ONLY ) || get_option( 'hmbkp_files_only' ) ) {
    62             $legacy_schedule->set_type( 'file' );
    63         } elseif ( ( defined( 'HMBKP_DATABASE_ONLY' ) && HMBKP_DATABASE_ONLY ) || get_option( 'hmbkp_database_only' ) ) {
    64             $legacy_schedule->set_type( 'database' );
    65         } else {
    66             $legacy_schedule->set_type( 'complete' );
    67         }
    68 
    69         // Daily schedule time
    70         if ( defined( 'HMBKP_DAILY_SCHEDULE_TIME' ) && HMBKP_DAILY_SCHEDULE_TIME ) {
    71             $legacy_schedule->set_schedule_start_time( strtotime( HMBKP_DAILY_SCHEDULE_TIME ) );
    72         }
    73 
    74         // Backup schedule
    75         $legacy_schedule->set_reoccurrence( get_option( 'hmbkp_schedule_frequency', 'daily' ) );
    76 
    77         // Automatic backups disabled?
    78         if ( ( defined( 'HMBKP_DISABLE_AUTOMATIC_BACKUP' ) && HMBKP_DISABLE_AUTOMATIC_BACKUP ) || get_option( 'hmbkp_disable_automatic_backup' ) ) {
    79             $legacy_schedule->set_reoccurrence( 'manually' );
    80         }
    81 
    82         // Max backups
    83         if ( defined( 'HMBKP_MAX_BACKUPS' ) && is_numeric( HMBKP_MAX_BACKUPS ) ) {
    84             $legacy_schedule->set_max_backups( (int) HMBKP_MAX_BACKUPS );
    85         } else {
    86             $legacy_schedule->set_max_backups( (int) get_option( 'hmbkp_max_backups', 10 ) );
    87         }
    88 
    89         // Excludes
    90         if ( get_option( 'hmbkp_excludes' ) ) {
    91             $legacy_schedule->set_excludes( get_option( 'hmbkp_excludes' ) );
    92         }
    93 
    94         // Backup email
    95         if ( defined( 'HMBKP_EMAIL' ) && is_email( HMBKP_EMAIL ) ) {
    96             $legacy_schedule->set_service_options( 'HMBKP_Email_Service', array( 'email' => HMBKP_EMAIL ) );
    97         } elseif ( is_email( get_option( 'hmbkp_email_address' ) ) ) {
    98             $legacy_schedule->set_service_options( 'HMBKP_Email_Service', array( 'email' => get_option( 'hmbkp_email_address' ) ) );
    99         }
    100 
    101         // Set the archive filename to what it used to be
    102         $legacy_schedule->backup_filename = implode( '-', array( get_bloginfo( 'name' ), 'backup', current_time( 'Y-m-d-H-i-s' ) ) ) . '.zip';
    103 
    104         $legacy_schedule->save();
    105 
    106         $legacy_path = get_option( 'hmbkp_path' );
    107 
    108         if ( $legacy_path ) {
    109 
    110             // Prepend 'backup-' to the beginning of any legacy backups so they are picked up by the legacy schedule
    111             if ( $handle = opendir( $legacy_path ) ) {
    112                 while ( false !== ( $file = readdir( $handle ) ) ) {
    113                     if ( 'zip' === pathinfo( $file, PATHINFO_EXTENSION ) ) {
    114                         rename( trailingslashit( $legacy_path ) . $file, trailingslashit( $legacy_path ) . 'backup-' . $file );
    115                     }
    116                 }
    117                 closedir( $handle );
    118             }
    119 
    120             PATH::get_instance()->move_old_backups( $legacy_path );
    121 
    122         }
    123 
    124         // Remove the legacy options
    125         foreach ( array( 'hmbkp_database_only', 'hmbkp_files_only', 'hmbkp_max_backups', 'hmbkp_email_address', 'hmbkp_email', 'hmbkp_schedule_frequency', 'hmbkp_disable_automatic_backup' ) as $option_name ) {
    126             delete_option( $option_name );
    127         }
    128     }
    129 
    130     // Update from 2.x to 3.0
    131     if ( get_option( 'hmbkp_plugin_version' ) && version_compare( '2.0', get_option( 'hmbkp_plugin_version' ), '>' ) ) {
    132 
    133         // Remove the plugin data cache
    134         delete_transient( 'hmbkp_plugin_data' );
    135 
    136     }
    137 
    138     // Update to 3.1
    139     if ( get_option( 'hmbkp_plugin_version' ) && version_compare( '3.0', get_option( 'hmbkp_plugin_version' ), '>' ) ) {
    140 
    141         // Remove the plugin data cache
    142         delete_option( 'hmbkp_path' );
    143         delete_option( 'hmbkp_default_path' );
    144 
    145     }
    146 
    147     // update to 3.1.4
    148     if ( get_option( 'hmbkp_plugin_version' ) && version_compare( '3.1.4', get_option( 'hmbkp_plugin_version' ), '>' ) ) {
    149 
    150         $old_option_names = array(
    151             'HM\BackUpWordPressDropbox\Dropbox_Service'    => 'dropbox',
    152             'HMBKP_DX_Backup_Service'                      => 'dropbox',
    153             'HM\BackUpWordPressFTP\FTP_Backup_Service'     => 'ftp',
    154             'HMBKP_FTP_Backup_Service'                     => 'ftp',
    155             'HM\BackUpWordPressGDrive\Google_Drive_BackUp' => 'google-drive',
    156             'HMBKP_GDV_Backup_Service'                     => 'google-drive',
    157             'HM\BackUpWordPressRackspace\RackSpace_BackUp' => 'rackspace-cloud',
    158             'HMBKP_RSC_Backup_Service'                     => 'rackspace-cloud',
    159             'HM\BackUpWordPressS3\S3_Backup'               => 's3',
    160             'HMBKP_S3_Backup_Service'                      => 's3',
    161             'HM\BackUpWordPressWinAzure\WinAzure_Backup'   => 'azure',
    162             'HMBKP_WAZ_Backup_Service'                     => 'azure',
    163             'HM\BackUpWordPress\Email_Service'             => 'email',
    164         );
    165 
    166         global $wpdb;
    167 
    168         // Get all schedule options with a SELECT query and delete them.
    169         $schedules = $wpdb->get_col( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s", 'hmbkp_schedule_%' ) );
    170 
    171         if ( 0 < count( $schedules ) ) {
    172 
    173             // Access each schedules settings to see if the addon settings names need to be be updated to the new naming convention which uses the service slug generated from the $name property.
    174             foreach ( $schedules as $schedule_id ) {
    175 
    176                 // Load the settings for this schedule into an array
    177                 // so we can loop through the different service settings
    178                 $schedule_settings = get_option( $schedule_id );
    179 
    180                 // Iterate over each schedule setting for this schedule and check its name against our array.
    181                 foreach ( $schedule_settings as $key => $val ) {
    182                     // Find the current element key in our control array and get its value. Set a new element in the settings array with the found value as its key. Aka rename the element key
    183                     if ( array_key_exists( $key, $old_option_names ) ) {
    184 
    185                         // move the value to our new key
    186                         $schedule_settings[ $old_option_names[ $key ] ] = $schedule_settings[ $key ];
    187 
    188                         unset( $schedule_settings[ $key ] );
    189 
    190                     }
    191                 }
    192 
    193                 // Save back to the DB
    194                 update_option( $schedule_id, $schedule_settings );
    195             }
    196         }
    197     }
    198 
    199     // Update to 3.1.5
    200     if ( get_option( 'hmbkp_plugin_version' ) && version_compare( '3.1.5', get_option( 'hmbkp_plugin_version' ), '>' ) ) {
    201 
    202         // Delete all transients
    203         $transients = array(
    204             'hmbkp_plugin_data',
    205             'hmbkp_directory_filesizes',
    206             'hmbkp_directory_filesizes_running',
    207             'hmbkp_wp_cron_test_beacon',
    208             'hm_backdrop',
    209         );
    210 
    211         array_map( 'delete_transient', $transients );
    212 
    213         // Clear duplicate schedules on multisite
    214         if ( is_multisite() ) {
    215 
    216             // get current blogs from DB
    217             $blogs = wp_get_sites();
    218 
    219             foreach ( $blogs as $blog ) {
    220 
    221                 switch_to_blog( get_current_blog_id() );
    222 
    223                 if ( is_main_site( get_current_blog_id() ) ) {
    224                     continue;
    225                 }
    226 
    227                 global $wpdb;
    228 
    229                 // Get the schedule options
    230                 $schedules = $wpdb->get_col( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s", 'hmbkp_schedule_%' ) );
    231 
    232                 // clear schedules
    233                 foreach ( array_map( function ( $item ) {
    234                     return ltrim( $item, 'hmbkp_schedule_' );
    235                 }, $schedules ) as $item ) {
    236                     wp_clear_scheduled_hook( 'hmbkp_schedule_hook', array( 'id' => $item ) );
    237                 }
    238 
    239                 // delete options
    240                 array_map( 'delete_option', $schedules );
    241 
    242                 array_map( 'delete_option', array( 'hmbkp_enable_support', 'hmbkp_plugin_version', 'hmbkp_path', 'hmbkp_default_path', 'hmbkp_upsell' ) );
    243 
    244                 // Delete all transients
    245                 array_map( 'delete_transient', array( 'hmbkp_plugin_data', 'hmbkp_directory_filesizes', 'hmbkp_directory_filesize_running', 'timeout_hmbkp_wp_cron_test_beacon', 'hmbkp_wp_cron_test_beacon' ) );
    246 
    247             }
    248 
    249             restore_current_blog();
    250         }
    251     }
    252 
    253     // Update from 3.3.0
    254     if ( get_option( 'hmbkp_plugin_version' ) && version_compare( '3.3.0', get_option( 'hmbkp_plugin_version' ), '>' ) ) {
    255 
    256         $schedules = Schedules::get_instance();
    257 
    258         // Loop through all schedules and re-set the reccurrence to include hmbkp_
    259         foreach ( $schedules->get_schedules() as $schedule ) {
    260 
    261             $reoccurrence = $schedule->get_reoccurrence();
    262 
    263             if ( 'manually' !== $reoccurrence && strpos( $reoccurrence, 'hmbkp_' ) === 0 ) {
    264                 $schedule->set_reoccurrence( substr( $reoccurrence, 6 ) );
    265             }
    266 
    267             $schedule->save();
    268 
    269         }
    270     }
    271 
    272     // Update from 3.3.4
    273     if ( get_option( 'hmbkp_plugin_version' ) && version_compare( '3.4.0', get_option( 'hmbkp_plugin_version' ), '>' ) ) {
    274         delete_transient( 'hmbkp_directory_filesizes' );
     11    // Remove old plugin version variable
     12    if ( get_option( 'hmbkp_plugin_version' ) && version_compare( '1.0.2', get_option( 'hmbkp_plugin_version' ), '>' ) ) {
     13        delete_option( 'hmbkp_plugin_version' );
    27514    }
    27615
    27716    // Every update
    278     if ( get_option( 'hmbkp_plugin_version' ) && version_compare( Plugin::PLUGIN_VERSION, get_option( 'hmbkp_plugin_version' ), '>' ) ) {
     17    if ( get_option( 'obzbrm_plugin_version' ) && version_compare( Plugin::PLUGIN_VERSION, get_option( 'obzbrm_plugin_version' ), '>' ) ) {
    27918
    28019        require_once( HMBKP_PLUGIN_PATH . 'classes/class-setup.php' );
     
    28726
    28827    // Update the stored version
    289     if ( get_option( 'hmbkp_plugin_version' ) !== Plugin::PLUGIN_VERSION ) {
    290         update_option( 'hmbkp_plugin_version', Plugin::PLUGIN_VERSION );
     28    if ( get_option( 'obzbrm_plugin_version' ) !== Plugin::PLUGIN_VERSION ) {
     29        update_option( 'obzbrm_plugin_version', Plugin::PLUGIN_VERSION );
    29130    }
    29231
  • backup-restore-manager/trunk/readme.txt

    r2310552 r2346866  
    55Requires at least: 3.9
    66Tested up to: 5.4.1
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88License: GNU General Public License v3.0
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    1515Backup & Restore Manager will back up your entire WordPress website including your database and all your files, manually or on a custom schedule.
    1616
    17 This is a fork of the popular backup software [BackUpWordPress](https://wordpress.org/plugins/backupwordpress) by HumanMade, which seems to be discontinued unfortunately. We continue maintenance and have extended the plugin with the ability to upload backup files and an automated restore feature.
     17Backup & Restore Manager is a fork of the popular backup software [BackUpWordPress](https://wordpress.org/plugins/backupwordpress) by HumanMade, which seems to be discontinued unfortunately. We continue maintenance and have extended the plugin with the ability to upload backup files and an automated restore feature.
    1818
    1919If you are already using BackUpWordPress, switching to Backup & Restore Manager will retain all your settings, schedules and backups (and vice versa).
     
    4242The plugin will try to use the `mysqldump` and `zip` commands via shell if they are available, using these will greatly improve the time it takes to back up your site.
    4343
    44 Protip: To enable fully automated restores, edit the file `backup-restore-manager-cron` in your backup directory from `no` to `yes` and set up a cronjob to call the script restore.sh every minute (located in the plugin directory).
     44Protip: To enable fully automated restores, edit the file `backup-restore-manager-cron` in your backup directory from `no` to `yes` and set up a cronjob to call the script `restore.sh` (located in the plugin directory) every minute (as root), e.g:
     45sudo crontab -e
     46* * * * * bash /var/www/html/wp-content/plugins/backup-restore-manager/restore.sh
    4547
    4648== Frequently Asked Questions ==
     
    103105== Changelog ==
    104106
     107= 1.0.2 - 2020-07-26 =
     108* Improved restore script, Bugfixes
     109
    105110= 1.0.1 - 2020-05-23 =
    106111* Minor changes restore script cronmode
  • backup-restore-manager/trunk/restore.sh

    r2310552 r2346866  
    1212else
    1313    echo "# ERROR: Wordpress directory not found. Edit this script if you are using a non-default directory structure."
    14     return
     14    exit
    1515fi
    1616
     
    2727
    2828if (( $hits == 0)); then
    29 
    3029    for BACKUPDIRPATH in $WPDIR/wp-content/uploads/*; do
    3130        [ -e "$BACKUPDIRPATH" ] || continue
     
    3736        fi
    3837    done
    39    
    4038    if (( $hits == 0)); then
    4139        echo "# ERROR: Backup directory not found. edit this script if you are using a non-default directory structure."
    42         return
     40        exit
    4341    fi
    4442fi
     
    6664    else
    6765        echo "# ERROR: Backuptype not detected. Make sure backup files are not renamed."
    68         return
     66        exit
    6967    fi
    7068else
    7169    echo "# No Restore Job found."
    72     return
     70    exit
    7371fi
    7472
     
    9290    SQLPASS=${SQLPASSR#"'"}
    9391    SQLPASS=${SQLPASS%"'"}
    94     echo "# Current SQL Password: [hidden]"
     92    echo "# Current SQL Password: $SQLPASS"
    9593   
    9694    if (($BACKUPTYPE < 3)); then
     
    104102    if [ ! -t 1 ] ; then
    105103        echo "# Could not retrieve SQL credentials from wp-config.php. Exiting."
    106         return
     104        exit
    107105    else
    108106        if [ -f "$WPDIR/wp-config.php" ]; then
     
    122120        if [ -z "$WPSITEURL" ]; then
    123121            echo "# ERROR: Could not get Website URL from Database, probably incorrect credentials. Try again."
    124             return
     122            exit
    125123        else
    126124            echo "# Current Site URL: $WPSITEURL"
     
    163161    BACKUPDIROLD="$WPDIR/backup-restore-manager-old/wp-content$BACKUPPRE/$(basename $BACKUPDIR)"
    164162    echo "# extracting $BACKUPFILE to $WPDIR ..."
    165     unzip -o -q "$BACKUPDIROLD/$BACKUPFILE" -d "$WPDIR"
     163    sudo unzip -X -o -q "$BACKUPDIROLD/$BACKUPFILE" -d "$WPDIR"
    166164   
    167165    #move backup directory
     
    217215        echo "# Site/Home URL unchanged"
    218216    else
    219         echo "# Site/Home URL changed, write them to database ..."
     217        if [ "$WPSITEURL" == "$WPHOME" ]; then
     218            echo "# Site/Home URL changed, replacing all occurences of $WPSITEURLBCK with $WPSITEURL in the database ..."
     219        else
     220            echo "# Site/Home URL changed, replacing all occurences of $WPSITEURLBCK with $WPSITEURL and $WPHOMEBCK with $WPHOME in the database ..."
     221        fi
    220222        mysql -h "$SQLHOST" -u "$SQLUSER" -p"$SQLPASS" -e "UPDATE $SQLDB.wp_options SET option_value = '$WPSITEURL' WHERE option_name ='siteurl'"
    221223        mysql -h "$SQLHOST" -u "$SQLUSER" -p"$SQLPASS" -e "UPDATE $SQLDB.wp_options SET option_value = '$WPHOME' WHERE option_name ='home'"
     224        if [ -f "$PLUGINDIR/sar/srdb.cli.php" ]; then
     225            php $PLUGINDIR/sar/srdb.cli.php -h "$SQLHOST" -u "$SQLUSER" -p "$SQLPASS" -n "$SQLDB" -s "$WPSITEURLBCK" -r "$WPSITEURL" -v false
     226            php $PLUGINDIR/sar/srdb.cli.php -h "$SQLHOST" -u "$SQLUSER" -p "$SQLPASS" -n "$SQLDB" -s "$WPHOMEBCK" -r "$WPHOME" -v false
     227        else
     228            echo "$PLUGINDIR/sar/srdb.cli.php not found (introduced in version 1.0.2). The restore was successful, but there are most likely still occurences of the old URL in the database."
     229        fi
    222230    fi
    223231    echo "# Database and File Restore Complete!"
     
    229237    #extract backupfile
    230238    echo "# extracting $BACKUPFILE to $WPDIR ..."
    231     unzip -o -q "$BACKUPDIR/$BACKUPFILE" -d "$WPDIR"
     239    sudo unzip -X -o -q "$BACKUPDIR/$BACKUPFILE" -d "$WPDIR"
    232240   
    233241    for SQLFILENAMEPATH in $WPDIR/database-$SITENAME*.sql; do
     
    251259        echo "# Site/Home URL unchanged"
    252260    else
    253         echo "# Site/Home URL changed, write them to database ..."
     261        if [ "$WPSITEURL" == "$WPHOME" ]; then
     262            echo "# Site/Home URL changed, replacing all occurences of $WPSITEURLBCK with $WPSITEURL in the database ..."
     263        else
     264            echo "# Site/Home URL changed, replacing all occurences of $WPSITEURLBCK with $WPSITEURL and $WPHOMEBCK with $WPHOME in the database ..."
     265        fi
    254266        mysql -h "$SQLHOST" -u "$SQLUSER" -p"$SQLPASS" -e "UPDATE $SQLDB.wp_options SET option_value = '$WPSITEURL' WHERE option_name ='siteurl'"
    255267        mysql -h "$SQLHOST" -u "$SQLUSER" -p"$SQLPASS" -e "UPDATE $SQLDB.wp_options SET option_value = '$WPHOME' WHERE option_name ='home'"
     268        if [ -f "$PLUGINDIR/sar/srdb.cli.php" ]; then
     269            php $PLUGINDIR/sar/srdb.cli.php -h "$SQLHOST" -u "$SQLUSER" -p "$SQLPASS" -n "$SQLDB" -s "$WPSITEURLBCK" -r "$WPSITEURL" -v false
     270            php $PLUGINDIR/sar/srdb.cli.php -h "$SQLHOST" -u "$SQLUSER" -p "$SQLPASS" -n "$SQLDB" -s "$WPHOMEBCK" -r "$WPHOME" -v false
     271        else
     272            echo "$PLUGINDIR/sar/srdb.cli.php not found (introduced in version 1.0.2). The restore was successful, but there are most likely still occurences of the old URL in the database."
     273        fi
    256274    fi
    257275    echo "# Database Restore Complete!"
     
    273291    BACKUPDIROLD="$WPDIR/backup-restore-manager-old/wp-content$BACKUPPRE/$(basename $BACKUPDIR)"
    274292    echo "# extracting $BACKUPFILE to $WPDIR ..."
    275     unzip -o -q "$BACKUPDIROLD/$BACKUPFILE" -d "$WPDIR"
     293    sudo unzip -X -o -q "$BACKUPDIROLD/$BACKUPFILE" -d "$WPDIR"
    276294
    277295    #get sql credentials from backup
  • backup-restore-manager/trunk/uninstall.php

    r2293954 r2346866  
    3636
    3737    // Remove all the options
     38    /* OBZMOD
    3839    array_map( 'delete_option', array( 'hmbkp_enable_support', 'hmbkp_plugin_version', 'hmbkp_path', 'hmbkp_default_path', 'hmbkp_upsell', 'hmbkp_notices' ) );
     40    */
     41    array_map( 'delete_option', array( 'hmbkp_enable_support', 'obzbrm_plugin_version', 'hmbkp_path', 'hmbkp_default_path', 'hmbkp_upsell', 'hmbkp_notices' ) );
     42    /* OBZMOD */
    3943
    4044    // Delete all transients
Note: See TracChangeset for help on using the changeset viewer.