mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 21:04:52 +08:00
remove copy of property that meant downloader would only lock one source at a time
This commit is contained in:
parent
5f3f999222
commit
2f8e225abd
@ -650,6 +650,12 @@ class Downloader
|
|||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,17 +69,16 @@ class LockFile
|
|||||||
{
|
{
|
||||||
self::init();
|
self::init();
|
||||||
|
|
||||||
$data = self::$lock_file_content;
|
if ($lock_content === null && isset(self::$lock_file_content[$lock_name])) {
|
||||||
if ($lock_content === null && isset($data[$lock_name])) {
|
self::removeLockFileIfExists(self::$lock_file_content[$lock_name]);
|
||||||
self::removeLockFileIfExists($data[$lock_name]);
|
unset(self::$lock_file_content[$lock_name]);
|
||||||
unset($data[$lock_name]);
|
|
||||||
} else {
|
} else {
|
||||||
$data[$lock_name] = $lock_content;
|
self::$lock_file_content[$lock_name] = $lock_content;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the updated lock data back to the file
|
// Write the updated lock data back to the file
|
||||||
FileSystem::createDir(dirname(self::LOCK_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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user