]> source.dussan.org Git - nextcloud-server.git/commitdiff
added some missed diagnosis output
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Fri, 12 Aug 2016 14:52:20 +0000 (16:52 +0200)
committerLukas Reschke <lukas@statuscode.ch>
Tue, 16 Aug 2016 19:09:50 +0000 (21:09 +0200)
lib/private/Server.php
lib/private/Settings/Admin/Server.php
lib/private/Settings/Manager.php

index 69574b975aae65f2715ced7e8d0551572aabf81f..ff5b1a11f44b3add2e360e04beb1ab924aca69e0 100644 (file)
@@ -728,7 +728,8 @@ class Server extends ServerContainer implements IServerContainer {
                                $c->getL10N('core'),
                                $c->getConfig(),
                                $c->getEncryptionManager(),
-                               $c->getUserManager()
+                               $c->getUserManager(),
+                               $c->getLockingProvider()
                        );
                        return $manager;
                });
index 4f1edcf469105bac1da684fa9ec71f86649243cf..0c72983a887a906a572b89e83c4eeb956a3cc386 100644 (file)
@@ -26,9 +26,13 @@ namespace OC\Settings\Admin;
 use Doctrine\DBAL\Connection;
 use Doctrine\DBAL\DBALException;
 use Doctrine\DBAL\Platforms\SqlitePlatform;
+use OC\Lock\DBLockingProvider;
+use OC\Lock\NoopLockingProvider;
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\IConfig;
 use OCP\IDBConnection;
