Skip to content

Commit

Permalink
removed token requirement for core update
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Sep 21, 2017
1 parent 3b3e3bb commit 380bd75
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
15 changes: 0 additions & 15 deletions app/Http/Controllers/Install/Updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,11 @@
use App\Models\Module\Module as Model;
use App\Utilities\Updater;
use App\Utilities\Versions;
use Illuminate\Routing\Route;
use Module;

class Updates extends Controller
{

/**
* Instantiate a new controller instance.
*
* @param Route $route
*/
public function __construct(Route $route)
{
if (!setting('general.api_token')) {
return redirect('modules/token/create')->send();
}

parent::__construct($route);
}

/**
* Show the form for creating a new resource.
*
Expand Down
2 changes: 1 addition & 1 deletion app/Utilities/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static function all()
// Get data from cache
$data = Cache::get('updates');

if (!empty($data) || !setting('general.api_token')) {
if (!empty($data)) {
return $data;
}

Expand Down
9 changes: 8 additions & 1 deletion app/Utilities/Versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static function latest($modules = array())
// Get data from cache
$data = Cache::get('versions');

if (!empty($data) || !setting('general.api_token')) {
if (!empty($data)) {
return $data;
}

Expand All @@ -74,6 +74,13 @@ public static function latest($modules = array())

$data['core'] = static::getLatestVersion($url);

// API token required for modules
if (!setting('general.api_token')) {
Cache::put('versions', $data, Date::now()->addHour(6));

return $data;
}

// Then modules
foreach ($modules as $module) {
$alias = $module->get('alias');
Expand Down

0 comments on commit 380bd75

Please sign in to comment.