diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-11-10 10:45:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 10:45:50 +0100 |
commit | c94c32d1a3e86a479cb2582eadc668a5bb476fc6 (patch) | |
tree | 77ea0ce809cebc56c90672b6cccdf9563da2440f /application | |
parent | 39b75ea9836054df22a377f0f0f28d6ac9a19dc2 (diff) | |
parent | 80c8889bfe5151a23066188e6c74c3c1e8575e61 (diff) | |
download | Shaarli-c94c32d1a3e86a479cb2582eadc668a5bb476fc6.tar.gz Shaarli-c94c32d1a3e86a479cb2582eadc668a5bb476fc6.tar.zst Shaarli-c94c32d1a3e86a479cb2582eadc668a5bb476fc6.zip |
Merge pull request #1637 from ArthurHoaro/fix/server-admin-update-check
Server admin: do not retrieve latest version without update_check
Diffstat (limited to 'application')
-rw-r--r-- | application/config/ConfigManager.php | 4 | ||||
-rw-r--r-- | application/front/controller/admin/ServerController.php | 15 |
2 files changed, 13 insertions, 6 deletions
diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index a035baae..3260d7c0 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php | |||
@@ -370,8 +370,8 @@ class ConfigManager | |||
370 | $this->setEmpty('general.enable_async_metadata', true); | 370 | $this->setEmpty('general.enable_async_metadata', true); |
371 | $this->setEmpty('general.tags_separator', ' '); | 371 | $this->setEmpty('general.tags_separator', ' '); |
372 | 372 | ||
373 | $this->setEmpty('updates.check_updates', false); | 373 | $this->setEmpty('updates.check_updates', true); |
374 | $this->setEmpty('updates.check_updates_branch', 'stable'); | 374 | $this->setEmpty('updates.check_updates_branch', 'latest'); |
375 | $this->setEmpty('updates.check_updates_interval', 86400); | 375 | $this->setEmpty('updates.check_updates_interval', 86400); |
376 | 376 | ||
377 | $this->setEmpty('feed.rss_permalinks', true); | 377 | $this->setEmpty('feed.rss_permalinks', true); |
diff --git a/application/front/controller/admin/ServerController.php b/application/front/controller/admin/ServerController.php index bfc99422..780151dd 100644 --- a/application/front/controller/admin/ServerController.php +++ b/application/front/controller/admin/ServerController.php | |||
@@ -25,9 +25,16 @@ class ServerController extends ShaarliAdminController | |||
25 | */ | 25 | */ |
26 | public function index(Request $request, Response $response): Response | 26 | public function index(Request $request, Response $response): Response |
27 | { | 27 | { |
28 | $latestVersion = 'v' . ApplicationUtils::getVersion( | 28 | $releaseUrl = ApplicationUtils::$GITHUB_URL . '/releases/'; |
29 | ApplicationUtils::$GIT_RAW_URL . '/latest/' . ApplicationUtils::$VERSION_FILE | 29 | if ($this->container->conf->get('updates.check_updates', true)) { |
30 | ); | 30 | $latestVersion = 'v' . ApplicationUtils::getVersion( |
31 | ApplicationUtils::$GIT_RAW_URL . '/latest/' . ApplicationUtils::$VERSION_FILE | ||
32 | ); | ||
33 | $releaseUrl .= 'tag/' . $latestVersion; | ||
34 | } else { | ||
35 | $latestVersion = t('Check disabled'); | ||
36 | } | ||
37 | |||
31 | $currentVersion = ApplicationUtils::getVersion('./shaarli_version.php'); | 38 | $currentVersion = ApplicationUtils::getVersion('./shaarli_version.php'); |
32 | $currentVersion = $currentVersion === 'dev' ? $currentVersion : 'v' . $currentVersion; | 39 | $currentVersion = $currentVersion === 'dev' ? $currentVersion : 'v' . $currentVersion; |
33 | $phpEol = new \DateTimeImmutable(ApplicationUtils::getPhpEol(PHP_VERSION)); | 40 | $phpEol = new \DateTimeImmutable(ApplicationUtils::getPhpEol(PHP_VERSION)); |
@@ -37,7 +44,7 @@ class ServerController extends ShaarliAdminController | |||
37 | $this->assignView('php_has_reached_eol', $phpEol < new \DateTimeImmutable()); | 44 | $this->assignView('php_has_reached_eol', $phpEol < new \DateTimeImmutable()); |
38 | $this->assignView('php_extensions', ApplicationUtils::getPhpExtensionsRequirement()); | 45 | $this->assignView('php_extensions', ApplicationUtils::getPhpExtensionsRequirement()); |
39 | $this->assignView('permissions', ApplicationUtils::checkResourcePermissions($this->container->conf)); | 46 | $this->assignView('permissions', ApplicationUtils::checkResourcePermissions($this->container->conf)); |
40 | $this->assignView('release_url', ApplicationUtils::$GITHUB_URL . '/releases/tag/' . $latestVersion); | 47 | $this->assignView('release_url', $releaseUrl); |
41 | $this->assignView('latest_version', $latestVersion); | 48 | $this->assignView('latest_version', $latestVersion); |
42 | $this->assignView('current_version', $currentVersion); | 49 | $this->assignView('current_version', $currentVersion); |
43 | $this->assignView('thumbnails_mode', $this->container->conf->get('thumbnails.mode')); | 50 | $this->assignView('thumbnails_mode', $this->container->conf->get('thumbnails.mode')); |