Compare commits
No commits in common. "master" and "v6.2.1" have entirely different histories.
|
@ -134,7 +134,7 @@ class ConfigUpdateResult
|
||||||
{
|
{
|
||||||
return ($this->request->mode == ConfigUpdateMode::Selected ||
|
return ($this->request->mode == ConfigUpdateMode::Selected ||
|
||||||
$this->request->mode === ConfigUpdateMode::DetectChanged) &&
|
$this->request->mode === ConfigUpdateMode::DetectChanged) &&
|
||||||
//TODO: support removed files as well?
|
count(array_filter($this->added_files, fn($f) => config_is_file($f))) == 0 &&
|
||||||
count(array_filter($this->removed_files, fn($f) => config_is_file($f))) == 0;
|
count(array_filter($this->removed_files, fn($f) => config_is_file($f))) == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -395,11 +395,6 @@ class ConfigManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//NOTE: newly added files are marked as affected always without checking for staleness
|
|
||||||
// with the last run file
|
|
||||||
foreach($added_files as $file)
|
|
||||||
$affected_files->addFile($file, unique: true);
|
|
||||||
|
|
||||||
//if there were removed files we need to rebuild affected files
|
//if there were removed files we need to rebuild affected files
|
||||||
foreach($removed_files as $file)
|
foreach($removed_files as $file)
|
||||||
{
|
{
|
||||||
|
|
51
pack.inc.php
51
pack.inc.php
|
@ -164,7 +164,7 @@ function _config_pack_bundle_fmt1(
|
||||||
|
|
||||||
$strid_crc = crc32($entry->strid);
|
$strid_crc = crc32($entry->strid);
|
||||||
if(isset($STRIDMAP[$strid_crc]))
|
if(isset($STRIDMAP[$strid_crc]))
|
||||||
throw new Exception("Duplicating config strid CRC for '{$entry->strid}' conflicts with '{$STRIDMAP[$strid_crc]}'");
|
throw new Exception("Duplicating config str id crc for '{$entry->strid}' conflicts with '{$STRIDMAP[$strid_crc]}'");
|
||||||
$STRIDMAP[$strid_crc] = $entry->strid;
|
$STRIDMAP[$strid_crc] = $entry->strid;
|
||||||
|
|
||||||
$header[] = array(
|
$header[] = array(
|
||||||
|
@ -294,7 +294,7 @@ function _config_pack_bundle_fmt3(
|
||||||
|
|
||||||
$strid_crc = crc32($entry->strid);
|
$strid_crc = crc32($entry->strid);
|
||||||
if(isset($STRIDMAP[$strid_crc]))
|
if(isset($STRIDMAP[$strid_crc]))
|
||||||
throw new Exception("Duplicating config strid CRC for '{$entry->strid}' conflicts with '{$STRIDMAP[$strid_crc]}'");
|
throw new Exception("Duplicating config str id crc for '{$entry->strid}' conflicts with '{$STRIDMAP[$strid_crc]}'");
|
||||||
$STRIDMAP[$strid_crc] = $entry->strid;
|
$STRIDMAP[$strid_crc] = $entry->strid;
|
||||||
|
|
||||||
$header[] = array(
|
$header[] = array(
|
||||||
|
@ -399,23 +399,7 @@ function _config_patch_bundle_fmt1(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
throw new Exception("Patched entry {$patch_entry->id} not found in config bundle");
|
||||||
//just append new entry to the end
|
|
||||||
$strid_crc32 = crc32($patch_entry->strid);
|
|
||||||
if(array_filter($header, fn($item) => $item[2] == $strid_crc32))
|
|
||||||
throw new Exception("Conflicting CRC for strid: $patch_entry->strid ($strid_crc32)");
|
|
||||||
|
|
||||||
$header[] = array(
|
|
||||||
$patch_format,
|
|
||||||
$patch_entry->id,
|
|
||||||
$strid_crc32,
|
|
||||||
$patch_entry->class_id,
|
|
||||||
strlen($payloads_bundle),
|
|
||||||
strlen($patch_payload)
|
|
||||||
);
|
|
||||||
|
|
||||||
$payloads_bundle .= $patch_payload;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$header_msgpack = config_msgpack_pack($header);
|
$header_msgpack = config_msgpack_pack($header);
|
||||||
|
@ -560,13 +544,11 @@ function _config_patch_bundle_fmt3(
|
||||||
if(strlen($patch_payload_lz4) <= $lz4_chunk_size)
|
if(strlen($patch_payload_lz4) <= $lz4_chunk_size)
|
||||||
{
|
{
|
||||||
$payloads_bundle = substr_replace($payloads_bundle, $patched_chunk, $chunk_offset, strlen($patched_chunk));
|
$payloads_bundle = substr_replace($payloads_bundle, $patched_chunk, $chunk_offset, strlen($patched_chunk));
|
||||||
$header_entry[0] = $patch_format;
|
|
||||||
$header_entry[6] = strlen($patch_payload);
|
$header_entry[6] = strlen($patch_payload);
|
||||||
}
|
}
|
||||||
//just append to the end
|
//just append to the end
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$header_entry[0] = $patch_format;
|
|
||||||
$header_entry[4] = strlen($payloads_bundle); //chunk offset
|
$header_entry[4] = strlen($payloads_bundle); //chunk offset
|
||||||
$header_entry[5] = 0;
|
$header_entry[5] = 0;
|
||||||
$header_entry[6] = strlen($patch_payload);
|
$header_entry[6] = strlen($patch_payload);
|
||||||
|
@ -577,7 +559,6 @@ function _config_patch_bundle_fmt3(
|
||||||
//just append to the end
|
//just append to the end
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$header_entry[0] = $patch_format;
|
|
||||||
$header_entry[4] = strlen($payloads_bundle); //chunk offset
|
$header_entry[4] = strlen($payloads_bundle); //chunk offset
|
||||||
$header_entry[5] = 0;
|
$header_entry[5] = 0;
|
||||||
$header_entry[6] = strlen($patch_payload);
|
$header_entry[6] = strlen($patch_payload);
|
||||||
|
@ -588,31 +569,7 @@ function _config_patch_bundle_fmt3(
|
||||||
$header[$header_idx] = $header_entry;
|
$header[$header_idx] = $header_entry;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
throw new Exception("Patched entry {$patch_entry->id} not found in config bundle");
|
||||||
//just append new entry to the end
|
|
||||||
$strid_crc32 = crc32($patch_entry->strid);
|
|
||||||
if(array_filter($header, fn($item) => $item[2] == $strid_crc32))
|
|
||||||
throw new Exception("Conflicting CRC for strid: $patch_entry->strid ($strid_crc32)");
|
|
||||||
|
|
||||||
//chunk contains only one patch entry
|
|
||||||
$patch_payload_lz4 = lz4_compress($patch_payload, 9);
|
|
||||||
$patched_chunk = pack("V", strlen($patch_payload_lz4));
|
|
||||||
$patched_chunk .= $patch_payload_lz4;
|
|
||||||
if(strlen($patch_payload) > $max_chunk_size)
|
|
||||||
$max_chunk_size = strlen($patch_payload);
|
|
||||||
|
|
||||||
$header[] = array(
|
|
||||||
$patch_format,
|
|
||||||
$patch_entry->id,
|
|
||||||
$strid_crc32,
|
|
||||||
$patch_entry->class_id,
|
|
||||||
strlen($payloads_bundle),
|
|
||||||
0,
|
|
||||||
strlen($patch_payload)
|
|
||||||
);
|
|
||||||
|
|
||||||
$payloads_bundle .= $patched_chunk;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$header_msgpack = config_msgpack_pack($header);
|
$header_msgpack = config_msgpack_pack($header);
|
||||||
|
|
Loading…
Reference in New Issue