aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-11-09 14:37:45 +0100
committerArthurHoaro <arthur@hoa.ro>2020-11-09 14:42:30 +0100
commit80c8889bfe5151a23066188e6c74c3c1e8575e61 (patch)
tree1a86f8a9d1fecf786c5346025c5e31343e92e379 /application
parentd9d71b10c3bc70a0881d630b37dc4e918c9e812f (diff)
downloadShaarli-80c8889bfe5151a23066188e6c74c3c1e8575e61.tar.gz
Shaarli-80c8889bfe5151a23066188e6c74c3c1e8575e61.tar.zst
Shaarli-80c8889bfe5151a23066188e6c74c3c1e8575e61.zip
Server admin: do not retrieve latest version without update_check
If the setting 'updates.check_updates' is disabled, do not retrieve the latest version on server administration page. Additionally, updated default values for - updates.check_updates from false to true - updates.check_updates_branch from stable to latest
Diffstat (limited to 'application')
-rw-r--r--application/config/ConfigManager.php4
-rw-r--r--application/front/controller/admin/ServerController.php15
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'));