mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 00:35:41 +08:00
add postgresql and custom downloader
This commit is contained in:
29
src/SPC/store/source/PostgreSQLSource.php
Normal file
29
src/SPC/store/source/PostgreSQLSource.php
Normal 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",
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user