Plugin Directory

Changeset 3129340


Ignore:
Timestamp:
08/01/2024 10:29:22 AM (20 months ago)
Author:
everestthemes
Message:

version 2.2.11 updated

Location:
everest-backup
Files:
344 added
14 edited

Legend:

Unmodified
Added
Removed
  • everest-backup/trunk/assets/js/backup.js

    r3114824 r3129340  
    261261        };
    262262        var lastHash = 0;
    263         var retry = 0;
    264         /** @since 2.2.7 */
     263        /** @since 2.0.0 */
    265264        var triggerSendBecon = function (data) {
    266265            if (data === void 0) { data = {}; }
    267             return __awaiter(_this, void 0, void 0, function () {
    268                 var t, result, response;
    269                 return __generator(this, function (_a) {
    270                     switch (_a.label) {
    271                         case 0:
    272                             t = +new Date();
    273                             return [4 /*yield*/, fetch("".concat(ajaxUrl, "?action=").concat(actions.export, "&everest_backup_ajax_nonce=").concat(_nonce, "&t=").concat(t), {
    274                                     method: "POST",
    275                                     headers: {
    276                                         "Content-Type": "application/json"
    277                                     },
    278                                     body: JSON.stringify(data),
    279                                 })];
    280                         case 1:
    281                             result = _a.sent();
    282                             response = result.json();
    283                             response.then(function (res) {
    284                                 retry = 0;
    285                                 if (res.success && res.data && res.data.result) {
    286                                     removeProcStatFile();
    287                                     renderLogs(res.data.logs, logsContainer);
    288                                     onBackupProcessSuccess(res.data.result);
    289                                     return;
    290                                 }
    291                                 if (res.success) {
    292                                     triggerSendBecon();
    293                                     return;
    294                                 }
    295                                 switch (res.status) {
    296                                     case 'done':
    297                                         removeProcStatFile();
    298                                         renderLogs(res.data.logs, logsContainer);
    299                                         onBackupProcessSuccess(res.data.result);
    300                                         break;
    301                                     case 'cloud':
    302                                         removeProcStatFile();
    303                                         onBackupProcessSuccess(res.data, res.message);
    304                                         break;
    305                                     case 'error':
    306                                         removeProcStatFile();
    307                                         onBackupProcessError();
    308                                         break;
    309                                     default:
    310                                         handleProcessDetails(res.detail);
    311                                         handleProgressInfo(res.message, res.progress);
    312                                         triggerSendBecon(res);
    313                                         break;
    314                                 }
    315                             }).catch(function (err) {
    316                                 retry++;
    317                                 handleProcessDetails("Failed to initiate connection, retrying...(" + retry + ")");
    318                                 if (retry > 3) {
    319                                     document.title = "EB: Error";
    320                                     handleProcessDetails("Failed to initiate connection, retry didn't work. Halting backup...");
    321                                     handleProcessDetails('=== Error ===');
    322                                     handleProcessDetails(err);
    323                                     handleProcessDetails('=== Error ===');
    324                                     handleProcessDetails('Note: Copy below error if required', true);
    325                                     return;
    326                                 }
    327                                 triggerSendBecon(data);
    328                             });
    329                             return [2 /*return*/];
    330                     }
    331                 });
    332             });
     266            var t = +new Date();
     267            /**
     268             * Send request to start backup.
     269             *
     270             * @since 1.0.7
     271             */
     272            return navigator.sendBeacon("".concat(ajaxUrl, "?action=").concat(actions.export, "&everest_backup_ajax_nonce=").concat(_nonce, "&t=").concat(t), JSON.stringify(data));
    333273        };
    334274        /**
     
    372312                                        if (!!res.next && res.next.length) {
    373313                                            if (res.hash !== lastHash) {
    374                                                 // triggerSendBecon(res);
     314                                                triggerSendBecon(res);
    375315                                            }
    376316                                            lastHash = res.hash;
    377317                                        }
    378                                         // setTimeout(onBeaconSent, resInterval);
     318                                        setTimeout(onBeaconSent, resInterval);
    379319                                        break;
    380320                                }
     
    394334                                handleProcessDetails("Waiting for response. Retrying: ".concat(retry));
    395335                                var retrySec = retry * 3000;
    396                                 // timeoutNumber = setTimeout(onBeaconSent, retrySec);
     336                                timeoutNumber = setTimeout(onBeaconSent, retrySec);
    397337                                retry++;
    398338                            });
     
    416356                    handleProcessDetails('The internet connection has been restored and is now active.');
    417357                    handleProcessDetails('=== You are now online ===');
    418                     // setTimeout(onBeaconSent, 3000);
     358                    setTimeout(onBeaconSent, 3000);
    419359                }
    420360            }
     
    422362            window.addEventListener('online', onNetworkStatusChange);
    423363            if (beaconSent) {
    424                 // onBeaconSent();
     364                onBeaconSent();
    425365            }
    426366            else {
     
    446386                    BackupCompleteModalFooter.style.display = "none";
    447387                }
    448                 triggerSendBecon(data);
    449                 displayModalUI(true);
    450                 if (true) {
     388                var beaconSent = triggerSendBecon(data);
     389                displayModalUI(beaconSent);
     390                if (beaconSent) {
    451391                    handleProcessDetails(locale.initializingBackup);
    452392                }
    453393                setTimeout(function () {
    454                     handleProcStats(true);
     394                    handleProcStats(beaconSent);
    455395                }, 500);
    456396            });
  • everest-backup/trunk/assets/js/backup.js.map

    r3114824 r3129340  
    1 {"version":3,"file":"backup.js","sourceRoot":"","sources":["../ts/backup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,CAAC;IAAA,iBAwjBA;IAvjBA,IAAM,SAAS,GAAG,gBAAgB,CAAC;IAEnC,IAAM,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,0BAA0B,CAAmB,CAAC;IAEpF,IAAA,OAAO,GAA2C,eAAe,QAA1D,EAAE,MAAM,GAAmC,eAAe,OAAlD,EAAE,MAAM,GAA2B,eAAe,OAA1C,EAAE,OAAO,GAAkB,eAAe,QAAjC,EAAE,WAAW,GAAK,eAAe,YAApB,CAAqB;IAE1E,IAAM,aAAa,GAAG,UAAC,MAAc;QACpC,OAAO,MAAM,CAAC,WAAW,EAAE;aACzB,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;aAClB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAC3B,CAAC,CAAA;IAED,IAAM,MAAM,GAAG;QACd,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC5C,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,UAAG,CAAC,IAAI,IAAI,EAAE,CAAE,CAAC,CAAC;QAC/C,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACvB,CAAC,CAAA;IAED,IAAM,oBAAoB,GAAG;QAE5B,IAAI,CAAC,aAAa,EAAE;YACnB,OAAO;SACP;QAED,IAAM,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC,kBAAkB,CAAqB,CAAC;QAE1F,IAAI,CAAC,aAAa,E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AC;QAE1C,MAAM,EAAE,CAAC;QACT,cAAc,EAAE,CAAC;QACjB,6BAA6B,EAAE,CAAC;QAChC,oBAAoB,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC"}
  • everest-backup/trunk/changelog.txt

    r3090233 r3129340  
    11== Changelog ==
     2
     3= v2.2.11 =
     4* Update: Save default WordPress and WooCommerce permalinks after restore.
     5* Update: Use ajax for updating backup/restore status.
     6* Fixed: Major issue fixed in restoring backups from auto-backup.
     7
     8= v2.2.10 =
     9* Update: Database backup optimization on auto-update.
     10* Update: Express backup option added in cli.
    211
    312= v2.2.9 =
  • everest-backup/trunk/everest-backup.php

    r3114824 r3129340  
    66 * Author: everestthemes
    77 * Author URI: https://everestthemes.com/
    8  * Version: 2.2.10
     8 * Version: 2.2.11
    99 * Text Domain: everest-backup
    1010 * License: GPLv3 or later
  • everest-backup/trunk/inc/core/import/class-wrapup.php

    r3114824 r3129340  
    184184        Logs::info( 'Flushing cache and clearing temporary files', 'everest-backup' );
    185185
     186        // Set the general permalink structure to the default value (e.g., /%postname%/)
     187        $default_structure = '/%postname%/';
     188        update_option( 'permalink_structure', $default_structure );
     189
     190        // Set WooCommerce specific permalinks
     191        $woocommerce_permalinks = array(
     192            'product_base'           => 'product',
     193            'category_base'          => 'product-category',
     194            'tag_base'               => 'product-tag',
     195            'attribute_base'         => '',
     196            'use_verbose_page_rules' => false
     197        );
     198
     199        // Serialize the array to match the format stored in the database
     200        $serialized_woocommerce_permalinks = maybe_serialize( $woocommerce_permalinks );
     201
     202        // Update WooCommerce permalinks option
     203        update_option( 'woocommerce_permalinks', $serialized_woocommerce_permalinks );
     204
    186205        flush_rewrite_rules();
    187206        everest_backup_elementor_cache_flush();
  • everest-backup/trunk/inc/functions.php

    r3114824 r3129340  
    8585    // @phpcs:disable
    8686    $args       = (array) $args;
    87     $seek       = !empty($args['seek']) ? $args['seek'] : 0;
     87    $seek       = ! empty( $args['seek'] ) ? $args['seek'] : 0;
    8888    $fo_mode    = 'ab';
    89     if (array_key_exists('seek', $args) && 0 === $args['seek']) {
     89    if (array_key_exists('seek', $args) && 0 === $args['seek'] ) {
    9090        $fo_mode = 'wb';
    91         if (file_exists($destination)) {
    92             unlink($destination);
    93         }
    94     }
    95 
    96     $local_file = fopen($destination, $fo_mode);
     91        if (file_exists( $destination)) {
     92            unlink( $destination);
     93        }
     94    }
     95
     96    $local_file = fopen( $destination, $fo_mode);
    9797
    9898    if (false === $local_file) {
     
    107107    $range   = $seek . '-' . $seek_to;
    108108
    109     curl_setopt($ch, CURLOPT_RANGE, $range);
     109    curl_setopt( $ch, CURLOPT_RANGE, $range);
    110110
    111111    // Set cURL options.
    112     curl_setopt($ch, CURLOPT_URL, $source);
    113     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    114     curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
     112    curl_setopt( $ch, CURLOPT_URL, $source);
     113    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
     114    curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout);
    115115
    116116    // Disable SSL certificate verification
    117     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    118     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
     117    curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
     118    curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false);
    119119
    120120    // Execute the cURL request.
    121     $response = curl_exec($ch);
    122 
    123     $http_code = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
     121    $response = curl_exec( $ch);
     122
     123    $http_code = (int) curl_getinfo( $ch, CURLINFO_HTTP_CODE);
    124124
    125125    if (206 === $http_code) {
     
    155155    $size         = $args['size'];
    156156    $download_url = $args['download_url'];
    157     $progress     = ($downloaded / $size) * 100;
    158     $progress     = ($progress > 100) ? 100 : $progress;
     157    $progress     = ( $downloaded / $size) * 100;
     158    $progress     = ( $progress > 100) ? 100 : $progress;
    159159
    160160    // Check for curl errors (at this stage it is usually timeout error).
    161     if (curl_errno($ch)) {
     161    if (curl_errno( $ch)) {
    162162        $error = 3;
    163163    }
    164164
    165     if ($success || (!$error && $write)) {
    166         fwrite($local_file, $response); // write to file if no error.
     165    if ( $success || (!$error && $write)) {
     166        fwrite( $local_file, $response); // write to file if no error.
    167167    }
    168168
    169169    if (!$success && $error) {
    170170        $retry = get_transient('everest_backup_migrate_clone_download_retry');
    171         $retry = $retry ? ($retry + 1) : 1;
    172         if ($retry > 3) {
     171        $retry = $retry ? ( $retry + 1) : 1;
     172        if ( $retry > 3) {
    173173            delete_transient('everest_backup_migrate_clone_download_retry');
    174174            $set_proc_array = array(
    175175                'status'       => 'in-process',
    176                 'progress'     => round($progress, 2),
     176                'progress'     => round( $progress, 2),
    177177                'message'      => sprintf(
    178178                    /* translators: */
     
    180180                ),
    181181                /* translators: */
    182                 'detail'       => sprintf(__('Download failure.', 'everest-backup'), esc_html($retry), esc_html(everest_backup_format_size($size))),
     182                'detail'       => sprintf(__('Download failure.', 'everest-backup'), esc_html( $retry), esc_html(everest_backup_format_size( $size))),
    183183                'download_url' => $download_url,
    184184                'size'         => $size,
     
    193193            $set_proc_array = array(
    194194                'status'       => 'in-process',
    195                 'progress'     => round($progress, 2),
     195                'progress'     => round( $progress, 2),
    196196                'message'      => sprintf(
    197197                    /* translators: */
     
    199199                ),
    200200                /* translators: */
    201                 'detail'       => sprintf(__('Download failure. Retrying(%1$s)', 'everest-backup'), esc_html($retry)),
     201                'detail'       => sprintf(__('Download failure. Retrying(%1$s)', 'everest-backup'), esc_html( $retry)),
    202202                'download_url' => $download_url,
    203203                'size'         => $size,
     
    206206            );
    207207        }
    208         $set_proc_array = array_merge($args, $set_proc_array);
    209         Logs::set_proc_stat($set_proc_array);
     208        $set_proc_array = array_merge( $args, $set_proc_array);
     209        Logs::set_proc_stat( $set_proc_array);
    210210    } elseif (!$complete) {
    211211        set_transient('everest_backup_migrate_clone_download_retry', 1);
    212212        $set_proc_array = array(
    213213            'status'       => 'in-process',
    214             'progress'     => round($progress, 2),
     214            'progress'     => round( $progress, 2),
    215215            'message'      => sprintf(
    216216                /* translators: */
    217217                __('Downloading file [ %1$s / %2$s ] : %3$d%% completed', 'everest-backup'),
    218                 esc_html(esc_html(everest_backup_format_size($seek + strlen($response)))),
    219                 esc_html(esc_html(everest_backup_format_size($size))),
    220                 esc_html($progress)
     218                esc_html(esc_html(everest_backup_format_size( $seek + strlen( $response)))),
     219                esc_html(esc_html(everest_backup_format_size( $size))),
     220                esc_html( $progress)
    221221            ),
    222222            /* translators: */
    223             'detail'       => sprintf(__('Downloaded: %1$s out of %2$s', 'everest-backup'), esc_html(everest_backup_format_size($seek + strlen($response))), esc_html(everest_backup_format_size($size))),
     223            'detail'       => sprintf(__('Downloaded: %1$s out of %2$s', 'everest-backup'), esc_html(everest_backup_format_size( $seek + strlen( $response))), esc_html(everest_backup_format_size( $size))),
    224224            'download_url' => $download_url,
    225225            'size'         => $size,
     
    227227            'next'         => 'check', // Set next to same.
    228228        );
    229         $set_proc_array = array_merge($args, $set_proc_array);
    230         Logs::set_proc_stat($set_proc_array);
     229        $set_proc_array = array_merge( $args, $set_proc_array);
     230        Logs::set_proc_stat( $set_proc_array);
    231231    }
    232232
    233233    // Close cURL and the local file.
    234     curl_close($ch);
    235     fclose($local_file);
     234    curl_close( $ch);
     235    fclose( $local_file);
    236236    // @phpcs:enable
    237237
     
    243243    delete_transient('everest_backup_migrate_clone_download');
    244244    delete_transient('everest_backup_migrate_clone_download_retry');
    245     return file_exists($destination) ? filesize($destination) : 0;
     245    return file_exists( $destination) ? filesize( $destination) : 0;
    246246}
    247247
     
    310310
    311311    // @phpcs:disable
    312     $handle = fopen($filename, 'r');
    313     $bytes = fread($handle, 3); // Read the first 3 bytes.
    314     fclose($handle);
     312    $handle = fopen( $filename, 'r');
     313    $bytes = fread( $handle, 3); // Read the first 3 bytes.
     314    fclose( $handle);
    315315    // @phpcs:enable
    316316
     
    666666
    667667        if ( 'in-process' === $res['status'] ) {
    668             $_args['params'] = $res;
    669668            if ( 'database' === $res['next'] ) {
    670669                everest_backup_export_wp_database();
    671670                $res['next'] = 'plugins';
    672671            }
     672            $_args['params'] = $res;
    673673            return everest_backup_compress_init( $_args );
    674674        }
     
    685685function everest_backup_disk_free_space( $directory ) {
    686686    if ( everest_backup_is_php_function_enabled( 'disk_free_space' ) ) {
    687         return disk_free_space($directory); // @phpcs:ignore
     687        return disk_free_space( $directory); // @phpcs:ignore
    688688    }
    689689
     
    11201120 * @since 1.0.1
    11211121 */
    1122 function everest_backup_addon_info($category, $slug)
    1123 {
    1124     $all_addons = everest_backup_fetch_addons($category);
    1125 
    1126     $addons = !empty($all_addons['data'][$category]) ? $all_addons['data'][$category] : '';
    1127 
    1128     if (!$addons) {
     1122function everest_backup_addon_info( $category, $slug ) {
     1123    $all_addons = everest_backup_fetch_addons( $category );
     1124
     1125    $addons = ! empty( $all_addons['data'][ $category ] ) ? $all_addons['data'][ $category ] : '';
     1126
     1127    if ( ! $addons ) {
    11291128        return;
    11301129    }
    11311130
    1132     $info = !empty($addons[$slug]) ? $addons[$slug] : '';
    1133 
    1134     if (!is_array($info)) {
     1131    $info = ! empty( $addons[ $slug ] ) ? $addons[ $slug ] : '';
     1132
     1133    if ( ! is_array( $info ) ) {
    11351134        return;
    11361135    }
     
    11391138    $plugin      = $slug . '/' . $slug . '.php';
    11401139
    1141     $installed = in_array($plugin, $ebwp_addons, true);
     1140    $installed = in_array( $plugin, $ebwp_addons, true );
    11421141
    11431142    $info['plugin']    = $plugin;
    11441143    $info['installed'] = $installed;
    1145     $info['active']    = $installed && is_plugin_active($plugin);
     1144    $info['active']    = $installed && is_plugin_active( $plugin );
    11461145
    11471146    /**
     
    11511150     * @since 1.0.2
    11521151     */
    1153     $info = apply_filters('everest_backup_filter_addon_info', $info, compact('category', 'slug'));
     1152    $info = apply_filters( 'everest_backup_filter_addon_info', $info, compact( 'category', 'slug' ) );
    11541153
    11551154    return $info;
     
    11611160 * @return array
    11621161 */
    1163 function everest_backup_fetch_upsell()
    1164 {
     1162function everest_backup_fetch_upsell() {
    11651163
    11661164    if (!defined('EVEREST_BACKUP_UPSELL_JSON_URL')) {
     
    11731171    static $data = array();
    11741172
    1175     if ($data) {
     1173    if ( $data) {
    11761174        return $data;
    11771175    }
     
    12001198    );
    12011199
    1202     if (!is_array(json_decode($json, true))) {
     1200    if (!is_array(json_decode( $json, true))) {
    12031201        return;
    12041202    }
    12051203
    1206     $decode = json_decode($json, true);
    1207 
    1208     if (!is_array($decode)) {
     1204    $decode = json_decode( $json, true);
     1205
     1206    if (!is_array( $decode)) {
    12091207        return;
    12101208    }
     
    12231221    $upsells = array();
    12241222
    1225     if (is_array($fields) && !empty($fields)) {
    1226         foreach ($fields as $field) {
    1227             if (!isset($decode[$field])) {
     1223    if (is_array( $fields) && ! empty( $fields)) {
     1224        foreach ( $fields as $field) {
     1225            if (! isset( $decode[ $field] )) {
    12281226                continue;
    12291227            }
    12301228
    1231             $_data = $decode[$field];
    1232 
    1233             switch ($field) {
     1229            $_data = $decode[ $field];
     1230
     1231            switch ( $field) {
    12341232                case 'domain':
    12351233                    $homeurl = str_replace(array('https://', 'http://'), '', home_url());
    12361234
    1237                     if (!empty($_data[$homeurl])) {
    1238                         $upsells[] = $_data[$homeurl];
     1235                    if (! empty( $_data[ $homeurl] )) {
     1236                        $upsells[] = $_data[ $homeurl];
    12391237                    }
    12401238
     
    12461244                    }
    12471245
    1248                     if (is_array($_data) && !empty($_data)) {
    1249                         foreach ($_data as $plugin_slug => $plugin_upsell) {
    1250                             if (is_plugin_active($plugin_slug)) {
     1246                    if (is_array( $_data) && ! empty( $_data)) {
     1247                        foreach ( $_data as $plugin_slug => $plugin_upsell) {
     1248                            if (is_plugin_active( $plugin_slug)) {
    12511249                                $upsells[] = $plugin_upsell['active'];
    12521250                            } else {
     
    12611259                    $active_theme = get_option('template', '');
    12621260
    1263                     if (!empty($_data[$active_theme])) {
    1264                         $upsells[] = $_data[$active_theme];
     1261                    if (! empty( $_data[ $active_theme] )) {
     1262                        $upsells[] = $_data[ $active_theme];
    12651263                    }
    12661264
     
    12701268                    $today = strtotime(date('d-m-Y')); // @phpcs:ignore
    12711269
    1272                     if (is_array($_data) && !empty($_data)) {
    1273                         foreach ($_data as $dates) {
    1274                             if (strtotime($dates['from']) > $today) {
     1270                    if (is_array( $_data) && ! empty( $_data)) {
     1271                        foreach ( $_data as $dates) {
     1272                            if (strtotime( $dates['from'] ) > $today) {
    12751273                                continue;
    12761274                            }
    12771275
    1278                             if ($today > strtotime($dates['to'])) {
     1276                            if ( $today > strtotime( $dates['to'] )) {
    12791277                                continue;
    12801278                            }
     
    12961294    }
    12971295
    1298     $data = array_values(array_filter(call_user_func_array('array_merge', $upsells)));
    1299 
    1300     $transient->set($data, DAY_IN_SECONDS);
     1296    $data = array_values( array_filter( call_user_func_array( 'array_merge', $upsells ) ) );
     1297
     1298    $transient->set( $data, DAY_IN_SECONDS );
    13011299
    13021300    return $data;
     
    13091307 * @return array
    13101308 */
    1311 function everest_backup_fetch_sidebar($page)
    1312 {
     1309function everest_backup_fetch_sidebar( $page ) {
    13131310
    13141311    /**
     
    13171314    static $json;
    13181315
    1319     if (!$json) {
    1320 
    1321         if (!class_exists('Everest_Backup\Transient')) {
     1316    if ( ! $json ) {
     1317        if ( ! class_exists( 'Everest_Backup\Transient' ) ) {
    13221318            require_once EVEREST_BACKUP_PATH . 'inc/classes/class-transient.php';
    13231319        }
    13241320
    1325         $transient = new Transient('fetch_sidebar');
    1326 
    1327         if (everest_backup_is_debug_on()) {
     1321        $transient = new Transient( 'fetch_sidebar' );
     1322
     1323        if ( everest_backup_is_debug_on() ) {
    13281324            $transient->delete();
    13291325        }
     
    13311327        $json = $transient->get();
    13321328
    1333         if (!$json) {
    1334 
    1335             $url = add_query_arg('t', time(), EVEREST_BACKUP_SIDEBAR_JSON_URL); // @since 1.1.2 For busting cache.
     1329        if ( ! $json ) {
     1330
     1331            $url = add_query_arg( 't', time(), EVEREST_BACKUP_SIDEBAR_JSON_URL ); // @since 1.1.2 For busting cache.
    13361332
    13371333            $res = wp_remote_get(
     
    13421338            );
    13431339
    1344             $json = wp_remote_retrieve_body($res);
    1345 
    1346             if (!is_array(json_decode($json, true))) {
     1340            $json = wp_remote_retrieve_body( $res );
     1341
     1342            if ( ! is_array( json_decode( $json, true ) ) ) {
    13471343                return;
    13481344            }
    13491345
    1350             $transient->set($json, HOUR_IN_SECONDS);
    1351         }
    1352     }
    1353 
    1354     if (!$json) {
     1346            $transient->set( $json, HOUR_IN_SECONDS );
     1347        }
     1348    }
     1349
     1350    if ( ! $json ) {
    13551351        return;
    13561352    }
    13571353
    1358     $decoded = json_decode($json, true);
    1359 
    1360     if (!is_array($decoded)) {
     1354    $decoded = json_decode( $json, true );
     1355
     1356    if ( ! is_array( $decoded ) ) {
    13611357        return;
    13621358    }
    13631359
    13641360    $data = array(
    1365         'links'  => !empty($decoded['links']) ? $decoded['links'] : array(),
    1366         'global' => !empty($decoded['global']) ? $decoded['global'] : array(),
    1367         'paged'  => !empty($decoded['paged'][$page]) ? $decoded['paged'][$page] : array(),
     1361        'links'  => ! empty( $decoded['links'] ) ? $decoded['links'] : array(),
     1362        'global' => ! empty( $decoded['global'] ) ? $decoded['global'] : array(),
     1363        'paged'  => ! empty( $decoded['paged'][ $page ] ) ? $decoded['paged'][ $page ] : array(),
    13681364    );
    13691365
     
    13741370 * Logs memory used.
    13751371 */
    1376 function everest_backup_log_memory_used()
    1377 {
    1378     if (everest_backup_is_debug_on()) {
     1372function everest_backup_log_memory_used() {
     1373    if ( everest_backup_is_debug_on() ) {
    13791374        /* translators: %s is the memory used value. */
    1380         Logs::info(sprintf(__('Memory used: %s', 'everest-backup'), everest_backup_format_size(memory_get_peak_usage(true))));
     1375        Logs::info( sprintf( __( 'Memory used: %s', 'everest-backup' ), everest_backup_format_size( memory_get_peak_usage( true ) ) ) );
    13811376    }
    13821377}
     
    13871382 * @return bool
    13881383 */
    1389 function everest_backup_is_debug_on()
    1390 {
    1391 
    1392     $is_enabled = (file_exists(wp_normalize_path(EVEREST_BACKUP_BACKUP_DIR_PATH . '/DEBUGMODEON')) || (defined('EVEREST_BACKUP_DEBUG') && EVEREST_BACKUP_DEBUG));
    1393 
    1394     return apply_filters('everest_backup_debug_mode', $is_enabled);
     1384function everest_backup_is_debug_on() {
     1385    $is_enabled = ( file_exists( wp_normalize_path( EVEREST_BACKUP_BACKUP_DIR_PATH . '/DEBUGMODEON' ) ) || ( defined( 'EVEREST_BACKUP_DEBUG' ) && EVEREST_BACKUP_DEBUG ) );
     1386
     1387    return apply_filters( 'everest_backup_debug_mode', $is_enabled );
    13951388}
    13961389
     
    14011394 * @since 1.0.0
    14021395 */
    1403 function everest_backup_is_localhost()
    1404 {
    1405     $whitelist   = array('127.0.0.1', '::1');
    1406     $remote_addr = !empty($_SERVER['REMOTE_ADDR']) ? sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'])) : '';
    1407     if (in_array($remote_addr, $whitelist, true)) {
     1396function everest_backup_is_localhost() {
     1397    $whitelist   = array( '127.0.0.1', '::1' );
     1398    $remote_addr = ! empty( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '';
     1399    if ( in_array( $remote_addr, $whitelist, true ) ) {
    14081400        return true;
    14091401    }
     
    14191411 * @since 1.0.8 `client_redirect` is now default query args parameter. No need to pass in $args.
    14201412 */
    1421 function everest_backup_add_redirect_url_query_arg($args = array())
    1422 {
     1413function everest_backup_add_redirect_url_query_arg( $args = array() ) {
    14231414    $redirect_url = EVEREST_BACKUP_AUTH_REDIRECT_URL;
    14241415
     
    14281419     * @since 1.0.8
    14291420     */
    1430     $args['client_redirect'] = network_admin_url('/admin.php?page=everest-backup-settings&tab=cloud');
    1431 
    1432     if (!empty($args['cloud'])) {
     1421    $args['client_redirect'] = network_admin_url( '/admin.php?page=everest-backup-settings&tab=cloud' );
     1422
     1423    if ( ! empty( $args['cloud'] ) ) {
    14331424        $args['client_redirect'] = add_query_arg(
    14341425            array(
     
    14391430    }
    14401431
    1441     $args['client_redirect'] = rawurlencode($args['client_redirect']);
    1442 
    1443     return add_query_arg($args, $redirect_url);
     1432    $args['client_redirect'] = rawurlencode( $args['client_redirect'] );
     1433
     1434    return add_query_arg( $args, $redirect_url );
    14441435}
    14451436
     
    14511442 * @since
    14521443 */
    1453 function everest_backup_remove_redirect_url_query_arg($key)
    1454 {
     1444function everest_backup_remove_redirect_url_query_arg( $key ) {
    14551445    $redirect_url = EVEREST_BACKUP_AUTH_REDIRECT_URL;
    14561446
    1457     return remove_query_arg($key, $redirect_url);
     1447    return remove_query_arg( $key, $redirect_url );
    14581448}
    14591449
     
    14651455 * @since 1.0.0
    14661456 */
    1467 function everest_backup_sanitize_array(array $data)
    1468 {
    1469     foreach ($data as $key => &$value) {
    1470         if (is_array($value)) {
    1471             $value = everest_backup_sanitize_array($value);
     1457function everest_backup_sanitize_array( array $data ) {
     1458    foreach ( $data as $key => &$value ) {
     1459        if ( is_array( $value ) ) {
     1460            $value = everest_backup_sanitize_array( $value );
    14721461        } else { // @phpcs:ignore
    1473             if (is_int($value)) {
     1462            if ( is_int( $value ) ) {
    14741463                $value = (int) $value;
    1475             } elseif (is_string($value)) {
    1476                 $value = sanitize_text_field(wp_unslash($value));
     1464            } elseif ( is_string( $value ) ) {
     1465                $value = sanitize_text_field( wp_unslash( $value ) );
    14771466            }
    14781467        }
     
    14901479 * @since 1.1.2 Added `everest_backup_filter_settings` filter hook.
    14911480 */
    1492 function everest_backup_get_settings($key = '')
    1493 {
    1494 
    1495     if ('debug' === $key) {
    1496         if (!everest_backup_is_debug_on()) {
     1481function everest_backup_get_settings( $key = '' ) {
     1482
     1483    if ( 'debug' === $key ) {
     1484        if ( ! everest_backup_is_debug_on() ) {
    14971485            // Bail if debug mode is off and values being asked for debugging purpose.
    14981486            return;
     
    15071495    $settings = apply_filters(
    15081496        'everest_backup_filter_settings',
    1509         get_option(EVEREST_BACKUP_SETTINGS_KEY, array())
     1497        get_option( EVEREST_BACKUP_SETTINGS_KEY, array() )
    15101498    );
    15111499
    1512     if ($key) {
    1513         return isset($settings[$key]) ? $settings[$key] : '';
     1500    if ( $key ) {
     1501        return isset( $settings[ $key ] ) ? $settings[ $key ] : '';
    15141502    }
    15151503
     
    15241512 * @since 1.0.0
    15251513 */
    1526 function everest_backup_update_settings($settings)
    1527 {
    1528 
    1529     if (!$settings) {
     1514function everest_backup_update_settings( $settings ) {
     1515    if ( ! $settings ) {
    15301516        return;
    15311517    }
    15321518
    1533     $sanitized_settings = everest_backup_sanitize_array($settings);
    1534 
    1535     update_option(EVEREST_BACKUP_SETTINGS_KEY, $sanitized_settings);
     1519    $sanitized_settings = everest_backup_sanitize_array( $settings );
     1520
     1521    update_option( EVEREST_BACKUP_SETTINGS_KEY, $sanitized_settings );
    15361522}
    15371523
     
    15421528 * @since 1.0.0
    15431529 */
    1544 function everest_backup_max_upload_size()
    1545 {
    1546 
     1530function everest_backup_max_upload_size() {
    15471531    $wp_limit = wp_max_upload_size();
    15481532
    1549     return (int) apply_filters('everest_backup_filter_max_upload_size', $wp_limit);
     1533    return (int) apply_filters( 'everest_backup_filter_max_upload_size', $wp_limit );
    15501534}
    15511535
     
    15561540 * @since 1.0.0
    15571541 */
    1558 function everest_backup_cron_cycles()
    1559 {
     1542function everest_backup_cron_cycles() {
    15601543    return apply_filters(
    15611544        'everest_backup_filter_cron_cycles',
     
    15631546            'everest_backup_hourly'  => array(
    15641547                'interval' => null, // Disabled.
    1565                 'display'  => __('Hourly ( PRO )', 'everest-backup'),
     1548                'display'  => __( 'Hourly ( PRO )', 'everest-backup' ),
    15661549            ),
    15671550            'everest_backup_daily'   => array(
    15681551                'interval' => DAY_IN_SECONDS, // 24 hours.
    1569                 'display'  => __('Daily', 'everest-backup'),
     1552                'display'  => __( 'Daily', 'everest-backup' ),
    15701553            ),
    15711554            'everest_backup_weekly'  => array(
    15721555                'interval' => WEEK_IN_SECONDS, // 1 week.
    1573                 'display'  => __('Weekly', 'everest-backup'),
     1556                'display'  => __( 'Weekly', 'everest-backup' ),
    15741557            ),
    15751558            'everest_backup_monthly' => array(
    15761559                'interval' => MONTH_IN_SECONDS, // 1 month.
    1577                 'display'  => __('Monthly', 'everest-backup'),
     1560                'display'  => __( 'Monthly', 'everest-backup' ),
    15781561            ),
    15791562        )
     
    15871570 * @since 1.0.0
    15881571 */
    1589 function everest_backup_package_locations()
    1590 {
     1572function everest_backup_package_locations() {
    15911573    return (array) apply_filters(
    15921574        'everest_backup_filter_package_locations',
    15931575        array(
    15941576            'server' => array(
    1595                 'label'       => __('Local Web Server', 'everest-backup'),
    1596                 'description' => __('Save the backup package locally on your host server.', 'everest-backup'),
     1577                'label'       => __( 'Local Web Server', 'everest-backup' ),
     1578                'description' => __( 'Save the backup package locally on your host server.', 'everest-backup' ),
    15971579                'is_active'   => true,
    15981580            ),
     
    16111593 * @since 2.1.
    16121594 */
    1613 function everest_backup_is_saving_to()
    1614 {
    1615     if (wp_doing_ajax()) {
    1616         $response = everest_backup_get_ajax_response(EVEREST_BACKUP_EXPORT_ACTION);
    1617 
    1618         if (!empty($response['save_to'])) {
     1595function everest_backup_is_saving_to() {
     1596    if ( wp_doing_ajax() ) {
     1597        $response = everest_backup_get_ajax_response( EVEREST_BACKUP_EXPORT_ACTION );
     1598        if ( ! empty( $response['save_to'] ) ) {
    16191599            return $response['save_to'];
    16201600        }
    16211601
    16221602        // @since 2.0.0
    1623         $configpath = everest_backup_current_request_storage_path(EVEREST_BACKUP_CONFIG_FILENAME);
    1624 
    1625         if (file_exists($configpath)) {
    1626             $decode = json_decode(file_get_contents($configpath), true); // @phpcs:ignore
    1627 
    1628             if (!empty($decode['Params']['save_to'])) {
     1603        $configpath = everest_backup_current_request_storage_path( EVEREST_BACKUP_CONFIG_FILENAME );
     1604
     1605        if ( file_exists( $configpath ) ) {
     1606            $decode = json_decode(file_get_contents( $configpath ), true); // @phpcs:ignore
     1607
     1608            if ( ! empty( $decode['Params']['save_to'] ) ) {
    16291609                return $decode['Params']['save_to'];
    16301610            }
     
    16341614    }
    16351615
    1636     if (wp_doing_cron()) {
    1637         $schedule_backup_data = everest_backup_get_settings('schedule_backup');
    1638         return !empty($schedule_backup_data['save_to']) ? $schedule_backup_data['save_to'] : 'server';
    1639     }
    1640 
    1641     if (defined('REST_REQUEST') && REST_REQUEST) {
    1642         $schedule_backup_data = everest_backup_get_settings('schedule_backup');
    1643         return !empty($schedule_backup_data['save_to']) ? $schedule_backup_data['save_to'] : 'server';
    1644     }
     1616    if ( wp_doing_cron() ) {
     1617        $schedule_backup_data = everest_backup_get_settings( 'schedule_backup' );
     1618        return ! empty( $schedule_backup_data['save_to'] ) ? $schedule_backup_data['save_to'] : 'server';
     1619    }
     1620
     1621    if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
     1622        if ( ! empty( $_REQUEST['cloud'] ) ) { // @phpcs:ignore
     1623            return sanitize_text_field( wp_unslash( $_REQUEST['cloud'] ) ); // @phpcs:ignore
     1624        }
     1625        $schedule_backup_data = everest_backup_get_settings( 'schedule_backup' );
     1626        return ! empty( $schedule_backup_data['save_to'] ) ? $schedule_backup_data['save_to'] : 'server';
     1627    }
     1628    return 'server';
    16451629}
    16461630
     
    16541638 * @since 1.0.0
    16551639 */
    1656 function everest_backup_array_search($array, $field, $values)
    1657 { // @phpcs:ignore
    1658     if (is_array($array) && !empty($array)) {
    1659         foreach ($array as $key => $val) {
    1660             if (!isset($val[$field])) {
     1640function everest_backup_array_search( $array, $field, $values ) { // @phpcs:ignore
     1641    if ( is_array( $array ) && ! empty( $array ) ) {
     1642        foreach ( $array as $key => $val ) {
     1643            if ( ! isset( $val[ $field ] ) ) {
    16611644                continue;
    16621645            }
    16631646
    1664             if (is_array($values)) {
    1665                 if (is_array($values) && !empty($values)) {
    1666                     foreach ($values as $value) {
    1667                         if ($value === $val[$field]) {
     1647            if ( is_array( $values ) ) {
     1648                if ( is_array( $values ) && ! empty( $values ) ) {
     1649                    foreach ( $values as $value ) {
     1650                        if ( $value === $val[ $field ] ) {
    16681651                            return $key;
    16691652                        }
     
    16721655            }
    16731656
    1674             if ($values === $val[$field]) {
     1657            if ( $values === $val[ $field ] ) {
    16751658                return $key;
    16761659            }
     
    17281711 * @since 2.0.0 Converted from class method to function.
    17291712 */
    1730 function everest_backup_generate_tags_from_params($params)
     1713function everest_backup_generate_tags_from_params( $params )
    17311714{
    17321715
     
    17351718    $tags = array();
    17361719
    1737     if (is_array($params) && !empty($params)) {
    1738         foreach ($params as $key => $value) {
    1739             if (!isset($excludes[$key])) {
     1720    if (is_array( $params) && ! empty( $params)) {
     1721        foreach ( $params as $key => $value) {
     1722            if (! isset( $excludes[ $key] )) {
    17401723                continue;
    17411724            }
    17421725
    1743             if (empty($excludes[$key]['type'])) {
     1726            if (empty( $excludes[ $key]['type'] )) {
    17441727                continue;
    17451728            }
    17461729
    1747             if (!absint($value)) {
     1730            if (!absint( $value)) {
    17481731                continue;
    17491732            }
    17501733
    1751             $tags[] = $excludes[$key]['type'];
     1734            $tags[] = $excludes[ $key]['type'];
    17521735        }
    17531736    }
     
    18081791 * @since 1.0.0
    18091792 */
    1810 function everest_backup_get_backup_file_info($backup_file)
     1793function everest_backup_get_backup_file_info( $backup_file )
    18111794{
    18121795
    1813     if (!is_file($backup_file)) {
     1796    if (!is_file( $backup_file)) {
    18141797        return array();
    18151798    }
    18161799
    18171800    return array(
    1818         'filename' => basename($backup_file),
     1801        'filename' => basename( $backup_file),
    18191802        'path'     => $backup_file,
    1820         'url'      => everest_backup_convert_file_path_to_url($backup_file),
    1821         'size'     => filesize($backup_file),
    1822         'time'     => filemtime($backup_file),
     1803        'url'      => everest_backup_convert_file_path_to_url( $backup_file),
     1804        'size'     => filesize( $backup_file),
     1805        'time'     => filemtime( $backup_file),
    18231806    );
    18241807}
     
    18311814 * @since 1.0.0
    18321815 */
    1833 function everest_backup_is_extension_excluded($file)
     1816function everest_backup_is_extension_excluded( $file )
    18341817{
    1835     if (!is_file($file)) {
     1818    if (!is_file( $file)) {
    18361819        return false;
    18371820    }
    18381821
    18391822    $general    = everest_backup_get_settings('general');
    1840     $extensions = !empty($general['exclude_files_by_extension']) ? $general['exclude_files_by_extension'] : '';
     1823    $extensions = ! empty( $general['exclude_files_by_extension'] ) ? $general['exclude_files_by_extension'] : '';
    18411824
    18421825    if (!$extensions) {
     
    18461829    $excluded = explode(', ', $extensions);
    18471830
    1848     $extension = pathinfo($file, PATHINFO_EXTENSION);
    1849 
    1850     return in_array($extension, $excluded, true);
     1831    $extension = pathinfo( $file, PATHINFO_EXTENSION);
     1832
     1833    return in_array( $extension, $excluded, true);
    18511834}
    18521835
     
    18591842 * @since 1.0.0
    18601843 */
    1861 function everest_backup_get_backup_full_path($backup_filename, $check = true)
     1844function everest_backup_get_backup_full_path( $backup_filename, $check = true )
    18621845{
    18631846
     
    18741857    }
    18751858
    1876     return is_file($backup_file_path) ? $backup_file_path : '';
     1859    return is_file( $backup_file_path) ? $backup_file_path : '';
    18771860}
    18781861
     
    18831866 * @return any
    18841867 */
    1885 function everest_backup_send_json($data = null)
     1868function everest_backup_send_json( $data = null )
    18861869{
    18871870    if (!apply_filters('everest_backup_disable_send_json', false)) {
    1888         wp_send_json($data);
     1871        wp_send_json( $data);
    18891872    }
    18901873
     
    19011884 * @since 1.0.0
    19021885 */
    1903 function everest_backup_send_success($data = null, $status_code = null, $options = 0)
     1886function everest_backup_send_success( $data = null, $status_code = null, $options = 0 )
    19041887{
    19051888
     
    19541937
    19551938    if (!$disable_send_json) {
    1956         wp_send_json_success($res, $status_code, $options);
     1939        wp_send_json_success( $res, $status_code, $options);
    19571940    }
    19581941}
     
    19671950 * @since 1.0.0
    19681951 */
    1969 function everest_backup_send_error($data = null, $status_code = null, $options = 0)
     1952function everest_backup_send_error( $data = null, $status_code = null, $options = 0 )
    19701953{
    19711954
     
    20212004
    20222005    if (!$disable_send_json) {
    2023         wp_send_json_error($res, $status_code, $options);
     2006        wp_send_json_error( $res, $status_code, $options);
    20242007    }
    20252008}
     
    20342017 * @since 1.0.4
    20352018 */
    2036 function everest_backup_get_submitted_data($type = 'request', $ajax = false)
     2019function everest_backup_get_submitted_data( $type = 'request', $ajax = false )
    20372020{
    20382021    $data = array();
    20392022
    2040     switch ($type) {
     2023    switch ( $type) {
    20412024        case 'post':
    20422025            $data = $_POST; // @phpcs:ignore
     
    20522035    }
    20532036
    2054     if ($ajax && wp_doing_ajax()) {
     2037    if ( $ajax && wp_doing_ajax()) {
    20552038        $inputstream = file_get_contents('php://input');
    2056         $data_decode = (array) json_decode($inputstream, true);
    2057         return array_merge($data, $data_decode);
     2039        $data_decode = (array) json_decode( $inputstream, true);
     2040        return array_merge( $data, $data_decode);
    20582041    }
    20592042
     
    20682051 * @since 1.0.0
    20692052 */
    2070 function everest_backup_get_ajax_response($action)
    2071 {
    2072     if (!wp_doing_ajax()) {
     2053function everest_backup_get_ajax_response( $action ) {
     2054    if ( ! wp_doing_ajax() ) {
    20732055        return array();
    20742056    }
    20752057
    2076     if (false === strpos(current_action(), 'everest_backup')) {
     2058    if ( false === strpos( current_action(), 'everest_backup' ) ) {
    20772059        return array();
    20782060    }
    20792061
    2080     if (!everest_backup_verify_nonce('everest_backup_ajax_nonce')) {
     2062    if ( ! everest_backup_verify_nonce( 'everest_backup_ajax_nonce' ) ) {
    20812063        /* translators: action */
    2082         $message = sprintf(__('Nonce verification failed. Action: "%s"', 'everest-backup'), esc_html($action));
    2083         Logs::error($message);
    2084         everest_backup_send_error($message);
    2085     }
    2086 
    2087     if (!current_user_can('manage_options')) {
    2088         $message = __('Permission denied.', 'everest-backup');
    2089         Logs::error($message);
    2090         everest_backup_send_error($message);
     2064        $message = sprintf( __( 'Nonce verification failed. Action: "%s"', 'everest-backup' ), esc_html( $action ) );
     2065        Logs::error( $message );
     2066        everest_backup_send_error( $message );
     2067    }
     2068
     2069    if ( ! current_user_can( 'manage_options' ) ) {
     2070        $message = __( 'Permission denied.', 'everest-backup' );
     2071        Logs::error( $message );
     2072        everest_backup_send_error( $message );
    20912073    }
    20922074
     
    20942076     * If nonce verified, lets bring things into action. No puns intended.
    20952077     */
    2096     $response = everest_backup_get_submitted_data('request', true);
    2097 
    2098     $res_action = !empty($response['action']) ? sanitize_text_field(wp_unslash($response['action'])) : '';
    2099 
    2100     $is_action_valid = is_array($action) ? in_array($res_action, $action, true) : ($res_action === $action);
    2101 
    2102     if (!$is_action_valid) {
    2103         $message = __('Invalid action provided.', 'everest-backup');
    2104         Logs::error($message);
     2078    $response = everest_backup_get_submitted_data( 'request', true );
     2079
     2080    $res_action = ! empty( $response['action'] ) ? sanitize_text_field( wp_unslash( $response['action'] ) ) : '';
     2081
     2082    $is_action_valid = is_array( $action ) ? in_array( $res_action, $action, true ) : ( $res_action === $action );
     2083
     2084    if ( ! $is_action_valid ) {
     2085        $message = __( 'Invalid action provided.', 'everest-backup' );
     2086        Logs::error( $message );
    21052087        Logs::$is_sensitive = true;
    21062088        /* translators: expected action and received */
    2107         Logs::error(sprintf(__('Expected action: %1$s Received: %2$s', 'everest-backup'), esc_html($action), esc_html($res_action)));
     2089        Logs::error( sprintf( __( 'Expected action: %1$s Received: %2$s', 'everest-backup' ), esc_html( $action ), esc_html( $res_action ) ) );
    21082090        Logs::$is_sensitive = false;
    2109         everest_backup_send_error($message);
    2110     }
    2111 
    2112     if (!isset($response['cloud'])) {
     2091        everest_backup_send_error( $message );
     2092    }
     2093
     2094    if ( ! isset( $response['cloud'] ) ) {
    21132095        $response['cloud'] = 'server';
    21142096    }
     
    21272109    $general = everest_backup_get_settings('general');
    21282110
    2129     return !empty($general['admin_email']) ? $general['admin_email'] : get_option('admin_email');
     2111    return ! empty( $general['admin_email'] ) ? $general['admin_email'] : get_option('admin_email');
    21302112}
    21312113
     
    21812163     */
    21822164    set_error_handler( // @phpcs:ignore
    2183         function ($errno, $message, $file, $line) {
     2165        function ( $errno, $message, $file, $line) {
    21842166            if (!$message) {
    21852167                return;
     
    21872169
    21882170            /* translators: %1$s is the error message, %2$s is the file path and %3$s is the file line number. */
    2189             $error = sprintf(__('%1$s in %2$s on line %3$s'), esc_html($message), esc_url_raw($file), absint($line));
    2190 
    2191             switch ($errno) {
     2171            $error = sprintf(__('%1$s in %2$s on line %3$s'), esc_html( $message), esc_url_raw( $file), absint( $line));
     2172
     2173            switch ( $errno) {
    21922174
    21932175                case E_WARNING:
    2194                     Logs::warn($error);
     2176                    Logs::warn( $error);
    21952177                    break;
    21962178
    21972179                case E_USER_WARNING:
    2198                     Logs::warn($error);
     2180                    Logs::warn( $error);
    21992181                    break;
    22002182
    22012183                case E_NOTICE:
    2202                     Logs::warn($error);
     2184                    Logs::warn( $error);
    22032185                    break;
    22042186
    22052187                case E_USER_NOTICE:
    2206                     Logs::warn($error);
     2188                    Logs::warn( $error);
    22072189                    break;
    22082190
    22092191                case E_USER_ERROR:
    2210                     Logs::error($error);
     2192                    Logs::error( $error);
    22112193                    break;
    22122194
    22132195                default:
    2214                     Logs::error($error);
     2196                    Logs::error( $error);
    22152197                    break;
    22162198            }
     
    22272209            $last_error = error_get_last();
    22282210
    2229             if (!is_array($last_error)) {
     2211            if (!is_array( $last_error)) {
    22302212                return;
    22312213            }
    22322214
    2233             if (in_array($last_error['type'], array(2, 8, 32, 128, 512, 1024, 8192, 16384), true)) {
     2215            if (in_array( $last_error['type'], array(2, 8, 32, 128, 512, 1024, 8192, 16384), true)) {
    22342216                return;
    22352217            }
    22362218
    22372219            /* translators: %1$s is the error message, %2$s is the file path and %3$s is the file line number. */
    2238             $error = sprintf(__('%1$s in %2$s on line %3$s'), esc_html($last_error['message']), esc_url_raw($last_error['file']), absint($last_error['line']));
    2239 
    2240             Logs::error($error);
    2241 
    2242             if (E_ERROR === $last_error['type']) {
     2220            $error = sprintf(__('%1$s in %2$s on line %3$s'), esc_html( $last_error['message'] ), esc_url_raw( $last_error['file'] ), absint( $last_error['line'] ));
     2221
     2222            Logs::error( $error);
     2223
     2224            if (E_ERROR === $last_error['type'] ) {
    22432225
    22442226                /**
     
    22832265 * @since 1.0.0
    22842266 */
    2285 function everest_backup_nonce_field($action, $referer = true)
     2267function everest_backup_nonce_field( $action, $referer = true )
    22862268{
    2287     if ($action) {
    2288         return wp_nonce_field($action, $action, $referer);
     2269    if ( $action) {
     2270        return wp_nonce_field( $action, $action, $referer);
    22892271    }
    22902272}
     
    22972279 * @since 1.0.0
    22982280 */
    2299 function everest_backup_create_nonce($action)
     2281function everest_backup_create_nonce( $action )
    23002282{
    2301     if ($action) {
    2302         return wp_create_nonce($action);
     2283    if ( $action) {
     2284        return wp_create_nonce( $action);
    23032285    }
    23042286}
     
    23122294 * @since 1.0.0
    23132295 */
    2314 function everest_backup_verify_nonce($action)
     2296function everest_backup_verify_nonce( $action )
    23152297{
    23162298
    2317     $nonce = !empty($_REQUEST[$action]) ? sanitize_text_field(wp_unslash($_REQUEST[$action])) : '';
    2318 
    2319     if ($nonce && $action) {
    2320         return wp_verify_nonce($nonce, $action);
     2299    $nonce = ! empty( $_REQUEST[ $action] ) ? sanitize_text_field(wp_unslash( $_REQUEST[ $action] )) : '';
     2300
     2301    if ( $nonce && $action) {
     2302        return wp_verify_nonce( $nonce, $action);
    23212303    }
    23222304}
     
    23312313{
    23322314    $upload_dir = wp_upload_dir(null, false);
    2333     if ($upload_dir) {
    2334         if (!empty($upload_dir['basedir'])) {
    2335             return trailingslashit($upload_dir['basedir']);
     2315    if ( $upload_dir) {
     2316        if (! empty( $upload_dir['basedir'] )) {
     2317            return trailingslashit( $upload_dir['basedir'] );
    23362318        }
    23372319    }
     
    23472329{
    23482330    $upload_dir = wp_upload_dir(null, false);
    2349     if ($upload_dir) {
    2350         if (!empty($upload_dir['baseurl'])) {
    2351             return trailingslashit($upload_dir['baseurl']);
     2331    if ( $upload_dir) {
     2332        if (! empty( $upload_dir['baseurl'] )) {
     2333            return trailingslashit( $upload_dir['baseurl'] );
    23522334        }
    23532335    }
     
    23612343 * @since 1.0.0
    23622344 */
    2363 function everest_backup_convert_file_path_to_url($file)
     2345function everest_backup_convert_file_path_to_url( $file )
    23642346{
    23652347
     
    23712353    $homeurl = wp_normalize_path(trailingslashit(site_url()));
    23722354
    2373     return str_replace($abspath, $homeurl, $file);
     2355    return str_replace( $abspath, $homeurl, $file);
    23742356}
    23752357
     
    23982380    $sidebar_json = everest_backup_fetch_sidebar(null);
    23992381
    2400     return !empty($sidebar_json['links']['issue_reporter']) ? $sidebar_json['links']['issue_reporter'] : '';
     2382    return ! empty( $sidebar_json['links']['issue_reporter'] ) ? $sidebar_json['links']['issue_reporter'] : '';
    24012383}
    24022384
     
    24212403    );
    24222404
    2423     if (count($display_name_explode) > 1) {
     2405    if (count( $display_name_explode) > 1) {
    24242406        $data['first_name'] = $display_name_explode[0];
    2425         $data['last_name']  = $display_name_explode[everest_backup_array_key_last($display_name_explode)];
     2407        $data['last_name']  = $display_name_explode[everest_backup_array_key_last( $display_name_explode)];
    24262408    }
    24272409
     
    24542436    }
    24552437
    2456     $token = $session_token[everest_backup_array_key_last($session_token)];
     2438    $token = $session_token[everest_backup_array_key_last( $session_token)];
    24572439
    24582440    return array(
    2459         'ip' => !empty($token['ip']) ? $token['ip'] : '',
    2460         'ua' => !empty($token['ua']) ? $token['ua'] : '',
     2441        'ip' => ! empty( $token['ip'] ) ? $token['ip'] : '',
     2442        'ua' => ! empty( $token['ua'] ) ? $token['ua'] : '',
    24612443    );
    24622444}
     
    24722454    $htaccess = EVEREST_BACKUP_HTACCESS_PATH;
    24732455
    2474     if (is_file($htaccess)) {
    2475         return file_get_contents($htaccess); // @phpcs:ignore
     2456    if (is_file( $htaccess)) {
     2457        return file_get_contents( $htaccess); // @phpcs:ignore
    24762458    }
    24772459}
     
    24842466 * @since 1.0.0
    24852467 */
    2486 function everest_backup_str2hex($_string)
     2468function everest_backup_str2hex( $_string )
    24872469{
    2488     if (is_string($_string)) {
     2470    if (is_string( $_string)) {
    24892471        $hexstr = unpack('H*', $_string);
    2490         return array_shift($hexstr);
     2472        return array_shift( $hexstr);
    24912473    }
    24922474}
     
    24992481 * @since 1.0.0
    25002482 */
    2501 function everest_backup_hex2str($_string)
     2483function everest_backup_hex2str( $_string )
    25022484{
    2503     if (is_string($_string)) {
     2485    if (is_string( $_string)) {
    25042486        return hex2bin("$_string");
    25052487    }
     
    25142496 * @since 1.0.0
    25152497 */
    2516 function everest_backup_render_view($template, $args = array())
     2498function everest_backup_render_view( $template, $args = array() )
    25172499{
    25182500    $file = wp_normalize_path(EVEREST_BACKUP_VIEWS_DIR . $template . '.php');
    25192501
    2520     if (!file_exists($file)) {
     2502    if (!file_exists( $file)) {
    25212503        return;
    25222504    }
     
    25282510    do_action('everest_backup_before_view_rendered', $template, $args);
    25292511
    2530     load_template($file, false, $args);
     2512    load_template( $file, false, $args);
    25312513
    25322514    do_action('everest_backup_after_view_rendered', $template, $args);
     
    25442526 * @since 1.0.0
    25452527 */
    2546 function everest_backup_set_notice($notice, $type)
     2528function everest_backup_set_notice( $notice, $type )
    25472529{ // @phpcs:ignore
    25482530    if (!session_id()) {
     
    25542536    }
    25552537
    2556     $notices                 = isset($_SESSION['ebwp_notice']) ? everest_backup_sanitize_array($_SESSION['ebwp_notice']) : array(); // @phpcs:ignore
     2538    $notices                 = isset( $_SESSION['ebwp_notice'] ) ? everest_backup_sanitize_array( $_SESSION['ebwp_notice'] ) : array(); // @phpcs:ignore
    25572539    $_SESSION['ebwp_notice'] = compact('notice', 'type');
    25582540}
     
    25722554 * @since 1.0.0
    25732555 */
    2574 function everest_backup_package_location_dropdown($args)
     2556function everest_backup_package_location_dropdown( $args )
    25752557{
    25762558
     
    25862568    );
    25872569
    2588     $package_locations = !empty($parsed_args['package_locations']) ? $parsed_args['package_locations'] : everest_backup_package_locations();
     2570    $package_locations = ! empty( $parsed_args['package_locations'] ) ? $parsed_args['package_locations'] : everest_backup_package_locations();
    25892571    $name              = $parsed_args['name'];
    25902572    $id                = $parsed_args['id'];
     
    25942576    ob_start();
    25952577    ?>
    2596     <select name="<?php echo esc_attr($name); ?>" id="<?php echo esc_attr($id); ?>" class="<?php echo esc_attr($class); ?>">
     2578    <select name="<?php echo esc_attr( $name); ?>" id="<?php echo esc_attr( $id); ?>" class="<?php echo esc_attr( $class); ?>">
    25972579        <?php
    2598         if (is_array($package_locations) && !empty($package_locations)) {
    2599             foreach ($package_locations as $key => $package_location) {
     2580        if (is_array( $package_locations) && ! empty( $package_locations)) {
     2581            foreach ( $package_locations as $key => $package_location) {
    26002582        ?>
    26012583                <option <?php
    2602                         selected($selected, $key);
    2603                         disabled((false === $package_location['is_active']));
    2604                         ?> value="<?php echo esc_attr($key); ?>" title="<?php echo esc_attr($package_location['description']); ?>">
    2605                     <?php echo esc_html($package_location['label']); ?> (&#8505;)
     2584                        selected( $selected, $key);
     2585                        disabled((false === $package_location['is_active'] ));
     2586                        ?> value="<?php echo esc_attr( $key); ?>" title="<?php echo esc_attr( $package_location['description'] ); ?>">
     2587                    <?php echo esc_html( $package_location['label'] ); ?> (&#8505;)
    26062588                </option>
    26072589        <?php
     
    29552937        $parts2     = array_pad( $parts2, $max_length, 0 );
    29562938
    2957         for ($i = 0; $i < $max_length; $i++) {
     2939        for ( $i = 0; $i < $max_length; $i++) {
    29582940            $part1 = intval( $parts1[ $i ] );
    29592941            $part2 = intval( $parts2[ $i ] );
     
    29992981}
    30002982
    3001 if (!function_exists('everest_backup_our_plugin_list')) {
     2983if ( ! function_exists( 'everest_backup_our_plugin_list' ) ) {
    30022984    /**
    30032985     * Array list of all our plugins.
     
    30223004}
    30233005
    3024 if (!function_exists('everest_backup_set_our_active_plugin_list')) {
     3006if ( ! function_exists( 'everest_backup_set_our_active_plugin_list' ) ) {
    30253007    /**
    30263008     * Set active plugins.
     
    30333015        $our_plugins = everest_backup_our_plugin_list();
    30343016
    3035         $our_active_plugins = array_intersect($our_plugins, $active_plugins);
     3017        $our_active_plugins = array_intersect( $our_plugins, $active_plugins);
    30363018
    30373019        update_option('everest_backup_active_plugins', $our_active_plugins);
     
    30393021}
    30403022
    3041 if (!function_exists('everest_backup_unset_rest_properties')) {
     3023if ( ! function_exists( 'everest_backup_unset_rest_properties' ) ) {
    30423024    /**
    30433025     * Generate random auth code.
     
    30593041}
    30603042
    3061 if (!function_exists('everest_backup_pro_active')) {
     3043if ( ! function_exists( 'everest_backup_pro_active' ) ) {
    30623044    /**
    30633045     * Check if pro version is active.
     
    30693051}
    30703052
    3071 if (!function_exists('everest_backup_2fa_active')) {
     3053if ( ! function_exists( 'everest_backup_2fa_active' ) ) {
    30723054    /**
    30733055     * Check if 2fa is active.
     
    30773059        if (everest_backup_pro_active()) {
    30783060            $settings = everest_backup_get_settings('general');
    3079             if (!empty($settings['enabled_2fa']) && !empty($settings['2fa-authentication-email'])) {
     3061            if (! empty( $settings['enabled_2fa'] ) && ! empty( $settings['2fa-authentication-email'] )) {
    30803062                return true;
    30813063            }
     
    30853067}
    30863068
    3087 if (!function_exists('everest_backup_2fa_check_otp')) {
     3069if ( ! function_exists( 'everest_backup_2fa_check_otp' ) ) {
    30883070    /**
    30893071     * Check OTP.
     
    30913073     * @param string $otp OTP.
    30923074     */
    3093     function everest_backup_2fa_check_otp($otp)
     3075    function everest_backup_2fa_check_otp( $otp)
    30943076    {
    30953077        if (everest_backup_2fa_active()) {
     
    31073089            );
    31083090
    3109             return json_decode(wp_remote_retrieve_body($response), true);
     3091            return json_decode(wp_remote_retrieve_body( $response), true);
    31103092        }
    31113093        return false;
     
    31133095}
    31143096
    3115 if (!function_exists('everest_backup_2fa_check_recovery_code')) {
     3097if ( ! function_exists( 'everest_backup_2fa_check_recovery_code' ) ) {
    31163098    /**
    31173099     * Check Recovery Code.
     
    31193101     * @param string $recovery_code Recovery Code.
    31203102     */
    3121     function everest_backup_2fa_check_recovery_code($recovery_code)
     3103    function everest_backup_2fa_check_recovery_code( $recovery_code)
    31223104    {
    31233105        if (everest_backup_2fa_active()) {
     
    31353117            );
    31363118
    3137             return json_decode(wp_remote_retrieve_body($response), true);
     3119            return json_decode(wp_remote_retrieve_body( $response), true);
    31383120        }
    31393121        return false;
     
    31413123}
    31423124
    3143 if (!function_exists('everest_backup_export_wp_database')) {
     3125if ( ! function_exists( 'everest_backup_export_wp_database' ) ) {
    31443126    /**
    31453127     * Create databae backup.
     
    31483130     */
    31493131    function everest_backup_export_wp_database( $tables = array() ) {
    3150         $tables = (is_array($tables) && !empty($tables)) ? $tables : array();
     3132        $tables = (is_array( $tables) && ! empty( $tables)) ? $tables : array();
    31513133
    31523134        // Ensure only authorized users can access this function.
    3153         if (!current_user_can('manage_options')) {
     3135        if ( ! current_user_can( 'manage_options' ) ) {
    31543136            return;
    31553137        }
     
    31583140        $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
    31593141
    3160         if ($mysqli->connect_error) {
     3142        if ( $mysqli->connect_error ) {
    31613143            return new WP_Error('Connection error: ' . $mysqli->connect_error);
    31623144        }
     
    31663148
    31673149        // Get all of the tables if not provided.
    3168         if (empty($tables)) {
     3150        if (empty( $tables)) {
    31693151            $result = $mysqli->query('SHOW TABLES');
    3170             while ($row = $result->fetch_array(MYSQLI_NUM)) {
     3152            while ( $row = $result->fetch_array(MYSQLI_NUM)) {
    31713153                $tables[] = $row[0];
    31723154            }
    31733155        }
    31743156
     3157        $path    = everest_backup_current_request_storage_path( EVEREST_BACKUP_CONFIG_FILENAME );
     3158        $content = @file_get_contents( $path );
     3159        $config  = $content ? json_decode( $content, true ) : array();
     3160
     3161        if ( ! $config ) {
     3162            $config = array();
     3163        }
     3164
     3165        $config['Database']['Tables'] = $tables;
     3166
     3167        if ( ! Temp_Directory::init()->add_to_temp( $path, wp_json_encode( $config ), false ) ) {
     3168            $error = __( 'Could not write tables to config file.', 'everest-backup' );
     3169            Logs::error( $error );
     3170            everest_backup_send_error();
     3171            die;
     3172        }
     3173
     3174        $backup_path = everest_backup_current_request_storage_path( 'ebwp-database' );
     3175        if ( ! is_dir( $backup_path ) ) {
     3176            mkdir( $backup_path, 0777, true );
     3177        }
     3178
    31753179        // Cycle through the tables.
    3176         foreach ($tables as $table) {
     3180        foreach ( $tables as $table) {
    31773181            // Script Variables.
    3178             $backup_path = everest_backup_current_request_storage_path( 'ebwp-database' );
    31793182            $filename    = $backup_path . DIRECTORY_SEPARATOR . $table . '.sql';
    31803183   
    31813184            // Open file for writing.
    3182             $handle = fopen($filename, 'w+');
    3183             if (!$handle) {
    3184                 return new WP_Error('Error creating database backup. Please check the directory permissions.');
     3185            $handle = fopen( $filename, 'w+' );
     3186            if ( ! $handle ) {
     3187                return new WP_Error( 'Error creating database backup. Please check the directory permissions.' );
    31853188            }
    31863189   
    31873190            // Start transaction.
    3188             fwrite($handle, "START TRANSACTION;\n\n");
     3191            fwrite( $handle, "START TRANSACTION;\n\n");
    31893192
    31903193            // Table structure.
    31913194            $result = $mysqli->query("SHOW CREATE TABLE $table");
    3192             if (!$result) {
     3195            if ( ! $result ) {
    31933196                continue; // Skip this table if there's an error.
    31943197            }
     
    31963199
    31973200            // Drop table if exists.
    3198             fwrite($handle, "DROP TABLE IF EXISTS $table;\n");
    3199             fwrite($handle, "\n\n" . $row2['Create Table'] . ";\n\n");
    3200             unset($row2);
    3201 
    3202             $query = sprintf("SELECT * FROM %s", $table);
    3203             $result = $mysqli->query($query, MYSQLI_USE_RESULT);
    3204 
    3205             fwrite($handle, 'INSERT INTO ' . $table . ' VALUES ');
     3201            fwrite( $handle, "DROP TABLE IF EXISTS $table;\n");
     3202            fwrite( $handle, "\n\n" . $row2['Create Table'] . ";\n\n");
     3203            unset( $row2);
     3204
     3205            $query = sprintf( "SELECT * FROM %s", $table );
     3206            $result = $mysqli->query( $query, MYSQLI_USE_RESULT);
     3207
     3208            fwrite( $handle, 'INSERT INTO ' . $table . ' VALUES ');
    32063209
    32073210            $i = 0;
    3208             while ($row = $result->fetch_assoc()) {
     3211            while ( $row = $result->fetch_assoc() ) {
    32093212                $row_values = [];
    3210                 foreach ($row as $field => $value) {
    3211                     if (isset($value)) {
    3212                         if (is_numeric($value)) {
     3213                foreach ( $row as $field => $value) {
     3214                    if (isset( $value)) {
     3215                        if (is_numeric( $value)) {
    32133216                            $row_values[] = $value;
    32143217                        } else {
    3215                             $row_values[] = '"' . $mysqli->real_escape_string($value) . '"';
     3218                            $row_values[] = "'" . $mysqli->real_escape_string( $value) . "'";
    32163219                        }
    32173220                    } else {
     
    32193222                    }
    32203223                }
    3221                 fwrite($handle, ('(' . implode(', ', $row_values) . "),\n"));
     3224                fwrite( $handle, ('(' . implode(', ', $row_values) . "),\n"));
    32223225                ++$i;
    32233226            }
    3224             if ($i > 0) {
    3225                 fseek($handle, -2, SEEK_END); // Move the pointer back to overwrite the character
    3226                 fwrite($handle, ";\n");
     3227            if ( $i > 0) {
     3228                fseek( $handle, -2, SEEK_END); // Move the pointer back to overwrite the character
     3229                fwrite( $handle, ";\n");
    32273230            } else {
    3228                 fseek($handle, strlen('INSERT INTO ' . $table . ' VALUES ') * -1, SEEK_END);
     3231                fseek( $handle, strlen('INSERT INTO ' . $table . ' VALUES ') * -1, SEEK_END);
    32293232            }
    32303233
    32313234            $result->free_result();
    3232             unset($result);
    3233 
    3234             fwrite($handle, "\n\n-- ------------------------------------------------ \n\n");
     3235            unset( $result);
     3236
     3237            fwrite( $handle, "\n\n-- ------------------------------------------------ \n\n");
    32353238
    32363239            // Commit transaction.
    3237             fwrite($handle, "COMMIT;\n");
    3238 
    3239             fclose($handle);
     3240            fwrite( $handle, "COMMIT;\n" );
     3241
     3242            fclose( $handle);
     3243            $path = everest_backup_current_request_storage_path( 'ebwp-files.ebwplist' );
     3244            Temp_Directory::init()->add_to_temp( $path, $filename . "\n", true );
    32403245        }
    32413246
    32423247        // Script Variables.
    3243         $backup_path = everest_backup_current_request_storage_path( 'ebwp-database' );
    32443248        $nowtimename = time();
    32453249        $filename    = $backup_path . DIRECTORY_SEPARATOR . 'triggers-' . $nowtimename . '.sql';
    32463250
    32473251        // Open file for writing.
    3248         $handle = fopen($filename, 'w');
     3252        $handle = fopen( $filename, 'w');
    32493253        // Export triggers.
    32503254        $triggers_result = $mysqli->query("SELECT TRIGGER_NAME, EVENT_MANIPULATION, EVENT_OBJECT_TABLE, ACTION_STATEMENT, ACTION_TIMING FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA = DATABASE()");
    3251         while ($trigger = $triggers_result->fetch_assoc()) {
     3255        while ( $trigger = $triggers_result->fetch_assoc()) {
    32523256            $trigger_stmt = "CREATE TRIGGER {$trigger['TRIGGER_NAME']} {$trigger['ACTION_TIMING']} {$trigger['EVENT_MANIPULATION']} ON {$trigger['EVENT_OBJECT_TABLE']} FOR EACH ROW {$trigger['ACTION_STATEMENT']}";
    3253             fwrite($handle, "\n\n" . $trigger_stmt . ";\n\n");
     3257            fwrite( $handle, "\n\n" . $trigger_stmt . ";\n\n");
    32543258        }
    32553259
    32563260        // Commit transaction.
    3257         fwrite($handle, "COMMIT;\n");
    3258 
    3259         fclose($handle);
     3261        fwrite( $handle, "COMMIT;\n");
     3262
     3263        fclose( $handle );
    32603264        $mysqli->close();
    3261 
    32623265        return true;
    32633266    }
  • everest-backup/trunk/inc/modules/database/class-import-database.php

    r2871628 r3129340  
    6868    }
    6969
     70    /**
     71     * Import table.
     72     *
     73     * @param callable $query_count_cb Query count.
     74     */
    7075    public function import_table( callable $query_count_cb = null ) {
    7176        if ( ! file_exists( $this->filename ) ) {
     
    106111
    107112                $query = implode( '', $queries );
    108                 $query = $this->replace_table_options( $query );
    109                 $query = $this->replace_table_constraints( $query );
    110                 $query = $this->rename_table_names( $query, $this->exported_tables );
     113                if ( false === strpos( $queries[0], 'INSERT INTO ' ) ) {
     114                    $query = $this->replace_table_options( $query );
     115                    $query = $this->replace_table_constraints( $query );
     116                    $query = $this->rename_table_names( $query, $this->exported_tables );
     117                } else {
     118                    $query = strtr( $query, $this->find_replace );
     119                }
    111120
    112121                $imported = $this->query( $query );
     
    130139                $query   = '';
    131140
    132                 $query_count++;
    133 
    134             }
    135 
    136         }
    137 
     141                ++$query_count;
     142            }
     143        }
    138144        return $imported;
    139 
    140145    }
    141146
     
    204209                    if ( false !== strpos( $query, 'DROP TABLE IF EXISTS `' ) ) {
    205210                        $progress = ( ( $table_count / $total_tables ) * 100 );
    206                         $table_count++;
     211                        ++$table_count;
    207212                    }
    208213
     
    238243                    $query   = '';
    239244
    240                     $query_count++;
    241                 }
    242 
     245                    ++$query_count;
     246                }
    243247                $sql_line = '';
    244 
    245             }
    246 
     248            }
    247249            fclose( $handle ); // @phpcs:ignore
    248250        }
    249 
    250251        return $imported;
    251 
    252252    }
    253 
    254253}
  • everest-backup/trunk/languages/everest-backup.pot

    r3114824 r3129340  
    77"Content-Type: text/plain; charset=UTF-8\n"
    88"Content-Transfer-Encoding: 8bit\n"
    9 "POT-Creation-Date: 2024-07-09 05:21+0000\n"
     9"POT-Creation-Date: 2024-07-30 04:31+0000\n"
    1010"X-Poedit-Basepath: ..\n"
    1111"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"
     
    5252
    5353#. translators: %s is the memory used value.
    54 #: ../inc/functions.php:1380
     54#: ../inc/functions.php:1375
    5555msgid "Memory used: %s"
    5656msgstr ""
    5757
    58 #: ../inc/functions.php:1565
     58#: ../inc/functions.php:1548
    5959msgid "Hourly ( PRO )"
    6060msgstr ""
    6161
    62 #: ../inc/functions.php:1569
     62#: ../inc/functions.php:1552
    6363msgid "Daily"
    6464msgstr ""
    6565
    66 #: ../inc/functions.php:1573
     66#: ../inc/functions.php:1556
    6767msgid "Weekly"
    6868msgstr ""
    6969
     70#: ../inc/functions.php:1560
     71msgid "Monthly"
     72msgstr ""
     73
    7074#: ../inc/functions.php:1577
    71 msgid "Monthly"
    72 msgstr ""
    73 
    74 #: ../inc/functions.php:1595
    7575msgid "Local Web Server"
    7676msgstr ""
    7777
    78 #: ../inc/functions.php:1596
     78#: ../inc/functions.php:1578
    7979msgid "Save the backup package locally on your host server."
    8080msgstr ""
    8181
    82 #: ../inc/functions.php:1696
     82#: ../inc/functions.php:1679
    8383msgid "Database (Sql)"
    8484msgstr ""
    8585
    86 #: ../inc/functions.php:1697
     86#: ../inc/functions.php:1680
    8787msgid "Ignore database"
    8888msgstr ""
    8989
    90 #: ../inc/functions.php:1701
     90#: ../inc/functions.php:1684
    9191msgid "Plugins (Files)"
    9292msgstr ""
    9393
    94 #: ../inc/functions.php:1702
     94#: ../inc/functions.php:1685
    9595msgid "Ignore plugins"
    9696msgstr ""
    9797
    98 #: ../inc/functions.php:1706
     98#: ../inc/functions.php:1689
    9999msgid "Themes (Files)"
    100100msgstr ""
    101101
    102 #: ../inc/functions.php:1707
     102#: ../inc/functions.php:1690
    103103msgid "Ignore themes"
    104104msgstr ""
    105105
    106 #: ../inc/functions.php:1711
     106#: ../inc/functions.php:1694
    107107msgid "Media (Files)"
    108108msgstr ""
    109109
    110 #: ../inc/functions.php:1712
     110#: ../inc/functions.php:1695
    111111msgid "Ignore media"
    112112msgstr ""
    113113
    114 #: ../inc/functions.php:1716
     114#: ../inc/functions.php:1699
    115115msgid "Others (Files)"
    116116msgstr ""
    117117
    118 #: ../inc/functions.php:1717
     118#: ../inc/functions.php:1700
    119119msgid "Ignore other files and folders from wp-content folder"
    120120msgstr ""
    121121
    122 #: ../inc/functions.php:1769, ../inc/classes/class-admin-menu.php:353, ../inc/classes/class-admin-menu.php:354, ../inc/modules/tabs/class-settings-tab.php:78
     122#: ../inc/functions.php:1752, ../inc/classes/class-admin-menu.php:353, ../inc/classes/class-admin-menu.php:354, ../inc/modules/tabs/class-settings-tab.php:78
    123123msgid "Debug"
    124124msgstr ""
    125125
    126 #: ../inc/functions.php:1770, ../inc/views/backup.php:53
     126#: ../inc/functions.php:1753, ../inc/views/backup.php:53
    127127msgid "Abort"
    128128msgstr ""
    129129
    130 #: ../inc/functions.php:1771, ../inc/classes/class-admin-menu.php:169, ../inc/classes/class-admin-menu.php:195, ../inc/classes/class-admin-menu.php:196, ../inc/views/backup/schedule-backup.php:72
     130#: ../inc/functions.php:1754, ../inc/classes/class-admin-menu.php:169, ../inc/classes/class-admin-menu.php:195, ../inc/classes/class-admin-menu.php:196, ../inc/views/backup/schedule-backup.php:72
    131131msgid "Backup"
    132132msgstr ""
    133133
    134 #: ../inc/functions.php:1772, ../inc/views/restore.php:187, ../inc/modules/history/class-history-table.php:426
     134#: ../inc/functions.php:1755, ../inc/views/restore.php:187, ../inc/modules/history/class-history-table.php:426
    135135msgid "Rollback"
    136136msgstr ""
    137137
    138 #: ../inc/functions.php:1773, ../inc/classes/class-admin-menu.php:203, ../inc/classes/class-admin-menu.php:204
     138#: ../inc/functions.php:1756, ../inc/classes/class-admin-menu.php:203, ../inc/classes/class-admin-menu.php:204
    139139msgid "Restore"
    140140msgstr ""
    141141
    142 #: ../inc/functions.php:1774, ../inc/classes/class-admin-menu.php:311, ../inc/classes/class-admin-menu.php:312, ../inc/modules/tabs/class-migration-clone-tab.php:63, ../inc/views/migration-clone/clone.php:110
     142#: ../inc/functions.php:1757, ../inc/classes/class-admin-menu.php:311, ../inc/classes/class-admin-menu.php:312, ../inc/modules/tabs/class-migration-clone-tab.php:63, ../inc/views/migration-clone/clone.php:110
    143143msgid "Clone"
    144144msgstr ""
    145145
    146 #: ../inc/functions.php:1775, ../inc/classes/class-admin-menu.php:269, ../inc/classes/class-admin-menu.php:270, ../inc/modules/tabs/class-backup-tab.php:64
     146#: ../inc/functions.php:1758, ../inc/classes/class-admin-menu.php:269, ../inc/classes/class-admin-menu.php:270, ../inc/modules/tabs/class-backup-tab.php:64
    147147msgid "Schedule Backup"
    148148msgstr ""
    149149
    150 #: ../inc/functions.php:1776
     150#: ../inc/functions.php:1759
    151151msgid "Upload to Cloud"
    152152msgstr ""
    153153
    154154#. translators: action
    155 #: ../inc/functions.php:2082
     155#: ../inc/functions.php:2064
    156156msgid "Nonce verification failed. Action: \"%s\""
    157157msgstr ""
    158158
    159 #: ../inc/functions.php:2088
     159#: ../inc/functions.php:2070
    160160msgid "Permission denied."
    161161msgstr ""
    162162
    163 #: ../inc/functions.php:2103
     163#: ../inc/functions.php:2085
    164164msgid "Invalid action provided."
    165165msgstr ""
    166166
    167167#. translators: expected action and received
    168 #: ../inc/functions.php:2107
     168#: ../inc/functions.php:2089
    169169msgid "Expected action: %1$s Received: %2$s"
    170170msgstr ""
    171171
    172 #: ../inc/functions.php:2682
     172#: ../inc/functions.php:2664
    173173msgid "--- Select ---"
    174174msgstr ""
    175175
    176 #: ../inc/functions.php:2805, ../inc/views/backup/schedule-backup.php:37
     176#: ../inc/functions.php:2787, ../inc/views/backup/schedule-backup.php:37
    177177msgid "Enable"
    178178msgstr ""
    179179
    180 #: ../inc/functions.php:2806
     180#: ../inc/functions.php:2788
    181181msgid "Disable"
     182msgstr ""
     183
     184#: ../inc/functions.php:3168, ../inc/core/export/class-database.php:113
     185msgid "Could not write tables to config file."
    182186msgstr ""
    183187
     
    301305msgstr ""
    302306
    303 #: ../inc/classes/class-ajax.php:453, ../inc/core/import/class-wrapup.php:193
     307#: ../inc/classes/class-ajax.php:453, ../inc/core/import/class-wrapup.php:212
    304308msgid "Restore completed."
    305309msgstr ""
     
    900904msgstr ""
    901905
    902 #: ../inc/core/export/class-database.php:113
    903 msgid "Could not write tables to config file."
    904 msgstr ""
    905 
    906906#. translators: number of tables
    907907#: ../inc/core/export/class-database.php:128
     
    12441244
    12451245#. translators: %1$d is database restore progress percent, and %2$d is query count.
    1246 #: ../inc/modules/database/class-import-database.php:218
     1246#: ../inc/modules/database/class-import-database.php:223
    12471247msgid "Restoring database ( %1$d%% ) [ Query count: %2$d ]"
    12481248msgstr ""
  • everest-backup/trunk/readme.txt

    r3114824 r3129340  
    44Tags: backup, clone, migration, pcloud, migrate wordpress
    55Requires at least: 5.6
    6 Tested up to: 6.5
     6Tested up to: 6.6
    77Requires PHP: 7.4
    8 Stable tag: 2.2.10
     8Stable tag: 2.2.11
    99License: GPLv3 or later
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
  • everest-backup/trunk/vendor/autoload.php

    r3114824 r3129340  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitd7eb165a056d2653f66a9e7dc193d366::getLoader();
     7return ComposerAutoloaderInit921801ef644a44bfa9cf324b5d3474a5::getLoader();
  • everest-backup/trunk/vendor/composer/autoload_real.php

    r3114824 r3129340  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitd7eb165a056d2653f66a9e7dc193d366
     5class ComposerAutoloaderInit921801ef644a44bfa9cf324b5d3474a5
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInitd7eb165a056d2653f66a9e7dc193d366', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit921801ef644a44bfa9cf324b5d3474a5', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInitd7eb165a056d2653f66a9e7dc193d366', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit921801ef644a44bfa9cf324b5d3474a5', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInitd7eb165a056d2653f66a9e7dc193d366::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInit921801ef644a44bfa9cf324b5d3474a5::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
  • everest-backup/trunk/vendor/composer/autoload_static.php

    r3114824 r3129340  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitd7eb165a056d2653f66a9e7dc193d366
     7class ComposerStaticInit921801ef644a44bfa9cf324b5d3474a5
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    4141    {
    4242        return \Closure::bind(function () use ($loader) {
    43             $loader->prefixLengthsPsr4 = ComposerStaticInitd7eb165a056d2653f66a9e7dc193d366::$prefixLengthsPsr4;
    44             $loader->prefixDirsPsr4 = ComposerStaticInitd7eb165a056d2653f66a9e7dc193d366::$prefixDirsPsr4;
    45             $loader->classMap = ComposerStaticInitd7eb165a056d2653f66a9e7dc193d366::$classMap;
     43            $loader->prefixLengthsPsr4 = ComposerStaticInit921801ef644a44bfa9cf324b5d3474a5::$prefixLengthsPsr4;
     44            $loader->prefixDirsPsr4 = ComposerStaticInit921801ef644a44bfa9cf324b5d3474a5::$prefixDirsPsr4;
     45            $loader->classMap = ComposerStaticInit921801ef644a44bfa9cf324b5d3474a5::$classMap;
    4646
    4747        }, null, ClassLoader::class);
  • everest-backup/trunk/vendor/composer/installed.json

    r3114824 r3129340  
    150150        {
    151151            "name": "symfony/finder",
    152             "version": "v6.4.8",
    153             "version_normalized": "6.4.8.0",
     152            "version": "v6.4.10",
     153            "version_normalized": "6.4.10.0",
    154154            "source": {
    155155                "type": "git",
    156156                "url": "https://github.com/symfony/finder.git",
    157                 "reference": "3ef977a43883215d560a2cecb82ec8e62131471c"
     157                "reference": "af29198d87112bebdd397bd7735fbd115997824c"
    158158            },
    159159            "dist": {
    160160                "type": "zip",
    161                 "url": "https://api.github.com/repos/symfony/finder/zipball/3ef977a43883215d560a2cecb82ec8e62131471c",
    162                 "reference": "3ef977a43883215d560a2cecb82ec8e62131471c",
     161                "url": "https://api.github.com/repos/symfony/finder/zipball/af29198d87112bebdd397bd7735fbd115997824c",
     162                "reference": "af29198d87112bebdd397bd7735fbd115997824c",
    163163                "shasum": ""
    164164            },
     
    169169                "symfony/filesystem": "^6.0|^7.0"
    170170            },
    171             "time": "2024-05-31T14:49:08+00:00",
     171            "time": "2024-07-24T07:06:38+00:00",
    172172            "type": "library",
    173173            "installation-source": "dist",
     
    197197            "homepage": "https://symfony.com",
    198198            "support": {
    199                 "source": "https://github.com/symfony/finder/tree/v6.4.8"
     199                "source": "https://github.com/symfony/finder/tree/v6.4.10"
    200200            },
    201201            "funding": [
  • everest-backup/trunk/vendor/composer/installed.php

    r3114824 r3129340  
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => '10eaaf8dd6e9a71095e7fdb45c471d5bb8fafba1',
     8        'reference' => 'fc16df67785d46965f861ad5260eb8c144a4fa25',
    99        'name' => 'everest-backup/everest-backup',
    1010        'dev' => false,
     
    1717            'install_path' => __DIR__ . '/../../',
    1818            'aliases' => array(),
    19             'reference' => '10eaaf8dd6e9a71095e7fdb45c471d5bb8fafba1',
     19            'reference' => 'fc16df67785d46965f861ad5260eb8c144a4fa25',
    2020            'dev_requirement' => false,
    2121        ),
     
    4141        ),
    4242        'symfony/finder' => array(
    43             'pretty_version' => 'v6.4.8',
    44             'version' => '6.4.8.0',
     43            'pretty_version' => 'v6.4.10',
     44            'version' => '6.4.10.0',
    4545            'type' => 'library',
    4646            'install_path' => __DIR__ . '/../symfony/finder',
    4747            'aliases' => array(),
    48             'reference' => '3ef977a43883215d560a2cecb82ec8e62131471c',
     48            'reference' => 'af29198d87112bebdd397bd7735fbd115997824c',
    4949            'dev_requirement' => false,
    5050        ),
Note: See TracChangeset for help on using the changeset viewer.