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
*
$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
- $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);
* @var $storagebackend \Friendica\Model\Storage\IStorage
*/
$storagebackend = Strings::escapeTags(trim(defaults($_POST, 'storagebackend', '')));
- if (!StorageManager::setBackend($storagebackend)) {
- info(L10n::t('Invalid storage backend setting value.'));
- }
// 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:'),
];
$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 = [
*/
$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) {