]> git.mxchange.org Git - friendica.git/blobdiff - mod/admin.php
Tweak storage selection in admin page
[friendica.git] / mod / admin.php
index 97d7a8bfd6a6ed79cc8745c67a2e2a8ac5dd0a2c..7ee48f592ef252920f5c40ef8d6cf59602124793 100644 (file)
@@ -15,11 +15,11 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
+use Friendica\Core\StorageManager;
 use Friendica\Core\System;
 use Friendica\Core\Theme;
 use Friendica\Core\Update;
 use Friendica\Core\Worker;
-use Friendica\Core\StorageManager;
 use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
 use Friendica\Model\Contact;
@@ -29,11 +29,14 @@ use Friendica\Model\User;
 use Friendica\Module;
 use Friendica\Module\Login;
 use Friendica\Module\Tos;
+use Friendica\Protocol\PortableContact;
 use Friendica\Util\Arrays;
+use Friendica\Util\BasePath;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
+use Psr\Log\LogLevel;
 
 /**
  * Sets the current theme for theme settings pages.
@@ -202,7 +205,6 @@ function admin_content(App $a)
                        'tos'          => ['admin/tos/'         , L10n::t('Terms of Service')        , 'tos']]],
                'database' => [L10n::t('Database'), [
                        'dbsync'       => ['admin/dbsync/'      , L10n::t('DB updates')              , 'dbsync'],
-                       'queue'        => ['admin/queue/'       , L10n::t('Inspect Queue')           , 'queue'],
                        'deferred'     => ['admin/deferred/'    , L10n::t('Inspect Deferred Workers'), 'deferred'],
                        'workerqueue'  => ['admin/workerqueue/' , L10n::t('Inspect worker Queue')    , 'workerqueue']]],
                'tools' => [L10n::t('Tools'), [
@@ -271,9 +273,6 @@ function admin_content(App $a)
                        case 'dbsync':
                                $o = admin_page_dbsync($a);
                                break;
-                       case 'queue':
-                               $o = admin_page_queue($a);
-                               break;
                        case 'deferred':
                                $o = admin_page_workerqueue($a, true);
                                break;
@@ -677,6 +676,8 @@ function admin_page_federation(App $a)
                                do {
                                        $part = array_pop($parts);
                                } while (!empty($parts) && ((strlen($part) >= 40) || (strlen($part) <= 3)));
+                               // only take the x.x.x part of the version, not the "release" after the dash
+                               $part = array_shift(explode('-', $part));
 
                                if (!empty($part)) {
                                        if (empty($compacted[$part])) {
@@ -784,52 +785,6 @@ function admin_page_federation(App $a)
        ]);
 }
 
-/**
- * @brief Admin Inspect Queue Page
- *
- * Generates a page for the admin to have a look into the current queue of
- * postings that are not deliverable. Shown are the name and url of the
- * recipient, the delivery network and the dates when the posting was generated
- * and the last time tried to deliver the posting.
- *
- * The returned string holds the content of the page.
- *
- * @param App $a
- * @return string
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
- */
-function admin_page_queue(App $a)
-{
-       // get content from the queue table
-       $entries = DBA::p("SELECT `contact`.`name`, `contact`.`nurl`,
-                `queue`.`id`, `queue`.`network`, `queue`.`created`, `queue`.`last`
-                FROM `queue` INNER JOIN `contact` ON `contact`.`id` = `queue`.`cid`
-                ORDER BY `queue`.`cid`, `queue`.`created`");
-
-       $r = [];
-       while ($entry = DBA::fetch($entries)) {
-               $entry['created'] = DateTimeFormat::local($entry['created']);
-               $entry['last'] = DateTimeFormat::local($entry['last']);
-               $r[] = $entry;
-       }
-       DBA::close($entries);
-
-       $t = Renderer::getMarkupTemplate('admin/queue.tpl');
-       return Renderer::replaceMacros($t, [
-               '$title' => L10n::t('Administration'),
-               '$page' => L10n::t('Inspect Queue'),
-               '$count' => count($r),
-               'id_header' => L10n::t('ID'),
-               '$to_header' => L10n::t('Recipient Name'),
-               '$url_header' => L10n::t('Recipient Profile'),
-               '$network_header' => L10n::t('Network'),
-               '$created_header' => L10n::t('Created'),
-               '$last_header' => L10n::t('Last Tried'),
-               '$info' => L10n::t('This page lists the content of the queue for outgoing postings. These are postings the initial delivery failed for. They will be resend later and eventually deleted if the delivery fails permanently.'),
-               '$entries' => $r,
-       ]);
-}
-
 /**
  * @brief Admin Inspect Worker Queue Page
  *
@@ -914,12 +869,16 @@ function admin_page_summary(App $a)
        }
 
        if (Config::get('system', 'dbupdate', DBStructure::UPDATE_NOT_CHECKED) == DBStructure::UPDATE_NOT_CHECKED) {
-               DBStructure::update(false, true);
+               DBStructure::update($a->getBasePath(), false, true);
        }
        if (Config::get('system', 'dbupdate') == DBStructure::UPDATE_FAILED) {
                $showwarning = true;
                $warningtext[] = L10n::t('The database update failed. Please run "php bin/console.php dbstructure update" from the command line and have a look at the errors that might appear.');
        }
+       if (Config::get('system', 'update') == Update::FAILED) {
+               $showwarning = true;
+               $warningtext[] = L10n::t('The last update failed. Please run "php bin/console.php dbstructure update" from the command line and have a look at the errors that might appear. (Some of the errors are possibly inside the logfile.)');
+       }
 
        $last_worker_call = Config::get('system', 'last_worker_execution', false);
        if (!$last_worker_call) {
@@ -935,6 +894,10 @@ function admin_page_summary(App $a)
                $showwarning = true;
                $warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from <code>.htconfig.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->getBaseURL() . '/help/Config');
        }
+       if (file_exists('config/local.ini.php')) {
+               $showwarning = true;
+               $warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from <code>config/local.ini.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->getBaseURL() . '/help/Config');
+       }
 
        // Check server vitality
        if (!admin_page_server_vital()) {
@@ -964,8 +927,6 @@ function admin_page_summary(App $a)
 
        $pending = Register::getPendingCount();
 
-       $queue = DBA::count('queue', []);
-
        $deferred = DBA::count('workerqueue', ["`executed` <= ? AND NOT `done` AND `next_try` > ?",
                DBA::NULL_DATETIME, DateTimeFormat::utcNow()]);
 
@@ -974,7 +935,7 @@ function admin_page_summary(App $a)
 
        // 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];
 
 
        $r = q("SHOW variables LIKE 'max_allowed_packet'");
@@ -1080,7 +1041,9 @@ function admin_page_site_post(App $a)
                update_table($a, "gcontact", ['connect', 'addr'], $old_host, $new_host);
 
                // update config
-               Config::set('system', 'hostname', parse_url($new_url, PHP_URL_HOST));
+               $configFileSaver = new \Friendica\Util\Config\ConfigFileSaver($a->getBasePath());
+               $configFileSaver->addConfigValue('config', 'hostname', parse_url($new_url, PHP_URL_HOST));
+               $configFileSaver->saveToConfigFile();
                Config::set('system', 'url', $new_url);
                $a->setBaseURL($new_url);
 
@@ -1098,12 +1061,11 @@ function admin_page_site_post(App $a)
        // end relocate
 
        $sitename         = (!empty($_POST['sitename'])         ? Strings::escapeTags(trim($_POST['sitename']))      : '');
-       $hostname         = (!empty($_POST['hostname'])         ? Strings::escapeTags(trim($_POST['hostname']))      : '');
        $sender_email     = (!empty($_POST['sender_email'])     ? Strings::escapeTags(trim($_POST['sender_email']))  : '');
        $banner           = (!empty($_POST['banner'])           ? trim($_POST['banner'])                             : false);
        $shortcut_icon    = (!empty($_POST['shortcut_icon'])    ? Strings::escapeTags(trim($_POST['shortcut_icon'])) : '');
        $touch_icon       = (!empty($_POST['touch_icon'])       ? Strings::escapeTags(trim($_POST['touch_icon']))    : '');
-       $info             = (!empty($_POST['info'])             ? trim($_POST['info'])                               : false);
+       $additional_info  = (!empty($_POST['additional_info'])  ? trim($_POST['additional_info'])                    : '');
        $language         = (!empty($_POST['language'])         ? Strings::escapeTags(trim($_POST['language']))      : '');
        $theme            = (!empty($_POST['theme'])            ? Strings::escapeTags(trim($_POST['theme']))         : '');
        $theme_mobile     = (!empty($_POST['theme_mobile'])     ? Strings::escapeTags(trim($_POST['theme_mobile']))  : '');
@@ -1142,14 +1104,14 @@ function admin_page_site_post(App $a)
        $proxyuser              = (!empty($_POST['proxyuser'])              ? Strings::escapeTags(trim($_POST['proxyuser'])) : '');
        $proxy                  = (!empty($_POST['proxy'])                  ? Strings::escapeTags(trim($_POST['proxy']))     : '');
        $timeout                = (!empty($_POST['timeout'])                ? intval(trim($_POST['timeout']))                : 60);
-       $maxloadavg             = (!empty($_POST['maxloadavg'])             ? intval(trim($_POST['maxloadavg']))             : 50);
+       $maxloadavg             = (!empty($_POST['maxloadavg'])             ? intval(trim($_POST['maxloadavg']))             : 20);
        $maxloadavg_frontend    = (!empty($_POST['maxloadavg_frontend'])    ? intval(trim($_POST['maxloadavg_frontend']))    : 50);
        $min_memory             = (!empty($_POST['min_memory'])             ? intval(trim($_POST['min_memory']))             : 0);
        $optimize_max_tablesize = (!empty($_POST['optimize_max_tablesize']) ? intval(trim($_POST['optimize_max_tablesize'])) : 100);
        $optimize_fragmentation = (!empty($_POST['optimize_fragmentation']) ? intval(trim($_POST['optimize_fragmentation'])) : 30);
        $poco_completion        = (!empty($_POST['poco_completion'])        ? intval(trim($_POST['poco_completion']))        : false);
        $poco_requery_days      = (!empty($_POST['poco_requery_days'])      ? intval(trim($_POST['poco_requery_days']))      : 7);
-       $poco_discovery         = (!empty($_POST['poco_discovery'])         ? intval(trim($_POST['poco_discovery']))         : 0);
+       $poco_discovery         = (!empty($_POST['poco_discovery'])         ? intval(trim($_POST['poco_discovery']))         : PortableContact::DISABLED);
        $poco_discovery_since   = (!empty($_POST['poco_discovery_since'])   ? intval(trim($_POST['poco_discovery_since']))   : 30);
        $poco_local_search      = !empty($_POST['poco_local_search']);
        $nodeinfo               = !empty($_POST['nodeinfo']);
@@ -1169,7 +1131,6 @@ function admin_page_site_post(App $a)
        $itemcache_duration     = (!empty($_POST['itemcache_duration'])     ? intval($_POST['itemcache_duration'])            : 0);
        $max_comments           = (!empty($_POST['max_comments'])           ? intval($_POST['max_comments'])                  : 0);
        $temppath               = (!empty($_POST['temppath'])               ? Strings::escapeTags(trim($_POST['temppath']))   : '');
-       $basepath               = (!empty($_POST['basepath'])               ? Strings::escapeTags(trim($_POST['basepath']))   : '');
        $singleuser             = (!empty($_POST['singleuser'])             ? Strings::escapeTags(trim($_POST['singleuser'])) : '');
        $proxy_disabled         = !empty($_POST['proxy_disabled']);
        $only_tag_search        = !empty($_POST['only_tag_search']);
@@ -1193,38 +1154,41 @@ function admin_page_site_post(App $a)
         * @var $storagebackend \Friendica\Model\Storage\IStorage
         */
        $storagebackend    = Strings::escapeTags(trim(defaults($_POST, 'storagebackend', '')));
-       StorageManager::setBackend($storagebackend);
 
        // save storage backend form
        if (!is_null($storagebackend) && $storagebackend != "") {
-               $storage_opts = $storagebackend::getOptions();
-               $storage_form_prefix=preg_replace('|[^a-zA-Z0-9]|' ,'', $storagebackend);
-               $storage_opts_data = [];
-               foreach($storage_opts as $name => $info) {
-                       $fieldname = $storage_form_prefix . '_' . $name;
-                       switch ($info[0]) { // type
+               if (!StorageManager::setBackend($storagebackend)) {
+                       info(L10n::t('Invalid storage backend setting value.'));
+               } else {
+                       $storage_opts = $storagebackend::getOptions();
+                       $storage_form_prefix=preg_replace('|[^a-zA-Z0-9]|' ,'', $storagebackend);
+                       $storage_opts_data = [];
+                       foreach($storage_opts as $name => $info) {
+                               $fieldname = $storage_form_prefix . '_' . $name;
+                               switch ($info[0]) { // type
                                case 'checkbox':
                                case 'yesno':
                                        $value = !empty($_POST[$fieldname]);
                                        break;
                                default:
                                        $value = defaults($_POST, $fieldname, '');
+                               }
+                               $storage_opts_data[$name] = $value;
                        }
-                       $storage_opts_data[$name] = $value;
-               }
-               unset($name);
-               unset($info);
-       
-               $storage_form_errors = $storagebackend::saveOptions($storage_opts_data);
-               if (count($storage_form_errors)) {
-                       foreach($storage_form_errors as $name => $err) {
-                               notice('Storage backend, ' . $storage_opts[$name][1] . ': ' . $err);
+                       unset($name);
+                       unset($info);
+
+                       $storage_form_errors = $storagebackend::saveOptions($storage_opts_data);
+                       if (count($storage_form_errors)) {
+                               foreach($storage_form_errors as $name => $err) {
+                                       notice('Storage backend, ' . $storage_opts[$name][1] . ': ' . $err);
+                               }
+                               $a->internalRedirect('admin/site' . $active_panel);
                        }
-                       $a->internalRedirect('admin/site' . $active_panel);
                }
        }
 
-       
+
 
        // Has the directory url changed? If yes, then resubmit the existing profiles there
        if ($global_directory != Config::get('system', 'directory') && ($global_directory != '')) {
@@ -1287,7 +1251,6 @@ function admin_page_site_post(App $a)
        Config::set('system', 'poco_local_search'     , $poco_local_search);
        Config::set('system', 'nodeinfo'              , $nodeinfo);
        Config::set('config', 'sitename'              , $sitename);
-       Config::set('config', 'hostname'              , $hostname);
        Config::set('config', 'sender_email'          , $sender_email);
        Config::set('system', 'suppress_tags'         , $suppress_tags);
        Config::set('system', 'shortcut_icon'         , $shortcut_icon);
@@ -1299,10 +1262,10 @@ function admin_page_site_post(App $a)
                Config::set('system', 'banner', $banner);
        }
 
-       if (empty($info)) {
+       if (empty($additional_info)) {
                Config::delete('config', 'info');
        } else {
-               Config::set('config', 'info', $info);
+               Config::set('config', 'info', $additional_info);
        }
        Config::set('system', 'language', $language);
        Config::set('system', 'theme', $theme);
@@ -1370,7 +1333,7 @@ function admin_page_site_post(App $a)
        Config::set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
 
        if ($itemcache != '') {
-               $itemcache = App::getRealPath($itemcache);
+               $itemcache = BasePath::getRealPath($itemcache);
        }
 
        Config::set('system', 'itemcache', $itemcache);
@@ -1378,16 +1341,11 @@ function admin_page_site_post(App $a)
        Config::set('system', 'max_comments', $max_comments);
 
        if ($temppath != '') {
-               $temppath = App::getRealPath($temppath);
+               $temppath = BasePath::getRealPath($temppath);
        }
 
        Config::set('system', 'temppath', $temppath);
 
-       if ($basepath != '') {
-               $basepath = App::getRealPath($basepath);
-       }
-
-       Config::set('system', 'basepath'         , $basepath);
        Config::set('system', 'proxy_disabled'   , $proxy_disabled);
        Config::set('system', 'only_tag_search'  , $only_tag_search);
 
@@ -1471,10 +1429,10 @@ function admin_page_site(App $a)
        ];
 
        $poco_discovery_choices = [
-               "0" => L10n::t("Disabled"),
-               "1" => L10n::t("Users"),
-               "2" => L10n::t("Users, Global Contacts"),
-               "3" => L10n::t("Users, Global Contacts/fallback"),
+               PortableContact::DISABLED => L10n::t("Disabled"),
+               PortableContact::USERS => L10n::t("Users"),
+               PortableContact::USERS_GCONTACTS => L10n::t("Users, Global Contacts"),
+               PortableContact::USERS_GCONTACTS_FALLBACK => L10n::t("Users, Global Contacts/fallback"),
        ];
 
        $poco_discovery_since_choices = [
@@ -1500,7 +1458,7 @@ function admin_page_site(App $a)
                $banner = '<a href="https://friendi.ca"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="https://friendi.ca">Friendica</a></span>';
        }
 
-       $info = Config::get('config', 'info');
+       $additional_info = Config::get('config', 'info');
 
        // Automatically create temporary paths
        get_temppath();
@@ -1527,9 +1485,6 @@ function admin_page_site(App $a)
                "develop" => L10n::t("check the development version")
        ];
 
-       if (empty(Config::get('config', 'hostname'))) {
-               Config::set('config', 'hostname', $a->getHostName());
-       }
        $diaspora_able = ($a->getURLPath() == "");
 
        $optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1);
@@ -1545,9 +1500,14 @@ function admin_page_site(App $a)
         */
        $storage_current_backend = StorageManager::getBackend();
 
-       $storage_backends_choices = [
-               '' => L10n::t('None')
-       ];
+       $storage_backends_choices = [];
+
+       // show legacy option only if it is the current backend:
+       // once changed can't be selected anymore
+       if ($storage_current_backend == '') {
+               $storage_backends_choices[''] = L10n::t('Database (legacy)');
+       };
+
        foreach($storage_backends as $name=>$class) {
                $storage_backends_choices[$class] = $name;
        }
@@ -1555,10 +1515,10 @@ function admin_page_site(App $a)
 
        // build storage config form,
        $storage_form_prefix=preg_replace('|[^a-zA-Z0-9]|' ,'', $storage_current_backend);
-       
+
        $storage_form = [];
        if (!is_null($storage_current_backend) && $storage_current_backend != "") {
-               foreach($storage_current_backend::getOptions() as $name => $info) {
+               foreach ($storage_current_backend::getOptions() as $name => $info) {
                        $type = $info[0];
                        $info[0] = $storage_form_prefix . '_' . $name;
                        $info['type'] = $type;
@@ -1588,12 +1548,11 @@ function admin_page_site(App $a)
 
                // name, label, value, help string, extra data...
                '$sitename'         => ['sitename', L10n::t("Site name"), Config::get('config', 'sitename'), ''],
-               '$hostname'         => ['hostname', L10n::t("Host name"), Config::get('config', 'hostname'), ""],
                '$sender_email'     => ['sender_email', L10n::t("Sender Email"), Config::get('config', 'sender_email'), L10n::t("The email address your server shall use to send notification emails from."), "", "", "email"],
                '$banner'           => ['banner', L10n::t("Banner/Logo"), $banner, ""],
                '$shortcut_icon'    => ['shortcut_icon', L10n::t("Shortcut icon"), Config::get('system', 'shortcut_icon'), L10n::t("Link to an icon that will be used for browsers.")],
                '$touch_icon'       => ['touch_icon', L10n::t("Touch icon"), Config::get('system', 'touch_icon'), L10n::t("Link to an icon that will be used for tablets and mobiles.")],
-               '$info'             => ['info', L10n::t('Additional Info'), $info, L10n::t('For public servers: you can add additional information here that will be listed at %s/servers.', get_server())],
+               '$additional_info'  => ['additional_info', L10n::t('Additional Info'), $additional_info, L10n::t('For public servers: you can add additional information here that will be listed at %s/servers.', get_server())],
                '$language'         => ['language', L10n::t("System language"), Config::get('system', 'language'), "", $lang_choices],
                '$theme'            => ['theme', L10n::t("System theme"), Config::get('system', 'theme'), L10n::t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices],
                '$theme_mobile'     => ['theme_mobile', L10n::t("Mobile system theme"), Config::get('system', 'mobile-theme', '---'), L10n::t("Theme for mobile devices"), $theme_choices_mobile],
@@ -1602,7 +1561,7 @@ function admin_page_site(App $a)
                '$hide_help'        => ['hide_help', L10n::t("Hide help entry from navigation menu"), Config::get('system', 'hide_help'), L10n::t("Hides the menu entry for the Help pages from the navigation menu. You can still access it calling /help directly.")],
                '$singleuser'       => ['singleuser', L10n::t("Single user instance"), Config::get('system', 'singleuser', '---'), L10n::t("Make this instance multi-user or single-user for the named user"), $user_names],
 
-               '$storagebackend'   => ['storagebackend', L10n::t("File storage backend"), $storage_current_backend, L10n::t('Backend used to store uploaded files data'), $storage_backends_choices],
+               '$storagebackend'   => ['storagebackend', L10n::t("File storage backend"), $storage_current_backend, L10n::t('The backend used to store uploaded data. If you change the storage backend, you can manually move the existing files. If you do not do so, the files uploaded before the change will still be available at the old backend. Please see <a href="/help/Settings#1_2_3_1">the settings documentation</a> for more information about the choices and the moving procedure.'), $storage_backends_choices],
                '$storageform'      => $storage_form,
                '$maximagesize'     => ['maximagesize', L10n::t("Maximum image size"), Config::get('system', 'maximagesize'), L10n::t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")],
                '$maximagelength'   => ['maximagelength', L10n::t("Maximum image length"), Config::get('system', 'max_image_length'), L10n::t("Maximum length in pixels of the longest side of uploaded images. Default is -1, which means no limits.")],
@@ -1642,7 +1601,7 @@ function admin_page_site(App $a)
                '$proxyuser'              => ['proxyuser', L10n::t("Proxy user"), Config::get('system', 'proxyuser'), ""],
                '$proxy'                  => ['proxy', L10n::t("Proxy URL"), Config::get('system', 'proxy'), ""],
                '$timeout'                => ['timeout', L10n::t("Network timeout"), Config::get('system', 'curl_timeout', 60), L10n::t("Value is in seconds. Set to 0 for unlimited \x28not recommended\x29.")],
-               '$maxloadavg'             => ['maxloadavg', L10n::t("Maximum Load Average"), Config::get('system', 'maxloadavg', 50), L10n::t("Maximum system load before delivery and poll processes are deferred - default 50.")],
+               '$maxloadavg'             => ['maxloadavg', L10n::t("Maximum Load Average"), Config::get('system', 'maxloadavg', 20), L10n::t("Maximum system load before delivery and poll processes are deferred - default %d.", 20)],
                '$maxloadavg_frontend'    => ['maxloadavg_frontend', L10n::t("Maximum Load Average \x28Frontend\x29"), Config::get('system', 'maxloadavg_frontend', 50), L10n::t("Maximum system load before the frontend quits service - default 50.")],
                '$min_memory'             => ['min_memory', L10n::t("Minimal Memory"), Config::get('system', 'min_memory', 0), L10n::t("Minimal free memory in MB for the worker. Needs access to /proc/meminfo - default 0 \x28deactivated\x29.")],
                '$optimize_max_tablesize' => ['optimize_max_tablesize', L10n::t("Maximum table size for optimization"), $optimize_max_tablesize, L10n::t("Maximum table size \x28in MB\x29 for the automatic optimization. Enter -1 to disable it.")],
@@ -1650,7 +1609,7 @@ function admin_page_site(App $a)
 
                '$poco_completion'        => ['poco_completion', L10n::t("Periodical check of global contacts"), Config::get('system', 'poco_completion'), L10n::t("If enabled, the global contacts are checked periodically for missing or outdated data and the vitality of the contacts and servers.")],
                '$poco_requery_days'      => ['poco_requery_days', L10n::t("Days between requery"), Config::get('system', 'poco_requery_days'), L10n::t("Number of days after which a server is requeried for his contacts.")],
-               '$poco_discovery'         => ['poco_discovery', L10n::t("Discover contacts from other servers"), (string)intval(Config::get('system', 'poco_discovery')), L10n::t("Periodically query other servers for contacts. You can choose between 'users': the users on the remote system, 'Global Contacts': active contacts that are known on the system. The fallback is meant for Redmatrix servers and older friendica servers, where global contacts weren't available. The fallback increases the server load, so the recommened setting is 'Users, Global Contacts'."), $poco_discovery_choices],
+               '$poco_discovery'         => ['poco_discovery', L10n::t("Discover contacts from other servers"), (string)intval(Config::get('system', 'poco_discovery')), L10n::t("Periodically query other servers for contacts. You can choose between 'users': the users on the remote system, 'Global Contacts': active contacts that are known on the system. The fallback is meant for Redmatrix servers and older friendica servers, where global contacts weren't available. The fallback increases the server load, so the recommended setting is 'Users, Global Contacts'."), $poco_discovery_choices],
                '$poco_discovery_since'   => ['poco_discovery_since', L10n::t("Timeframe for fetching global contacts"), (string)intval(Config::get('system', 'poco_discovery_since')), L10n::t("When the discovery is activated, this value defines the timeframe for the activity of the global contacts that are fetched from other servers."), $poco_discovery_since_choices],
                '$poco_local_search'      => ['poco_local_search', L10n::t("Search the local directory"), Config::get('system', 'poco_local_search'), L10n::t("Search the local directory instead of the global directory. When searching locally, every search will be executed on the global directory in the background. This improves the search results when the search is repeated.")],
 
@@ -1666,7 +1625,6 @@ function admin_page_site(App $a)
                '$itemcache_duration'     => ['itemcache_duration', L10n::t("Cache duration in seconds"), Config::get('system', 'itemcache_duration'), L10n::t("How long should the cache files be hold? Default value is 86400 seconds \x28One day\x29. To disable the item cache, set the value to -1.")],
                '$max_comments'           => ['max_comments', L10n::t("Maximum numbers of comments per post"), Config::get('system', 'max_comments'), L10n::t("How much comments should be shown for each post? Default value is 100.")],
                '$temppath'               => ['temppath', L10n::t("Temp path"), Config::get('system', 'temppath'), L10n::t("If you have a restricted system where the webserver can't access the system temp path, enter another path here.")],
-               '$basepath'               => ['basepath', L10n::t("Base path to installation"), Config::get('system', 'basepath'), L10n::t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot.")],
                '$proxy_disabled'         => ['proxy_disabled', L10n::t("Disable picture proxy"), Config::get('system', 'proxy_disabled'), L10n::t("The picture proxy increases performance and privacy. It shouldn't be used on systems with very low bandwidth.")],
                '$only_tag_search'        => ['only_tag_search', L10n::t("Only search in tags"), Config::get('system', 'only_tag_search'), L10n::t("On large systems the text search can slow down the system extremely.")],
 
@@ -1719,7 +1677,7 @@ function admin_page_dbsync(App $a)
        }
 
        if (($a->argc > 2) && (intval($a->argv[2]) || ($a->argv[2] === 'check'))) {
-               $retval = DBStructure::update(false, true);
+               $retval = DBStructure::update($a->getBasePath(), false, true);
                if ($retval === '') {
                        $o .= L10n::t("Database structure update %s was successfully applied.", DB_UPDATE_VERSION) . "<br />";
                        Config::set('database', 'last_successful_update', DB_UPDATE_VERSION);
@@ -2497,7 +2455,7 @@ function admin_page_logs_post(App $a)
 
                $logfile   = (!empty($_POST['logfile']) ? Strings::escapeTags(trim($_POST['logfile'])) : '');
                $debugging = !empty($_POST['debugging']);
-               $loglevel  = (!empty($_POST['loglevel']) ? intval(trim($_POST['loglevel'])) : 0);
+               $loglevel  = defaults($_POST, 'loglevel', LogLevel::ERROR);
 
                Config::set('system', 'logfile', $logfile);
                Config::set('system', 'debugging', $debugging);
@@ -2529,12 +2487,11 @@ function admin_page_logs_post(App $a)
 function admin_page_logs(App $a)
 {
        $log_choices = [
-               Logger::WARNING => 'Warning',
-               Logger::INFO    => 'Info',
-               Logger::TRACE   => 'Trace',
-               Logger::DEBUG   => 'Debug',
-               Logger::DATA    => 'Data',
-               Logger::ALL     => 'All'
+               LogLevel::ERROR   => 'Error',
+               LogLevel::WARNING => 'Warning',
+               LogLevel::NOTICE  => 'Notice',
+               LogLevel::INFO    => 'Info',
+               LogLevel::DEBUG   => 'Debug',
        ];
 
        if (ini_get('log_errors')) {