]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/front/controller/admin/ServerController.php
Fix: soft fail if the mutex is not working
[github/shaarli/Shaarli.git] / application / front / controller / admin / ServerController.php
index 809979402ebd2be76d46c46e23658e75cb8236d8..4b74f4a94f4549385f1fa3f50e9082375ee66a12 100644 (file)
@@ -25,19 +25,31 @@ class ServerController extends ShaarliAdminController
      */
     public function index(Request $request, Response $response): Response
     {
-        $latestVersion = 'v' . ApplicationUtils::getVersion(
-            ApplicationUtils::$GIT_RAW_URL . '/latest/' . ApplicationUtils::$VERSION_FILE
-        );
+        $releaseUrl = ApplicationUtils::$GITHUB_URL . '/releases/';
+        if ($this->container->conf->get('updates.check_updates', true)) {
+            $latestVersion = 'v' . ApplicationUtils::getVersion(
+                ApplicationUtils::$GIT_RAW_URL . '/latest/' . ApplicationUtils::$VERSION_FILE
+            );
+            $releaseUrl .= 'tag/' . $latestVersion;
+        } else {
+            $latestVersion = t('Check disabled');
+        }
+
         $currentVersion = ApplicationUtils::getVersion('./shaarli_version.php');
         $currentVersion = $currentVersion === 'dev' ? $currentVersion : 'v' . $currentVersion;
         $phpEol = new \DateTimeImmutable(ApplicationUtils::getPhpEol(PHP_VERSION));
 
+        $permissions = array_merge(
+            ApplicationUtils::checkResourcePermissions($this->container->conf),
+            ApplicationUtils::checkDatastoreMutex()
+        );
+
         $this->assignView('php_version', PHP_VERSION);
         $this->assignView('php_eol', format_date($phpEol, false));
         $this->assignView('php_has_reached_eol', $phpEol < new \DateTimeImmutable());
         $this->assignView('php_extensions', ApplicationUtils::getPhpExtensionsRequirement());
-        $this->assignView('permissions', ApplicationUtils::checkResourcePermissions($this->container->conf));
-        $this->assignView('release_url', ApplicationUtils::$GITHUB_URL . '/releases/tag/' . $latestVersion);
+        $this->assignView('permissions', $permissions);
+        $this->assignView('release_url', $releaseUrl);
         $this->assignView('latest_version', $latestVersion);
         $this->assignView('current_version', $currentVersion);
         $this->assignView('thumbnails_mode', $this->container->conf->get('thumbnails.mode'));
@@ -65,7 +77,9 @@ class ServerController extends ShaarliAdminController
 
             $this->saveWarningMessage(
                 t('Thumbnails cache has been cleared.') . ' ' .
-                '<a href="' . $this->container->basePath . '/admin/thumbnails">' . t('Please synchronize them.') . '</a>'
+                '<a href="' . $this->container->basePath . '/admin/thumbnails">' .
+                    t('Please synchronize them.') .
+                '</a>'
             );
         } else {
             $folders = [