From cbd6ab42c358b7065edbfefc1ada1e70a49f6db8 Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Wed, 20 Apr 2016 11:41:51 -0700 Subject: [PATCH] Let GPM read and pass the current channel to Grav's repository --- .../src/Grav/Common/GPM/Remote/AbstractPackageCollection.php | 3 ++- system/src/Grav/Common/GPM/Remote/GravCore.php | 3 ++- system/src/Grav/Common/GPM/Remote/Plugins.php | 2 -- system/src/Grav/Common/GPM/Remote/Themes.php | 2 -- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php b/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php index 2895793a3..a1cdddfcd 100644 --- a/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php +++ b/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php @@ -41,10 +41,11 @@ class AbstractPackageCollection extends BaseCollection throw new \RuntimeException("A repository is required to indicate the origin of the remote collection"); } + $channel = Grav::instance()['config']->get('system.gpm.releases', 'stable'); $cache_dir = Grav::instance()['locator']->findResource('cache://gpm', true, true); $this->cache = new FilesystemCache($cache_dir); - $this->repository = $repository . '?v=' . GRAV_VERSION; + $this->repository = $repository . '?v=' . GRAV_VERSION . '&' . $channel . '=1'; $this->raw = $this->cache->fetch(md5($this->repository)); $this->fetch($refresh, $callback); diff --git a/system/src/Grav/Common/GPM/Remote/GravCore.php b/system/src/Grav/Common/GPM/Remote/GravCore.php index 2c16bbb70..31b8c57a6 100644 --- a/system/src/Grav/Common/GPM/Remote/GravCore.php +++ b/system/src/Grav/Common/GPM/Remote/GravCore.php @@ -18,9 +18,10 @@ class GravCore extends AbstractPackageCollection */ public function __construct($refresh = false, $callback = null) { + $channel = Grav::instance()['config']->get('system.gpm.releases', 'stable'); $cache_dir = Grav::instance()['locator']->findResource('cache://gpm', true, true); $this->cache = new FilesystemCache($cache_dir); - $this->repository .= '?v=' . GRAV_VERSION; + $this->repository .= '?v=' . GRAV_VERSION . '&' . $channel . '=1'; $this->raw = $this->cache->fetch(md5($this->repository)); $this->fetch($refresh, $callback); diff --git a/system/src/Grav/Common/GPM/Remote/Plugins.php b/system/src/Grav/Common/GPM/Remote/Plugins.php index 074e5d039..036fc0c2a 100644 --- a/system/src/Grav/Common/GPM/Remote/Plugins.php +++ b/system/src/Grav/Common/GPM/Remote/Plugins.php @@ -21,8 +21,6 @@ class Plugins extends AbstractPackageCollection */ public function __construct($refresh = false, $callback = null) { - $this->repository .= '?v=' . GRAV_VERSION; - parent::__construct($this->repository, $refresh, $callback); } } diff --git a/system/src/Grav/Common/GPM/Remote/Themes.php b/system/src/Grav/Common/GPM/Remote/Themes.php index cc4af7d02..43a5af54d 100644 --- a/system/src/Grav/Common/GPM/Remote/Themes.php +++ b/system/src/Grav/Common/GPM/Remote/Themes.php @@ -21,8 +21,6 @@ class Themes extends AbstractPackageCollection */ public function __construct($refresh = false, $callback = null) { - $this->repository .= '?v=' . GRAV_VERSION; - parent::__construct($this->repository, $refresh, $callback); } }