+use OCP\IL10N;
+use OCP\Lock\ILockingProvider;
 use OCP\Settings\ISettings;
 
 class Server implements ISettings {
@@ -39,9 +43,17 @@ class Server implements ISettings {
        /** @var IConfig */
        private $config;
 
-       public function __construct(IDBConnection $db, IConfig $config) {
+       /** @var ILockingProvider */
+       private $lockingProvider;
+
+       /** @var IL10N */
+       private $l;
+
+       public function __construct(IDBConnection $db, IConfig $config, ILockingProvider $lockingProvider, IL10N $l) {
                $this->db = $db;
                $this->config = $config;
+               $this->lockingProvider = $lockingProvider;
+               $this->l = $l;
        }
 
        /**
@@ -59,19 +71,54 @@ class Server implements ISettings {
                        $invalidTransactionIsolationLevel = false;
                }
 
+               $envPath = getenv('PATH');
+
+               // warn if outdated version of a memcache module is used
+               $caches = [
+                       'apcu'  => ['name' => $this->l->t('APCu'), 'version' => '4.0.6'],
+                       'redis' => ['name' => $this->l->t('Redis'), 'version' => '2.2.5'],
+               ];
+               $outdatedCaches = [];
+               foreach ($caches as $php_module => $data) {
+                       $isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<');
+                       if ($isOutdated) {
+                               $outdatedCaches[$php_module] = $data;
+                       }
+               }
+
+               if ($this->lockingProvider instanceof NoopLockingProvider) {
+                       $fileLockingType = 'none';
+               } else if ($this->lockingProvider instanceof DBLockingProvider) {
+                       $fileLockingType = 'db';
+               } else {
+                       $fileLockingType = 'cache';
+               }
+
+               // If the current web root is non-empty but the web root from the config is,
+               // and system cron is used, the URL generator fails to build valid URLs.
+               $shouldSuggestOverwriteCliUrl = $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'cron'
+                       && \OC::$WEBROOT && \OC::$WEBROOT !== '/'
+                       && !$this->config->getSystemValue('overwrite.cli.url', '');
+               $suggestedOverwriteCliUrl = ($shouldSuggestOverwriteCliUrl) ? \OC::$WEBROOT : '';
+
                $parameters = [
                        // Diagnosis
-                       'readOnlyConfigEnabled' => \OC_Helper::isReadOnlyConfigEnabled(),
-                       'isLocaleWorking' => \OC_Util::isSetLocaleWorking(),
-                       'isAnnotationsWorking' => \OC_Util::isAnnotationsWorking(),
-                       'checkForWorkingWellKnownSetup', $this->config->getSystemValue('check_for_working_wellknown_setup'),
-                       'has_fileinfo' => \OC_Util::fileInfoLoaded(),
+                       'readOnlyConfigEnabled'            => \OC_Helper::isReadOnlyConfigEnabled(),
+                       'isLocaleWorking'                  => \OC_Util::isSetLocaleWorking(),
+                       'isAnnotationsWorking'             => \OC_Util::isAnnotationsWorking(),
+                       'checkForWorkingWellKnownSetup'    => $this->config->getSystemValue('check_for_working_wellknown_setup', true),
+                       'has_fileinfo'                     => \OC_Util::fileInfoLoaded(),
                        'invalidTransactionIsolationLevel' => $invalidTransactionIsolationLevel,
+                       'getenvServerNotWorking'           => empty($envPath),
+                       'OutdatedCacheWarning'             => $outdatedCaches,
+                       'fileLockingType'                  => $fileLockingType,
+                       'suggestedOverwriteCliUrl'         => $suggestedOverwriteCliUrl,
 
                        // Background jobs
                        'backgroundjobs_mode' => $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax'),
                        'cron_log'            => $this->config->getSystemValue('cron_log', true),
                        'lastcron'            => $this->config->getAppValue('core', 'lastcron', false),
+                       'cronErrors'              => $this->config->getAppValue('core', 'cronErrors'),
 
                        // Mail
                        'sendmail_is_available' => (bool) \OC_Helper::findBinaryPath('sendmail'),
index 769ef71e955b8212869d8e840e7c67b20e7d266b..7e22d0a3b8cc2c3f55da5889374c6091be508e9d 100644 (file)
@@ -30,6 +30,7 @@ use OCP\IDBConnection;
 use OCP\IL10N;
 use OCP\ILogger;
 use OCP\IUserManager;
+use OCP\Lock\ILockingProvider;
 use OCP\Settings\ISettings;
 use OCP\Settings\IManager;
 use OCP\Settings\ISection;
@@ -38,7 +39,6 @@ class Manager implements IManager {
        const TABLE_ADMIN_SETTINGS = 'admin_settings';
        const TABLE_ADMIN_SECTIONS = 'admin_sections';
 
-       /** @var ILogger */
        /** @var ILogger */
        private $log;
 
@@ -57,13 +57,17 @@ class Manager implements IManager {
        /** @var IUserManager */
        private $userManager;
 
+       /** @var ILockingProvider */
+       private $lockingProvider;
+
        public function __construct(
                ILogger $log,
                IDBConnection $dbc,
                IL10N $l,
                IConfig $config,
                EncryptionManager $encryptionManager,
-               IUserManager $userManager
+               IUserManager $userManager,
+               ILockingProvider $lockingProvider
        ) {
                $this->log = $log;
                $this->dbc = $dbc;
@@ -71,6 +75,7 @@ class Manager implements IManager {
                $this->config = $config;
                $this->encryptionManager = $encryptionManager;
                $this->userManager = $userManager;
+               $this->lockingProvider = $lockingProvider;
        }
 
        /**
@@ -85,6 +90,9 @@ class Manager implements IManager {
                }
        }
 
+       /**
+        * @param string $sectionClassName
+        */
        private function setupAdminSection($sectionClassName) {
                if(!class_exists($sectionClassName)) {
                        $this->log->debug('Could not find admin section class ' . $sectionClassName);
@@ -283,7 +291,7 @@ class Manager implements IManager {
                try {
                        if($section === 'server') {
                                /** @var ISettings $form */
-                               $form = new Admin\Server($this->dbc, $this->config);
+                               $form = new Admin\Server($this->dbc, $this->config, $this->lockingProvider, $this->l);
                                $forms[$form->getPriority()] = [$form];
                        }
                        if($section === 'encryption') {