use Friendica\Protocol\PortableContact;
use Friendica\Util\Arrays;
use Friendica\Util\BasePath;
+use Friendica\Util\BaseURL;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\Strings;
'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'), [
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;
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])) {
]);
}
-/**
- * @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
*
$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) {
$pending = Register::getPendingCount();
- $queue = DBA::count('queue', []);
-
$deferred = DBA::count('workerqueue', ["`executed` <= ? AND NOT `done` AND `next_try` > ?",
DBA::NULL_DATETIME, DateTimeFormat::utcNow()]);
// 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'");
update_table($a, "gcontact", ['connect', 'addr'], $old_host, $new_host);
// update config
- Config::set('system', 'hostname', parse_url($new_url, PHP_URL_HOST));
Config::set('system', 'url', $new_url);
$a->setBaseURL($new_url);
// 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'])) : '');
$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']);
* @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
- case 'checkbox':
- case 'yesno':
- $value = !empty($_POST[$fieldname]);
- break;
- default:
- $value = defaults($_POST, $fieldname, '');
+ if (StorageManager::setBackend($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
+ 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);
+ } else {
+ info(L10n::t('Invalid storage backend setting value.'));
}
}
-
+
// Has the directory url changed? If yes, then resubmit the existing profiles there
if ($global_directory != Config::get('system', 'directory') && ($global_directory != '')) {
$diaspora_enabled = false;
}
if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) {
- if ($ssl_policy == SSL_POLICY_FULL) {
+ if ($ssl_policy == BaseURL::SSL_POLICY_FULL) {
q("UPDATE `contact` SET
`url` = REPLACE(`url` , 'http:' , 'https:'),
`photo` = REPLACE(`photo` , 'http:' , 'https:'),
`thumb` = REPLACE(`thumb` , 'http:' , 'https:')
WHERE 1 "
);
- } elseif ($ssl_policy == SSL_POLICY_SELFSIGN) {
+ } elseif ($ssl_policy == BaseURL::SSL_POLICY_SELFSIGN) {
q("UPDATE `contact` SET
`url` = REPLACE(`url` , 'https:' , 'http:'),
`photo` = REPLACE(`photo` , 'https:' , 'http:'),
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);
Config::set('system', 'temppath', $temppath);
- if ($basepath != '') {
- $basepath = BasePath::getRealPath($basepath);
- }
-
- Config::set('system', 'basepath' , $basepath);
Config::set('system', 'proxy_disabled' , $proxy_disabled);
Config::set('system', 'only_tag_search' , $only_tag_search);
];
$ssl_choices = [
- SSL_POLICY_NONE => L10n::t("No SSL policy, links will track page SSL state"),
- SSL_POLICY_FULL => L10n::t("Force all links to use SSL"),
- SSL_POLICY_SELFSIGN => L10n::t("Self-signed certificate, use SSL for local links only \x28discouraged\x29")
+ BaseURL::SSL_POLICY_NONE => L10n::t("No SSL policy, links will track page SSL state"),
+ BaseURL::SSL_POLICY_FULL => L10n::t("Force all links to use SSL"),
+ BaseURL::SSL_POLICY_SELFSIGN => L10n::t("Self-signed certificate, use SSL for local links only \x28discouraged\x29")
];
$check_git_version_choices = [
"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);
*/
$storage_current_backend = StorageManager::getBackend();
- $storage_backends_choices = [
- '' => L10n::t('Database (legacy)')
- ];
- foreach($storage_backends as $name=>$class) {
+ $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;
}
unset($storage_backends);
// 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) {
// 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.")],
'$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.")],
'$worker_queues' => ['worker_queues', L10n::t("Maximum number of parallel workers"), Config::get('system', 'worker_queues'), L10n::t("On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d.", 5, 20, 10)],
'$worker_dont_fork' => ['worker_dont_fork', L10n::t("Don't use 'proc_open' with the worker"), Config::get('system', 'worker_dont_fork'), L10n::t("Enable this if your system doesn't allow the use of 'proc_open'. This can happen on shared hosters. If this is enabled you should increase the frequency of worker calls in your crontab.")],
'$worker_fastlane' => ['worker_fastlane', L10n::t("Enable fastlane"), Config::get('system', 'worker_fastlane'), L10n::t("When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.")],
- '$worker_frontend' => ['worker_frontend', L10n::t('Enable frontend worker'), Config::get('system', 'frontend_worker'), L10n::t('When enabled the Worker process is triggered when backend access is performed \x28e.g. messages being delivered\x29. On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.', System::baseUrl())],
+ '$worker_frontend' => ['worker_frontend', L10n::t('Enable frontend worker'), Config::get('system', 'frontend_worker'), L10n::t("When enabled the Worker process is triggered when backend access is performed \x28e.g. messages being delivered\x29. On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.", System::baseUrl())],
'$relay_subscribe' => ['relay_subscribe', L10n::t("Subscribe to relay"), Config::get('system', 'relay_subscribe'), L10n::t("Enables the receiving of public posts from the relay. They will be included in the search, subscribed tags and on the global community page.")],
'$relay_server' => ['relay_server', L10n::t("Relay server"), Config::get('system', 'relay_server', 'https://relay.diasp.org'), L10n::t("Address of the relay server where public posts should be send to. For example https://relay.diasp.org")],