add postgresql and custom downloader

This commit is contained in:
crazywhalecc
2023-04-09 12:11:14 +08:00
parent 9970986a52
commit 76e95b8c55
8 changed files with 122 additions and 5 deletions

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace SPC\store\source;
use SPC\store\Downloader;
class PostgreSQLSource extends CustomSourceBase
{
public const NAME = 'postgresql';
public function fetch()
{
Downloader::fetchSource('postgresql', self::getLatestInfo());
}
public function getLatestInfo(): array
{
[$url, $filename, $version] = Downloader::getFromFileList('postgresql', [
'url' => 'https://www.postgresql.org/ftp/source/',
'regex' => '/href="(?<file>v(?<version>[^"]+)\/)"/',
]);
return [
'type' => 'url',
'url' => "https://ftp.postgresql.org/pub/source/{$filename}postgresql-{$version}.tar.gz",
];
}
}