rebuild cache

This commit is contained in:
Pau Capó 2018-03-04 00:50:11 +01:00
parent 2ab58438c9
commit 4401027058

View file

@ -96,12 +96,11 @@ class Gitea_Updater
function get_plugins() function get_plugins()
{ {
if (!$this->update('plugins')) {
$this->plugins = get_option('gitea_plugins'); $this->plugins = get_option('gitea_plugins');
return; if (!is_array($this->plugins)) {
$this->plugins = array();
} }
$this->plugins = array();
$plugins = get_plugins(); $plugins = get_plugins();
foreach ($plugins as $plugin_slug => $plugin) { foreach ($plugins as $plugin_slug => $plugin) {
@ -109,12 +108,17 @@ class Gitea_Updater
if (!empty($plugin['Gitea URI']) && !empty($plugin['Gitea Host'])) { if (!empty($plugin['Gitea URI']) && !empty($plugin['Gitea Host'])) {
// this is a gitea plugin // this is a gitea plugin
$slug = trim(dirname($plugin_slug), '/'); $slug = trim(dirname($plugin_slug), '/');
$local_version = strtolower($plugin['Version']);
if (isset($this->plugins[$slug]) && !$this->update('plugins')) {
$this->plugins[$slug]['local_version'] = $local_version;
continue;
}
$file = basename($plugin_slug); $file = basename($plugin_slug);
$host = $this->get_host($plugin['Gitea Host']); $host = $this->get_host($plugin['Gitea Host']);
$repo = $plugin['Gitea URI']; $repo = $plugin['Gitea URI'];
$local_version = strtolower($plugin['Version']);
$url = $this->get_url($host, $repo, '/raw/master/' . $file); $url = $this->get_url($host, $repo, '/raw/master/' . $file);
if ($url != false) { if ($url != false) {
@ -152,9 +156,9 @@ class Gitea_Updater
function get_themes() function get_themes()
{ {
if (!$this->update('themes')) {
$this->themes = get_option('gitea_themes'); $this->themes = get_option('gitea_themes');
return; if (!is_array($this->themes)) {
$this->themes = array();
} }
$this->themes = array(); $this->themes = array();
@ -165,11 +169,17 @@ class Gitea_Updater
if ($theme->get('Gitea Host') != '' && $theme->get('Gitea URI')) { if ($theme->get('Gitea Host') != '' && $theme->get('Gitea URI')) {
// this is a gitea theme // this is a gitea theme
$slug = $theme->stylesheet; $slug = $theme->stylesheet;
$local_version = strtolower($theme->get('Version'));
if (isset($this->themes[$slug]) && !$this->update('themes')) {
$this->themes[$slug]['local_version'] = $local_version;
continue;
}
$host = $this->get_host($theme->get('Gitea Host')); $host = $this->get_host($theme->get('Gitea Host'));
$repo = $theme->get('Gitea URI'); $repo = $theme->get('Gitea URI');
$local_version = strtolower($theme->get('Version'));
$url = $this->get_url($host, $repo, '/raw/master/style.css'); $url = $this->get_url($host, $repo, '/raw/master/style.css');
if ($url != false) { if ($url != false) {