remove copy of property that meant downloader would only lock one source at a time

This commit is contained in:
DubbleClick 2025-06-19 11:00:07 +07:00
parent 5f3f999222
commit 2f8e225abd
2 changed files with 11 additions and 6 deletions

View File

@ -650,6 +650,12 @@ class Downloader
return true;
}
}
if (!$force && $download_as === SPC_DOWNLOAD_PACKAGE && $lock_item !== null) {
if (file_exists($path = LockFile::getLockFullPath($lock_item))) {
logger()->notice("Source [{$name}] already downloaded: {$path}");
return true;
}
}
return false;
}
}

View File

@ -69,17 +69,16 @@ class LockFile
{
self::init();
$data = self::$lock_file_content;
if ($lock_content === null && isset($data[$lock_name])) {
self::removeLockFileIfExists($data[$lock_name]);
unset($data[$lock_name]);
if ($lock_content === null && isset(self::$lock_file_content[$lock_name])) {
self::removeLockFileIfExists(self::$lock_file_content[$lock_name]);
unset(self::$lock_file_content[$lock_name]);
} else {
$data[$lock_name] = $lock_content;
self::$lock_file_content[$lock_name] = $lock_content;
}
// Write the updated lock data back to the file
FileSystem::createDir(dirname(self::LOCK_FILE));
file_put_contents(self::LOCK_FILE, json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
file_put_contents(self::LOCK_FILE, json_encode(self::$lock_file_content, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
}
/**