Plugin Directory

Changeset 3673717


Ignore:
Timestamp:
08/31/2026 09:03:52 AM (3 months ago)
Author:
haseebabidofficial
Message:

Fixed import controls and improved export performance.

Location:
haseebvault-backup-migration/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • haseebvault-backup-migration/trunk/admin/views/_progress.php

    r3662954 r3673717  
    1212                <div class="hv-progress-meta"><strong id="hv-progress-percent">0%</strong><span id="hv-progress-message"><?php esc_html_e( 'Preparing the operation…', 'haseebvault-backup-migration' ); ?></span></div>
    1313                <p class="hv-progress-lock-note"><span class="dashicons dashicons-lock"></span><?php esc_html_e( 'Keep this window open until the operation finishes.', 'haseebvault-backup-migration' ); ?></p>
    14                 <div class="hv-inline-actions hv-modal-actions"><button type="button" class="button" id="hv-job-pause"><?php esc_html_e( 'Pause', 'haseebvault-backup-migration' ); ?></button><button type="button" class="button" id="hv-job-resume" hidden><?php esc_html_e( 'Resume', 'haseebvault-backup-migration' ); ?></button><button type="button" class="button button-link-delete" id="hv-job-cancel"><?php esc_html_e( 'Cancel', 'haseebvault-backup-migration' ); ?></button></div>
     14                <div class="hv-inline-actions hv-modal-actions"><button type="button" class="button" id="hv-job-pause"><?php esc_html_e( 'Pause', 'haseebvault-backup-migration' ); ?></button><button type="button" class="button" id="hv-job-resume" hidden><?php esc_html_e( 'Resume', 'haseebvault-backup-migration' ); ?></button><button type="button" class="button button-link-delete" id="hv-job-cancel"><?php esc_html_e( 'Cancel', 'haseebvault-backup-migration' ); ?></button><button type="button" class="button button-primary" id="hv-job-ok" hidden><?php esc_html_e( 'OK', 'haseebvault-backup-migration' ); ?></button></div>
    1515        </section>
    1616</div>
  • haseebvault-backup-migration/trunk/admin/views/settings.php

    r3662954 r3673717  
    1313        </section>
    1414        <section class="hv-card hv-form"><div class="hv-card-heading"><div><p class="hv-kicker"><?php esc_html_e( 'Export exclusions', 'haseebvault-backup-migration' ); ?></p><h2><?php esc_html_e( 'Keep temporary data out', 'haseebvault-backup-migration' ); ?></h2></div></div><div class="hv-grid hv-grid-2"><label class="hv-field"><span><?php esc_html_e( 'Excluded paths', 'haseebvault-backup-migration' ); ?></span><textarea rows="5" name="haseebvault_settings[excluded_paths]"><?php echo esc_textarea( implode( "\n", (array) ( $settings['excluded_paths'] ?? array() ) ) ); ?></textarea><small><?php esc_html_e( 'One path per line, relative to the WordPress root.', 'haseebvault-backup-migration' ); ?></small></label><label class="hv-field"><span><?php esc_html_e( 'Excluded extensions', 'haseebvault-backup-migration' ); ?></span><textarea rows="5" name="haseebvault_settings[excluded_extensions]"><?php echo esc_textarea( implode( "\n", (array) ( $settings['excluded_extensions'] ?? array() ) ) ); ?></textarea><small><?php esc_html_e( 'One extension per line without a dot.', 'haseebvault-backup-migration' ); ?></small></label></div><label class="hv-field hv-field-small"><span><?php esc_html_e( 'Exclude files larger than (MB)', 'haseebvault-backup-migration' ); ?></span><input type="number" min="0" name="haseebvault_settings[max_file_size_mb]" value="<?php echo esc_attr( (int) ( ( $settings['max_file_size'] ?? 0 ) / MB_IN_BYTES ) ); ?>"><small><?php esc_html_e( '0 includes files of every size.', 'haseebvault-backup-migration' ); ?></small></label></section>
    15         <section class="hv-card hv-form"><div class="hv-card-heading"><div><p class="hv-kicker"><?php esc_html_e( 'Performance', 'haseebvault-backup-migration' ); ?></p><h2><?php esc_html_e( 'Batch engine', 'haseebvault-backup-migration' ); ?></h2></div></div><div class="hv-grid hv-grid-3"><label class="hv-field"><span><?php esc_html_e( 'Files per batch', 'haseebvault-backup-migration' ); ?></span><input type="number" min="5" max="500" name="haseebvault_settings[files_per_batch]" value="<?php echo esc_attr( $settings['files_per_batch'] ?? 80 ); ?>"></label><label class="hv-field"><span><?php esc_html_e( 'Database rows per batch', 'haseebvault-backup-migration' ); ?></span><input type="number" min="10" max="5000" name="haseebvault_settings[database_rows_per_batch]" value="<?php echo esc_attr( $settings['database_rows_per_batch'] ?? 250 ); ?>"></label><label class="hv-field"><span><?php esc_html_e( 'Request time budget (seconds)', 'haseebvault-backup-migration' ); ?></span><input type="number" min="2" max="20" name="haseebvault_settings[time_budget]" value="<?php echo esc_attr( $settings['time_budget'] ?? 8 ); ?>"></label><label class="hv-field"><span><?php esc_html_e( 'AJAX delay (milliseconds)', 'haseebvault-backup-migration' ); ?></span><input type="number" min="0" max="5000" name="haseebvault_settings[ajax_delay]" value="<?php echo esc_attr( $settings['ajax_delay'] ?? 250 ); ?>"></label><label class="hv-field"><span><?php esc_html_e( 'Upload chunk size (MB)', 'haseebvault-backup-migration' ); ?></span><input type="number" min="1" max="20" name="haseebvault_settings[upload_chunk_size_mb]" value="<?php echo esc_attr( (int) ( ( $settings['upload_chunk_size'] ?? 5 * MB_IN_BYTES ) / MB_IN_BYTES ) ); ?>"></label></div></section>
     15        <section class="hv-card hv-form"><div class="hv-card-heading"><div><p class="hv-kicker"><?php esc_html_e( 'Performance', 'haseebvault-backup-migration' ); ?></p><h2><?php esc_html_e( 'Batch engine', 'haseebvault-backup-migration' ); ?></h2></div></div><div class="hv-grid hv-grid-3"><label class="hv-field"><span><?php esc_html_e( 'Files per batch', 'haseebvault-backup-migration' ); ?></span><input type="number" min="5" max="500" name="haseebvault_settings[files_per_batch]" value="<?php echo esc_attr( $settings['files_per_batch'] ?? 300 ); ?>"></label><label class="hv-field"><span><?php esc_html_e( 'Database rows per batch', 'haseebvault-backup-migration' ); ?></span><input type="number" min="10" max="5000" name="haseebvault_settings[database_rows_per_batch]" value="<?php echo esc_attr( $settings['database_rows_per_batch'] ?? 1000 ); ?>"></label><label class="hv-field"><span><?php esc_html_e( 'Request time budget (seconds)', 'haseebvault-backup-migration' ); ?></span><input type="number" min="2" max="20" name="haseebvault_settings[time_budget]" value="<?php echo esc_attr( $settings['time_budget'] ?? 8 ); ?>"></label><label class="hv-field"><span><?php esc_html_e( 'AJAX delay (milliseconds)', 'haseebvault-backup-migration' ); ?></span><input type="number" min="0" max="5000" name="haseebvault_settings[ajax_delay]" value="<?php echo esc_attr( $settings['ajax_delay'] ?? 50 ); ?>"></label><label class="hv-field"><span><?php esc_html_e( 'Upload chunk size (MB)', 'haseebvault-backup-migration' ); ?></span><input type="number" min="1" max="20" name="haseebvault_settings[upload_chunk_size_mb]" value="<?php echo esc_attr( (int) ( ( $settings['upload_chunk_size'] ?? 5 * MB_IN_BYTES ) / MB_IN_BYTES ) ); ?>"></label></div></section>
    1616        <?php submit_button( __( 'Save Settings', 'haseebvault-backup-migration' ), 'primary button-hero', 'submit', false ); ?>
    1717</form>
  • haseebvault-backup-migration/trunk/assets/css/admin.css

    r3662954 r3673717  
    333333.hv-progress-meta strong { color: var(--hv-navy); }
    334334.hv-operation-overlay[hidden] { display: none !important; }
     335.hv-operation-overlay [hidden] { display: none !important; }
    335336.hv-operation-overlay {
    336337  position: fixed;
  • haseebvault-backup-migration/trunk/assets/js/admin.js

    r3663759 r3673717  
    5454  const resumeButton = document.getElementById('hv-job-resume');
    5555  const cancelButton = document.getElementById('hv-job-cancel');
     56  const okButton = document.getElementById('hv-job-ok');
    5657  const runner = {
    5758    jobId: '',
    … …  
    101102    if (resumeButton) resumeButton.hidden = !runner.paused || runner.terminal;
    102103    if (cancelButton) {
    103       cancelButton.hidden = !canCancel && !runner.terminal;
    104       cancelButton.textContent = runner.terminal && runner.redirectUrl ? (runner.actionLabel || 'OK') : (runner.terminal ? 'Close' : 'Cancel');
    105       cancelButton.classList.toggle('button-primary', Boolean(runner.terminal && runner.redirectUrl));
    106       cancelButton.classList.toggle('button-link-delete', !runner.terminal || !runner.redirectUrl);
    107     }
     104          cancelButton.hidden = Boolean(runner.terminal && runner.redirectUrl) || (!canCancel && !runner.terminal);
     105          cancelButton.textContent = runner.terminal ? 'Close' : 'Cancel';
     106    }
     107    if (okButton) {
     108          okButton.hidden = !runner.terminal || !runner.redirectUrl;
     109          okButton.textContent = runner.actionLabel || 'OK';
     110        }
    108111  }
    109112
    … …  
    375378  if (cancelButton) cancelButton.addEventListener('click', async () => {
    376379    if (runner.terminal) {
    377       if (runner.redirectUrl) {
    378         window.location.assign(runner.redirectUrl);
    379         return;
    380       }
    381380      closeProgress();
    382381      return;
    … …  
    398397      toast(error.message, true);
    399398    }
     399  });
     400
     401  if (okButton) okButton.addEventListener('click', () => {
     402        if (runner.redirectUrl) window.location.assign(runner.redirectUrl);
    400403  });
    401404
  • haseebvault-backup-migration/trunk/haseebvault.php

    r3663759 r3673717  
    33 * Plugin Name: HaseebVault - Backup & Migration
    44 * Description: Secure WordPress backup, migration, import, and export with resumable processing, integrity checks, and safe URL replacement.
    5  * Version:     1.1.8
     5 * Version:     1.1.9
    66 * Requires at least: 6.2
    77 * Requires PHP: 7.4
    … …  
    1818defined( 'ABSPATH' ) || exit;
    1919
    20 define( 'HASEEBVAULT_VERSION', '1.1.8' );
     20define( 'HASEEBVAULT_VERSION', '1.1.9' );
    2121define( 'HASEEBVAULT_FORMAT_VERSION', '1.0' );
    2222define( 'HASEEBVAULT_FILE', __FILE__ );
  • haseebvault-backup-migration/trunk/includes/class-activator.php

    r3662954 r3673717  
    8686                        'delete_on_uninstall'     => false,
    8787                        'enable_logging'          => true,
    88                         'files_per_batch'         => 80,
    89                         'database_rows_per_batch' => 250,
    90                         'ajax_delay'              => 250,
     88                        'files_per_batch'         => 300,
     89                        'database_rows_per_batch' => 1000,
     90                        'ajax_delay'              => 50,
    9191                        'time_budget'             => 8,
    9292                        'upload_chunk_size'       => 5 * MB_IN_BYTES,
  • haseebvault-backup-migration/trunk/includes/class-admin.php

    r3663759 r3673717  
    6060                wp_enqueue_script( 'haseebvault-admin', HASEEBVAULT_URL . 'assets/js/admin.js', array(), HASEEBVAULT_VERSION, true );
    6161                $settings = get_option( 'haseebvault_settings', array() );
     62                $delay    = max( 0, (int) ( $settings['ajax_delay'] ?? 50 ) );
     63                $delay    = 250 === $delay ? 50 : $delay;
    6264                wp_localize_script(
    6365                        'haseebvault-admin',
    … …  
    6668                                'ajaxUrl'   => admin_url( 'admin-ajax.php' ),
    6769                                'nonce'     => wp_create_nonce( 'haseebvault_admin' ),
    68                                 'delay'     => max( 0, (int) ( $settings['ajax_delay'] ?? 250 ) ),
     70                                'delay'     => $delay,
    6971                                'chunkSize' => max( MB_IN_BYTES, min( 20 * MB_IN_BYTES, (int) ( $settings['upload_chunk_size'] ?? 5 * MB_IN_BYTES ) ) ),
    7072                                'urls'      => array(
    … …  
    116118                        }
    117119                }
    118                 $output['files_per_batch']         = max( 5, min( 500, (int) ( $output['files_per_batch'] ?? 80 ) ) );
    119                 $output['database_rows_per_batch'] = max( 10, min( 5000, (int) ( $output['database_rows_per_batch'] ?? 250 ) ) );
     120                $output['files_per_batch']         = max( 5, min( 500, (int) ( $output['files_per_batch'] ?? 300 ) ) );
     121                $output['database_rows_per_batch'] = max( 10, min( 5000, (int) ( $output['database_rows_per_batch'] ?? 1000 ) ) );
    120122                $output['time_budget']             = max( 2, min( 20, (int) ( $output['time_budget'] ?? 8 ) ) );
    121123                if ( isset( $input['upload_chunk_size_mb'] ) ) {
  • haseebvault-backup-migration/trunk/includes/class-archive.php

    r3662954 r3673717  
    6868        public function add_files( $job_id, array $state ) {
    6969                $settings            = get_option( 'haseebvault_settings', array() );
    70                 $batch               = max( 1, min( 500, (int) apply_filters( 'haseebvault_batch_size', $settings['files_per_batch'] ?? 80 ) ) );
     70                $configured_batch     = (int) ( $settings['files_per_batch'] ?? 300 );
     71                // Upgrade the original conservative default automatically without
     72                // overriding a site owner's explicitly customized batch value.
     73                $configured_batch     = 80 === $configured_batch ? 300 : $configured_batch;
     74                $batch               = max( 1, min( 500, (int) apply_filters( 'haseebvault_batch_size', $configured_batch ) ) );
    7175                $time_budget         = max( 2, min( 20, (int) ( $settings['time_budget'] ?? 8 ) ) );
    7276                $started             = microtime( true );
    … …  
    113117                        }
    114118                        $required_entries[] = $entry;
    115                         if ( (int) $record['size'] > 64 * MB_IN_BYTES && method_exists( $zip, 'setCompressionName' ) ) {
     119                        if ( $this->store_without_recompression( $relative, (int) $record['size'] ) && method_exists( $zip, 'setCompressionName' ) ) {
    116120                                $zip->setCompressionName( $entry, ZipArchive::CM_STORE );
    117121                        }
    … …  
    142146                        'complete' => $eof,
    143147                );
     148        }
     149
     150        /**
     151         * Avoid wasting CPU recompressing media and archive formats that are already
     152         * compressed. Their SHA-256 integrity verification remains unchanged.
     153         *
     154         * @param string $relative Relative file path.
     155         * @param int    $size     File size in bytes.
     156         * @return bool
     157         */
     158        private function store_without_recompression( $relative, $size ) {
     159                if ( $size > 64 * MB_IN_BYTES ) {
     160                        return true;
     161                }
     162                $extensions = array(
     163                        '7z', 'avi', 'avif', 'flac', 'gif', 'gz', 'jpeg', 'jpg', 'm4a', 'mkv',
     164                        'mov', 'mp3', 'mp4', 'ogg', 'pdf', 'png', 'rar', 'webm', 'webp', 'woff',
     165                        'woff2', 'zip',
     166                );
     167                $extensions = (array) apply_filters( 'haseebvault_store_extensions', $extensions );
     168                return in_array( strtolower( pathinfo( $relative, PATHINFO_EXTENSION ) ), $extensions, true );
    144169        }
    145170
  • haseebvault-backup-migration/trunk/includes/class-database-exporter.php

    r3662954 r3673717  
    5555                global $wpdb;
    5656                $settings    = get_option( 'haseebvault_settings', array() );
    57                 $row_limit   = max( 10, min( 5000, (int) apply_filters( 'haseebvault_database_batch_size', $settings['database_rows_per_batch'] ?? 250 ) ) );
     57                $configured  = (int) ( $settings['database_rows_per_batch'] ?? 1000 );
     58                $configured  = 250 === $configured ? 1000 : $configured;
     59                $row_limit   = max( 10, min( 5000, (int) apply_filters( 'haseebvault_database_batch_size', $configured ) ) );
    5860                $time_budget = max( 2, min( 20, (int) ( $settings['time_budget'] ?? 8 ) ) );
    5961                $started     = microtime( true );
  • haseebvault-backup-migration/trunk/includes/class-file-scanner.php

    r3662954 r3673717  
    3434        public function process( $job_id, array $state, array $components, array $options ) {
    3535                $settings    = get_option( 'haseebvault_settings', array() );
    36                 $batch       = max( 5, (int) ( $settings['files_per_batch'] ?? 80 ) );
     36                $configured  = (int) ( $settings['files_per_batch'] ?? 300 );
     37                $configured  = 80 === $configured ? 300 : $configured;
     38                $batch       = max( 5, min( 500, $configured ) );
    3739                $time_budget = max( 2, min( 20, (int) ( $settings['time_budget'] ?? 8 ) ) );
    3840                $started     = microtime( true );
  • haseebvault-backup-migration/trunk/readme.txt

    r3663759 r3673717  
    55Tested up to: 7.0
    66Requires PHP: 7.4
    7 Stable tag: 1.1.8
     7Stable tag: 1.1.9
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    9696== Changelog ==
    9797
     98= 1.1.9 =
     99* Shows a dedicated OK button as the only action after a successful website import.
     100* Reliably hides Pause, Resume, and Cancel controls in terminal success popups across WordPress admin styles.
     101* Speeds up exports with larger safe adaptive batches and shorter inter-request delays.
     102* Avoids CPU-intensive recompression for media, fonts, PDFs, and archive formats that are already compressed.
     103
    98104= 1.1.8 =
    99105* Removed the typed confirmation and manual source/destination URL fields from import setup.
Note: See TracChangeset for help on using the changeset viewer.