mirror of
https://github.com/getgrav/grav.git
synced 2026-05-06 16:47:30 +02:00
Minor adjustments to the repository URL for GPM
This commit is contained in:
@@ -18,23 +18,27 @@ class GravCore extends AbstractPackageCollection
|
||||
*/
|
||||
public function __construct($refresh = false, $callback = null)
|
||||
{
|
||||
$cache_dir = Grav::instance()['locator']->findResource('cache://gpm', true, true);
|
||||
$this->cache = new FilesystemCache($cache_dir);
|
||||
$this->raw = $this->cache->fetch(md5($this->repository));
|
||||
$cache_dir = Grav::instance()['locator']->findResource('cache://gpm', true, true);
|
||||
$this->cache = new FilesystemCache($cache_dir);
|
||||
$this->repository .= '?v=' . GRAV_VERSION;
|
||||
$this->raw = $this->cache->fetch(md5($this->repository));
|
||||
|
||||
$this->fetch($refresh, $callback);
|
||||
|
||||
$this->data = json_decode($this->raw, true);
|
||||
$this->data = json_decode($this->raw, true);
|
||||
$this->version = isset($this->data['version']) ? $this->data['version'] : '-';
|
||||
$this->date = isset($this->data['date']) ? $this->data['date'] : '-';
|
||||
$this->date = isset($this->data['date']) ? $this->data['date'] : '-';
|
||||
|
||||
if (isset($this->data['assets'])) foreach ($this->data['assets'] as $slug => $data) {
|
||||
$this->items[$slug] = new Package($data);
|
||||
if (isset($this->data['assets'])) {
|
||||
foreach ($this->data['assets'] as $slug => $data) {
|
||||
$this->items[$slug] = new Package($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of assets associated to the latest version of Grav
|
||||
*
|
||||
* @return array list of assets
|
||||
*/
|
||||
public function getAssets()
|
||||
@@ -44,6 +48,7 @@ class GravCore extends AbstractPackageCollection
|
||||
|
||||
/**
|
||||
* Returns the changelog list for each version of Grav
|
||||
*
|
||||
* @param string $diff the version number to start the diff from
|
||||
*
|
||||
* @return array changelog list for each version
|
||||
@@ -58,7 +63,9 @@ class GravCore extends AbstractPackageCollection
|
||||
foreach ($this->data['changelog'] as $version => $changelog) {
|
||||
preg_match("/[\w-\.]+/", $version, $cleanVersion);
|
||||
|
||||
if (!$cleanVersion || version_compare($diff, $cleanVersion[0], ">=")) { continue; }
|
||||
if (!$cleanVersion || version_compare($diff, $cleanVersion[0], ">=")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$diffLog[$version] = $changelog;
|
||||
}
|
||||
@@ -66,17 +73,9 @@ class GravCore extends AbstractPackageCollection
|
||||
return $diffLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the latest version of Grav available remotely
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the release date of the latest Grav
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDate()
|
||||
@@ -89,6 +88,16 @@ class GravCore extends AbstractPackageCollection
|
||||
return version_compare(GRAV_VERSION, $this->getVersion(), '<');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the latest version of Grav available remotely
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
public function isSymlink()
|
||||
{
|
||||
return is_link(GRAV_ROOT . DS . 'index.php');
|
||||
|
||||
@@ -12,7 +12,7 @@ class Plugins extends AbstractPackageCollection
|
||||
*/
|
||||
protected $type = 'plugins';
|
||||
|
||||
protected $repository = 'https://getgrav.org/downloads/plugins.json?v=';
|
||||
protected $repository = 'https://getgrav.org/downloads/plugins.json';
|
||||
|
||||
/**
|
||||
* Local Plugins Constructor
|
||||
@@ -21,7 +21,7 @@ class Plugins extends AbstractPackageCollection
|
||||
*/
|
||||
public function __construct($refresh = false, $callback = null)
|
||||
{
|
||||
$this->repository .= GRAV_VERSION;
|
||||
$this->repository .= '?v=' . GRAV_VERSION;
|
||||
|
||||
parent::__construct($this->repository, $refresh, $callback);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class Themes extends AbstractPackageCollection
|
||||
*/
|
||||
protected $type = 'themes';
|
||||
|
||||
protected $repository = 'https://getgrav.org/downloads/themes.json?v=';
|
||||
protected $repository = 'https://getgrav.org/downloads/themes.json';
|
||||
|
||||
/**
|
||||
* Local Themes Constructor
|
||||
@@ -21,7 +21,7 @@ class Themes extends AbstractPackageCollection
|
||||
*/
|
||||
public function __construct($refresh = false, $callback = null)
|
||||
{
|
||||
$this->repository .= GRAV_VERSION;
|
||||
$this->repository .= '?v=' . GRAV_VERSION;
|
||||
|
||||
parent::__construct($this->repository, $refresh, $callback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user