mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 05:14:52 +08:00
simplify download error message
This commit is contained in:
parent
8a70da6291
commit
9b9644fe63
@ -59,7 +59,7 @@ class DownloadCommand extends BaseCommand
|
|||||||
*/
|
*/
|
||||||
public function handle(): int
|
public function handle(): int
|
||||||
{
|
{
|
||||||
// 删除旧资源
|
try {
|
||||||
if ($this->getOption('clean')) {
|
if ($this->getOption('clean')) {
|
||||||
logger()->warning('You are doing some operations that not recoverable: removing directories below');
|
logger()->warning('You are doing some operations that not recoverable: removing directories below');
|
||||||
logger()->warning(SOURCE_PATH);
|
logger()->warning(SOURCE_PATH);
|
||||||
@ -104,7 +104,6 @@ class DownloadCommand extends BaseCommand
|
|||||||
// use openssl 1.1
|
// use openssl 1.1
|
||||||
if ($this->getOption('with-openssl11')) {
|
if ($this->getOption('with-openssl11')) {
|
||||||
logger()->debug('Using openssl 1.1');
|
logger()->debug('Using openssl 1.1');
|
||||||
// 手动修改配置
|
|
||||||
Config::$source['openssl']['regex'] = '/href="(?<file>openssl-(?<version>1.[^"]+)\.tar\.gz)\"/';
|
Config::$source['openssl']['regex'] = '/href="(?<file>openssl-(?<version>1.[^"]+)\.tar\.gz)\"/';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,10 +153,16 @@ class DownloadCommand extends BaseCommand
|
|||||||
Downloader::downloadSource($source, Config::getSource($source));
|
Downloader::downloadSource($source, Config::getSource($source));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 打印拉取资源用时
|
|
||||||
$time = round(microtime(true) - START_TIME, 3);
|
$time = round(microtime(true) - START_TIME, 3);
|
||||||
logger()->info('Download complete, used ' . $time . ' s !');
|
logger()->info('Download complete, used ' . $time . ' s !');
|
||||||
return static::SUCCESS;
|
return static::SUCCESS;
|
||||||
|
} catch (DownloaderException $e) {
|
||||||
|
logger()->error($e->getMessage());
|
||||||
|
return static::FAILURE;
|
||||||
|
} catch (WrongUsageException $e) {
|
||||||
|
logger()->critical($e->getMessage());
|
||||||
|
return static::FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function downloadFromZip(string $path): int
|
private function downloadFromZip(string $path): int
|
||||||
|
|||||||
@ -335,7 +335,7 @@ class Downloader
|
|||||||
logger()->warning('Deleting download file: ' . $filename);
|
logger()->warning('Deleting download file: ' . $filename);
|
||||||
unlink(DOWNLOAD_PATH . '/' . $filename);
|
unlink(DOWNLOAD_PATH . '/' . $filename);
|
||||||
}
|
}
|
||||||
throw $e;
|
throw new DownloaderException('Download failed! ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user