nocache flag

This commit is contained in:
Jeremy Kauffman 2016-09-01 10:39:39 -04:00
parent 3c5e9e235c
commit 887b31cfaa
4 changed files with 16 additions and 14 deletions

View file

@ -116,7 +116,8 @@ class ContentActions extends Actions
public static function executeRoadmap()
{
$githubItems = Github::listRoadmapChangesets();
$cache = !isset($_GET['nocache']);
$githubItems = Github::listRoadmapChangesets($cache);
$projectMaxVersions = [];
$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', [
'projectMaxVersions' => $projectMaxVersions,
'items' => $items

View file

@ -4,7 +4,7 @@ class Asana
{
protected static $curlOptions = ['json_response' => true, 'cache' => true];
public static function listRoadmapTasks()
public static function listRoadmapTasks($cache = true)
{
/*
* return static::get('/projects');
@ -54,7 +54,7 @@ class Asana
// return static::get('/projects');
$projects = [
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'],
136290697597644 => ['Integration and Building', null],
158602294500249 => ['Documentation', null],
@ -66,7 +66,7 @@ class Asana
foreach($projects as $projectId => $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;
foreach ($projectTasks as $task)
{
@ -111,13 +111,14 @@ class Asana
return $tasks;
}
protected static function get($endpoint, array $data = [])
protected static function get($endpoint, array $data = [], $cache = true)
{
$apiKey = Config::get('asana_key');
$options = static::$curlOptions + [
'headers' => ['Authorization: Bearer ' . $apiKey]
];
$options = [
'headers' => ['Authorization: Bearer ' . $apiKey],
'cache' => $cache
] + static::$curlOptions;
$responseData = Curl::get('https://app.asana.com/api/1.0' . $endpoint, $data, $options);
return isset($responseData['data']) ? $responseData['data'] : [];

View file

@ -30,12 +30,12 @@ class Github
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 = [];
$allReleases = [];
@ -52,7 +52,7 @@ class Github
$page = 1;
do
{
$releases = static::get('/repos/lbryio/' . $project . '/releases?page=' . $page);
$releases = static::get('/repos/lbryio/' . $project . '/releases?page=' . $page, $cache);
$page++;
$allReleases = array_merge($allReleases, array_map(function($release) use($label, $project) {
return $release + ['project_label' => $label, 'project' => $project];

View file

@ -1,4 +1,4 @@
<?php Response::setMetaDescription('roadmap.description') ?>
<?php Response::setMetaDescription(__('roadmap.description')) ?>
<?php Response::addJsAsset('/js/roadmap.js') ?>
<?php NavActions::setNavUri('/learn') ?>
<?php echo View::render('nav/_header', ['isDark' => false]) ?>