Let GPM read and pass the current channel to Grav's repository

This commit is contained in:
Djamil Legato
2016-04-20 11:41:51 -07:00
parent 8b39411fb4
commit cbd6ab42c3
4 changed files with 4 additions and 6 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);
}
}

View File

@@ -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);
}
}