mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Some improvements for integrity checker (#1501)
* Some improvements for integrity checker * Update build_files_integrity.php * Updated
This commit is contained in:
parent
784e3aef1c
commit
6a10adabf5
3 changed files with 33 additions and 26 deletions
|
@ -1,5 +1,13 @@
|
|||
# 📖 Change Log
|
||||
|
||||
## [v2.4.4](https://github.com/torrentpier/torrentpier/tree/v2.4.4) (2024-XX-XX)
|
||||
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.3...v2.4.4)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Release 2.4.4 🦩 ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Some improvements for integrity checker [\#1501](https://github.com/torrentpier/torrentpier/pull/1501) ([belomaxorka](https://github.com/belomaxorka))
|
||||
|
||||
## [v2.4.3](https://github.com/torrentpier/torrentpier/tree/v2.4.3) (2024-06-09)
|
||||
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.2...v2.4.3)
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ $bb_cfg['js_ver'] = $bb_cfg['css_ver'] = 1;
|
|||
|
||||
// Version info
|
||||
$bb_cfg['tp_version'] = 'v2.4.3';
|
||||
$bb_cfg['tp_release_date'] = '09-06-2024';
|
||||
$bb_cfg['tp_release_date'] = 'XX-XX-2024';
|
||||
$bb_cfg['tp_release_codename'] = 'Cattle';
|
||||
|
||||
// Database
|
||||
|
|
|
@ -20,25 +20,7 @@ if (!$bb_cfg['integrity_check']) {
|
|||
$checksumFile = new SplFileObject(CHECKSUMS_FILE, 'r');
|
||||
$checksumFile->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE);
|
||||
|
||||
$filesList = [];
|
||||
$lines = [];
|
||||
foreach ($checksumFile as $line) {
|
||||
$parts = explode(' ', $line);
|
||||
if (!isset($parts[1])) {
|
||||
// Skip end line
|
||||
break;
|
||||
}
|
||||
if (basename($parts[1]) === basename(CHECKSUMS_FILE)) {
|
||||
// Skip checksums.md5
|
||||
continue;
|
||||
}
|
||||
$filesList[] = [
|
||||
'path' => trim($parts[1]),
|
||||
'hash' => trim($parts[0])
|
||||
];
|
||||
}
|
||||
|
||||
$dynamicFiles = [
|
||||
$ignoreFiles = [
|
||||
'.env.example',
|
||||
'.htaccess',
|
||||
'robots.txt',
|
||||
|
@ -47,19 +29,34 @@ $dynamicFiles = [
|
|||
'favicon.png',
|
||||
'composer.json',
|
||||
'composer.lock',
|
||||
hide_bb_path(CHECKSUMS_FILE),
|
||||
hide_bb_path(BB_ENABLED),
|
||||
'library/config.php',
|
||||
'library/defines.php',
|
||||
'styles/images/logo/logo.png'
|
||||
];
|
||||
|
||||
$wrongFilesList = [];
|
||||
foreach ($filesList as $file) {
|
||||
if (!empty($dynamicFiles) && in_array($file['path'], $dynamicFiles)) {
|
||||
// Exclude dynamic files
|
||||
$filesList = [];
|
||||
$lines = [];
|
||||
foreach ($checksumFile as $line) {
|
||||
$parts = explode(' ', $line);
|
||||
if (!isset($parts[0]) || !isset($parts[1])) {
|
||||
// Skip end line
|
||||
break;
|
||||
}
|
||||
if (!empty($ignoreFiles) && in_array($parts[1], $ignoreFiles)) {
|
||||
// Skip files from "Ignoring list"
|
||||
continue;
|
||||
}
|
||||
if (!file_exists(BB_ROOT . '/' . $file['path']) || strtolower(md5_file(BB_ROOT . '/' . $file['path'])) !== strtolower($file['hash'])) {
|
||||
$filesList[] = [
|
||||
'path' => trim($parts[1]),
|
||||
'hash' => trim($parts[0])
|
||||
];
|
||||
}
|
||||
|
||||
$wrongFilesList = [];
|
||||
foreach ($filesList as $file) {
|
||||
if (!file_exists(BB_ROOT . '/' . $file['path']) || (strtolower(md5_file(BB_ROOT . '/' . $file['path'])) !== strtolower($file['hash']))) {
|
||||
$wrongFilesList[] = $file['path'];
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +80,9 @@ if (is_file(RESTORE_CORRUPT_CONFIRM_FILE)) {
|
|||
if (isset($buildDownloader->savePath)) {
|
||||
unlink($buildDownloader->savePath);
|
||||
}
|
||||
unlink(RESTORE_CORRUPT_CONFIRM_FILE);
|
||||
if (is_file(RESTORE_CORRUPT_CONFIRM_FILE)) {
|
||||
unlink(RESTORE_CORRUPT_CONFIRM_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue