]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Admin/Summary.php
Merge pull request #7743 from MrPetovan/task/7190-remove-defaults-modules
[friendica.git] / src / Module / Admin / Summary.php
index a78a6b8d7c033d890a93157f0229884a1f704c0d..d0bb4347a17ae016a6596e84b1112858bd941893 100644 (file)
@@ -12,6 +12,7 @@ use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
 use Friendica\Model\Register;
 use Friendica\Module\BaseAdminModule;
+use Friendica\Util\ConfigFileLoader;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
 
@@ -25,7 +26,7 @@ class Summary extends BaseAdminModule
 
                // are there MyISAM tables in the DB? If so, trigger a warning message
                $warningtext = [];
-               if (DBA::count('`information_schema`.`tables`', ['engine' => 'myisam', 'table_schema' => DBA::databaseName()])) {
+               if (DBA::count(['information_schema' => 'tables'], ['engine' => 'myisam', 'table_schema' => DBA::databaseName()])) {
                        $warningtext[] = L10n::t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php bin/console.php dbstructure toinnodb</tt> of your Friendica installation for an automatic conversion.<br />', 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
                }
 
@@ -73,6 +74,57 @@ class Summary extends BaseAdminModule
                                $well_known, $well_known, $a->getBaseURL() . '/help/Install');
                }
 
+               // Check logfile permission
+               if (Config::get('system', 'debugging')) {
+                       $stream = Config::get('system', 'logfile');
+
+                       if (is_file($stream) &&
+                           !is_writeable($stream)) {
+                               $warningtext[] = L10n::t('The logfile \'%s\' is not writable. No logging possible', $stream);
+                       }
+
+                       $stream = Config::get('system', 'dlogfile');
+
+                       if (is_file($stream) &&
+                           !is_writeable($stream)) {
+                               $warningtext[] = L10n::t('The logfile \'%s\' is not writable. No logging possible', $stream);
+                       }
+               }
+
+               // check legacy basepath settings
+               $configLoader = new ConfigFileLoader($a->getBasePath(), $a->getMode());
+               $configCache = new Config\Cache\ConfigCache();
+               $configLoader->setupCache($configCache);
+               $confBasepath = $configCache->get('system', 'basepath');
+               $currBasepath = $a->getConfig()->get('system', 'basepath');
+               if ($confBasepath !== $currBasepath || !is_dir($currBasepath)) {
+                       if (is_dir($confBasepath) && Config::set('system', 'basepath', $confBasepath)) {
+                               $a->getLogger()->info('Friendica\'s system.basepath was updated successfully.', [
+                                       'from' => $currBasepath,
+                                       'to'   => $confBasepath,
+                               ]);
+                               $warningtext[] = L10n::t('Friendica\'s system.basepath was updated from \'%s\' to \'%s\'. Please remove the system.basepath from your db to avoid differences.',
+                                       $currBasepath,
+                                       $confBasepath);
+                       } elseif (!is_dir($currBasepath)) {
+                               $a->getLogger()->alert('Friendica\'s system.basepath is wrong.', [
+                                       'from' => $currBasepath,
+                                       'to'   => $confBasepath,
+                               ]);
+                               $warningtext[] = L10n::t('Friendica\'s current system.basepath \'%s\' is wrong and the config file \'%s\' isn\'t used.',
+                                       $currBasepath,
+                                       $confBasepath);
+                       } else {
+                               $a->getLogger()->alert('Friendica\'s system.basepath is wrong.', [
+                                       'from' => $currBasepath,
+                                       'to'   => $confBasepath,
+                               ]);
+                               $warningtext[] = L10n::t('Friendica\'s current system.basepath \'%s\' is not equal to the config file \'%s\'. Please fix your configuration.',
+                                       $currBasepath,
+                                       $confBasepath);
+                       }
+               }
+
                $accounts = [
                        [L10n::t('Normal Account'), 0],
                        [L10n::t('Automatic Follower Account'), 0],
@@ -94,16 +146,12 @@ class Summary extends BaseAdminModule
 
                $pending = Register::getPendingCount();
 
-               $queue = DBA::count('queue', []);
-
-               $deferred = DBA::count('workerqueue', ['`executed` <= ? AND NOT `done` AND `next_try` > ?',
-                       DBA::NULL_DATETIME, DateTimeFormat::utcNow()]);
+               $deferred = DBA::count('workerqueue', ['NOT `done` AND `retrial` > ?', 0]);
 
-               $workerqueue = DBA::count('workerqueue', ['`executed` <= ? AND NOT `done` AND `next_try` < ?',
-                       DBA::NULL_DATETIME, DateTimeFormat::utcNow()]);
+               $workerqueue = DBA::count('workerqueue', ['NOT `done` AND `retrial` = ?', 0]);
 
                // We can do better, but this is a quick queue status
-               $queues = ['label' => L10n::t('Message queues'), 'queue' => $queue, 'deferred' => $deferred, 'workerq' => $workerqueue];
+               $queues = ['label' => L10n::t('Message queues'), 'deferred' => $deferred, 'workerq' => $workerqueue];
 
                $variables = DBA::toArray(DBA::p('SHOW variables LIKE "max_allowed_packet"'));
                $max_allowed_packet = $variables ? $variables[0]['Value'] : 0;