mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
roadmap suck less
This commit is contained in:
parent
8fcf46d473
commit
1aebc8a9c9
2 changed files with 19 additions and 47 deletions
|
@ -205,7 +205,7 @@ class ContentActions extends Actions
|
||||||
{
|
{
|
||||||
$lastItem = end($items);
|
$lastItem = end($items);
|
||||||
$project = $lastItem['project'];
|
$project = $lastItem['project'];
|
||||||
if (!isset($projectMaxVersions[$project]) || $lastItem['version'] > $projectMaxVersions[$project])
|
if (!isset($projectMaxVersions[$project]) || strnatcasecmp($lastItem['version'], $projectMaxVersions[$project]) > 0)
|
||||||
{
|
{
|
||||||
$projectMaxVersions[$project] = $lastItem['version'];
|
$projectMaxVersions[$project] = $lastItem['version'];
|
||||||
}
|
}
|
||||||
|
|
64
lib/thirdparty/Github.class.php
vendored
64
lib/thirdparty/Github.class.php
vendored
|
@ -13,8 +13,10 @@ class Github
|
||||||
{
|
{
|
||||||
$ext = substr($asset['name'], -4);
|
$ext = substr($asset['name'], -4);
|
||||||
if (
|
if (
|
||||||
($os == OS::OS_LINUX && ($ext == '.deb' || in_array($asset['content_type'], ['application/x-debian-package', 'application/x-deb']))) ||
|
($os == OS::OS_LINUX &&
|
||||||
($os == OS::OS_OSX && ($ext == '.dmg' || in_array($asset['content_type'], ['application/x-diskcopy', 'application/x-apple-diskimage']))) ||
|
($ext == '.deb' || in_array($asset['content_type'], ['application/x-debian-package', 'application/x-deb']))) ||
|
||||||
|
($os == OS::OS_OSX &&
|
||||||
|
($ext == '.dmg' || in_array($asset['content_type'], ['application/x-diskcopy', 'application/x-apple-diskimage']))) ||
|
||||||
($os == OS::OS_WINDOWS && $ext == '.exe')
|
($os == OS::OS_WINDOWS && $ext == '.exe')
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +107,7 @@ class Github
|
||||||
$allReleases = [];
|
$allReleases = [];
|
||||||
|
|
||||||
$project = 'lbry';
|
$project = 'lbry';
|
||||||
$page = 1;
|
$page = 1;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -116,7 +118,7 @@ class Github
|
||||||
return $release + ['project' => $project];
|
return $release + ['project' => $project];
|
||||||
}, array_filter($releases, function ($release)
|
}, array_filter($releases, function ($release)
|
||||||
{
|
{
|
||||||
return isset($release['tag_name']) && isset($release['published_at']) && $release['published_at'];
|
return ($release['tag_name'] ?? null) && ($release['published_at'] ?? null) && !$release['prerelease'];
|
||||||
})));
|
})));
|
||||||
} while (count($releases) >= 30);
|
} while (count($releases) >= 30);
|
||||||
|
|
||||||
|
@ -124,58 +126,28 @@ class Github
|
||||||
{
|
{
|
||||||
$group = null;
|
$group = null;
|
||||||
$matches = null;
|
$matches = null;
|
||||||
if (isset($release['tag_name']) && preg_match('/v(\d+)\.(\d+).?(\d+)?/', $release['tag_name'], $matches))
|
if (preg_match('/^v(\d+)\.(\d+)\./', $release['tag_name'] ?? '', $matches))
|
||||||
{
|
{
|
||||||
$group = 'v' . $matches[1] . '.' . $matches[2];
|
$group = 'v' . $matches[1] . '.' . $matches[2];
|
||||||
}
|
}
|
||||||
if ($group)
|
if ($group)
|
||||||
{
|
{
|
||||||
$sets[$group][] = array_intersect_key($release, [
|
$sets[$group][] = [
|
||||||
'prerelease' => null, 'tag_name' => null, 'published_at' => null, 'project' => null
|
'project' => $release['project'],
|
||||||
]) + [
|
'date' => date('Y-m-d', strtotime($release['created_at'])),
|
||||||
'date' => date('Y-m-d', strtotime($release['created_at'])),
|
'created_at' => $release['created_at'],
|
||||||
//I thought published_at, but GitHub displays created_at and published_at is out of sync sometimes (0.3.2, 0.3.3)
|
'name' => $release['name'] ?: $release['tag_name'],
|
||||||
'name' => $release['name'] ?: $release['tag_name'],
|
'url' => $release['html_url'],
|
||||||
'url' => $release['html_url'],
|
'version' => $release['tag_name'],
|
||||||
'major_version' => $matches[1],
|
'body' => ParsedownExtra::instance()->text($release['body'])
|
||||||
'minor_version' => $matches[2],
|
];
|
||||||
'patch_version' => isset($matches[3]) ? $matches[3] : null,
|
|
||||||
'version' => $matches[1] . '.' . $matches[2] . '.' . (isset($matches[3]) ? $matches[3] : ''),
|
|
||||||
'body' => ParsedownExtra::instance()->text($release['body'])
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uasort($sets, function ($sA, $sB)
|
uasort($sets, function ($sA, $sB) { return $sA[0]['created_at'] <=> $sB[0]['created_at']; });
|
||||||
{
|
|
||||||
if ($sA[0]['project'] != $sB[0]['project'])
|
|
||||||
{
|
|
||||||
return $sA[0]['project'] < $sB[0]['project'] ? -1 : 1;
|
|
||||||
}
|
|
||||||
if ($sA[0]['major_version'] != $sB[0]['major_version'])
|
|
||||||
{
|
|
||||||
return $sA[0]['major_version'] < $sB[0]['major_version'] ? -1 : 1;
|
|
||||||
}
|
|
||||||
if ($sA[0]['minor_version'] != $sB[0]['minor_version'])
|
|
||||||
{
|
|
||||||
return $sA[0]['minor_version'] < $sB[0]['minor_version'] ? -1 : 1;
|
|
||||||
}
|
|
||||||
return $sA[0]['patch_version'] < $sB[0]['patch_version'] ? -1 : 1;
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach ($sets as $group => &$groupSet)
|
foreach ($sets as $group => &$groupSet)
|
||||||
{
|
{
|
||||||
usort($groupSet, function ($rA, $rB) {
|
usort($groupSet, function ($rA, $rB) { return $rA['created_at'] <=> $rB['created_at']; });
|
||||||
if ($rA['major_version'] != $rB['major_version'])
|
|
||||||
{
|
|
||||||
return $rA['major_version'] < $rB['major_version'] ? -1 : 1;
|
|
||||||
}
|
|
||||||
if ($rA['minor_version'] != $rB['minor_version'])
|
|
||||||
{
|
|
||||||
return $rA['minor_version'] < $rB['minor_version'] ? -1 : 1;
|
|
||||||
}
|
|
||||||
return $rA['patch_version'] < $rB['patch_version'] ? -1 : 1;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $sets;
|
return $sets;
|
||||||
|
|
Loading…
Add table
Reference in a new issue