Plugin Directory

Changeset 3330068


Ignore:
Timestamp:
07/18/2025 08:16:51 AM (7 months ago)
Author:
joaosraposo
Message:

Version 1.0.6
Fix calculation of bytes read and update database with actual bytes in SendChunk.php

Location:
hejbit-decentralised-backup/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • hejbit-decentralised-backup/trunk/HDB.php

    r3320542 r3330068  
    88 * Tested up to: 6.7.2
    99 * Requires PHP: 7.3
    10  * Version: 1.0.5
     10 * Version: 1.0.6
    1111 * Author: Hejbit, Joaosraposo
    1212 * License: AGPLv3
  • hejbit-decentralised-backup/trunk/inc/SendChunk.php

    r3320542 r3330068  
    6767// While the file is not completely read
    6868if (!empty($thisChunk)) {
     69    // Get ACTUAL bytes read (critical fix)
     70    $actual_bytes_read = strlen($thisChunk);
     71   
    6972    // Prepare the headers
    7073    $headers = array(
     
    8992    // Sends the request (creates the chunk file in the UUID folder)
    9093    $firstBit = str_pad($inProgress['fileNumber'], 15, '0', STR_PAD_LEFT);
    91     $lastBit =  str_pad(($inProgress['fileNumber'] + $memoryFree), 15, '0', STR_PAD_LEFT);
     94    $lastBit = str_pad(($inProgress['fileNumber'] + $actual_bytes_read), 15, '0', STR_PAD_LEFT); // Use actual bytes
    9295
    9396    $resSendChunk = wp_remote_request(
     
    9699    );
    97100
    98     // Update the database with the new file number
    99     $data = array("fileNumber"  => ($inProgress['fileNumber'] + $memoryFree));
     101    // Update the database with ACTUAL bytes read (critical fix)
     102    $data = array("fileNumber" => ($inProgress['fileNumber'] + $actual_bytes_read));
    100103    $where = array("finish" => 0);
    101104    $wpdb->update($wpdb->prefix . 'hejbit_saveInProgress', $data, $where);
  • hejbit-decentralised-backup/trunk/readme.txt

    r3321227 r3330068  
    33Contributors: joaosraposo, app.hejbit.com , metaprovide.org
    44Tested up to: 6.8
    5 Stable tag: 1.0.5
     5Stable tag: 1.0.6
    66Requires PHP: 7.3
    77License: AGPLv3
Note: See TracChangeset for help on using the changeset viewer.