]> git.mxchange.org Git - friendica.git/commitdiff
Friendica-7112 - Missing basepath fix
authorPhilipp Holzer <admin@philipp.info>
Mon, 13 May 2019 17:30:03 +0000 (19:30 +0200)
committerPhilipp Holzer <admin@philipp.info>
Mon, 13 May 2019 17:30:03 +0000 (19:30 +0200)
src/App.php
src/Module/Admin/Summary.php

index 41c50fda5d527cef4c6df1b036cf89159955db0b..2e357f8651a6e738aa31ab106429fcfcef6d96c6 100644 (file)
@@ -149,7 +149,8 @@ class App
         */
        public function getBasePath()
        {
-               return $this->config->get('system', 'basepath');
+               // Don't use the basepath of the config table for basepath (it should always be the config-file one)
+               return $this->config->getCache()->get('system', 'basepath');
        }
 
        /**
index a78a6b8d7c033d890a93157f0229884a1f704c0d..901a4b081feaafeaeb5b3881b3b1b269c7555561 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\Config\ConfigFileLoader;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
 
@@ -73,6 +74,40 @@ class Summary extends BaseAdminModule
                                $well_known, $well_known, $a->getBaseURL() . '/help/Install');
                }
 
+               // 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],