mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
nocache flag
This commit is contained in:
parent
3c5e9e235c
commit
887b31cfaa
4 changed files with 16 additions and 14 deletions
|
@ -116,7 +116,8 @@ class ContentActions extends Actions
|
||||||
|
|
||||||
public static function executeRoadmap()
|
public static function executeRoadmap()
|
||||||
{
|
{
|
||||||
$githubItems = Github::listRoadmapChangesets();
|
$cache = !isset($_GET['nocache']);
|
||||||
|
$githubItems = Github::listRoadmapChangesets($cache);
|
||||||
|
|
||||||
$projectMaxVersions = [];
|
$projectMaxVersions = [];
|
||||||
$closedGroups = [];
|
$closedGroups = [];
|
||||||
|
@ -133,7 +134,7 @@ class ContentActions extends Actions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$items = array_merge($githubItems, Asana::listRoadmapTasks());
|
$items = array_merge($githubItems, Asana::listRoadmapTasks($cache));
|
||||||
return ['content/roadmap', [
|
return ['content/roadmap', [
|
||||||
'projectMaxVersions' => $projectMaxVersions,
|
'projectMaxVersions' => $projectMaxVersions,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Asana
|
||||||
{
|
{
|
||||||
protected static $curlOptions = ['json_response' => true, 'cache' => true];
|
protected static $curlOptions = ['json_response' => true, 'cache' => true];
|
||||||
|
|
||||||
public static function listRoadmapTasks()
|
public static function listRoadmapTasks($cache = true)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* return static::get('/projects');
|
* return static::get('/projects');
|
||||||
|
@ -54,7 +54,7 @@ class Asana
|
||||||
// return static::get('/projects');
|
// return static::get('/projects');
|
||||||
$projects = [
|
$projects = [
|
||||||
158602294500138 => ['LBRY Browser', 'https://github.com/lbryio/lbry-web-ui'],
|
158602294500138 => ['LBRY Browser', 'https://github.com/lbryio/lbry-web-ui'],
|
||||||
158602294500137 => ['LBRYnet', 'https://github.com/lbryio/lbry'],
|
158602294500137 => ['LBRY Data Network', 'https://github.com/lbryio/lbry'],
|
||||||
161514803479899 => ['Blockchain and Wallets', 'https://github.com/lbryio/lbrycrd'],
|
161514803479899 => ['Blockchain and Wallets', 'https://github.com/lbryio/lbrycrd'],
|
||||||
136290697597644 => ['Integration and Building', null],
|
136290697597644 => ['Integration and Building', null],
|
||||||
158602294500249 => ['Documentation', null],
|
158602294500249 => ['Documentation', null],
|
||||||
|
@ -66,7 +66,7 @@ class Asana
|
||||||
foreach($projects as $projectId => $projectTuple)
|
foreach($projects as $projectId => $projectTuple)
|
||||||
{
|
{
|
||||||
list($projectName, $projectUrl) = $projectTuple;
|
list($projectName, $projectUrl) = $projectTuple;
|
||||||
$projectTasks = static::get('/tasks?' . http_build_query(['completed_since' => 'now', 'project' => $projectId]));
|
$projectTasks = static::get('/tasks', ['completed_since' => 'now', 'project' => $projectId], $cache);
|
||||||
$group = null;
|
$group = null;
|
||||||
foreach ($projectTasks as $task)
|
foreach ($projectTasks as $task)
|
||||||
{
|
{
|
||||||
|
@ -111,13 +111,14 @@ class Asana
|
||||||
return $tasks;
|
return $tasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function get($endpoint, array $data = [])
|
protected static function get($endpoint, array $data = [], $cache = true)
|
||||||
{
|
{
|
||||||
$apiKey = Config::get('asana_key');
|
$apiKey = Config::get('asana_key');
|
||||||
|
|
||||||
$options = static::$curlOptions + [
|
$options = [
|
||||||
'headers' => ['Authorization: Bearer ' . $apiKey]
|
'headers' => ['Authorization: Bearer ' . $apiKey],
|
||||||
];
|
'cache' => $cache
|
||||||
|
] + static::$curlOptions;
|
||||||
|
|
||||||
$responseData = Curl::get('https://app.asana.com/api/1.0' . $endpoint, $data, $options);
|
$responseData = Curl::get('https://app.asana.com/api/1.0' . $endpoint, $data, $options);
|
||||||
return isset($responseData['data']) ? $responseData['data'] : [];
|
return isset($responseData['data']) ? $responseData['data'] : [];
|
||||||
|
|
|
@ -30,12 +30,12 @@ class Github
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get($endpoint)
|
public static function get($endpoint, $cache = true)
|
||||||
{
|
{
|
||||||
return Curl::get('https://api.github.com' . $endpoint, [], ['user_agent' => 'LBRY', 'json_response' => true, 'cache' => true]);
|
return Curl::get('https://api.github.com' . $endpoint, [], ['user_agent' => 'LBRY', 'json_response' => true, 'cache' => $cache]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function listRoadmapChangesets()
|
public static function listRoadmapChangesets($cache = true)
|
||||||
{
|
{
|
||||||
$sets = [];
|
$sets = [];
|
||||||
$allReleases = [];
|
$allReleases = [];
|
||||||
|
@ -52,7 +52,7 @@ class Github
|
||||||
$page = 1;
|
$page = 1;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
$releases = static::get('/repos/lbryio/' . $project . '/releases?page=' . $page);
|
$releases = static::get('/repos/lbryio/' . $project . '/releases?page=' . $page, $cache);
|
||||||
$page++;
|
$page++;
|
||||||
$allReleases = array_merge($allReleases, array_map(function($release) use($label, $project) {
|
$allReleases = array_merge($allReleases, array_map(function($release) use($label, $project) {
|
||||||
return $release + ['project_label' => $label, 'project' => $project];
|
return $release + ['project_label' => $label, 'project' => $project];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?php Response::setMetaDescription('roadmap.description') ?>
|
<?php Response::setMetaDescription(__('roadmap.description')) ?>
|
||||||
<?php Response::addJsAsset('/js/roadmap.js') ?>
|
<?php Response::addJsAsset('/js/roadmap.js') ?>
|
||||||
<?php NavActions::setNavUri('/learn') ?>
|
<?php NavActions::setNavUri('/learn') ?>
|
||||||
<?php echo View::render('nav/_header', ['isDark' => false]) ?>
|
<?php echo View::render('nav/_header', ['isDark' => false]) ?>
|
||||||
|
|
Loading…
Add table
Reference in a new issue