mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 08:15:39 +08:00
30 lines
727 B
PHP
30 lines
727 B
PHP
|
|
<?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",
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|