dbclean settings are now available from the frontend
This commit is contained in:
parent
850e296020
commit
eb4650ff23
4 changed files with 30 additions and 5 deletions
|
@ -15,7 +15,7 @@ Especially don't do that with undocumented values.
|
||||||
The header of the section describes the category, the value is the parameter.
|
The header of the section describes the category, the value is the parameter.
|
||||||
Example: To set the automatic database cleanup process add this line to your .htconfig.php:
|
Example: To set the automatic database cleanup process add this line to your .htconfig.php:
|
||||||
|
|
||||||
$a->config['system']['dbclean'] = true;
|
$a->config['system']['always_show_preview'] = true;
|
||||||
|
|
||||||
## jabber ##
|
## jabber ##
|
||||||
* **debug** (Boolean) - Enable debug level for the jabber account synchronisation.
|
* **debug** (Boolean) - Enable debug level for the jabber account synchronisation.
|
||||||
|
@ -37,8 +37,6 @@ Example: To set the automatic database cleanup process add this line to your .ht
|
||||||
* **db_loglimit_index** - Number of index rows needed to be logged for indexes on the watchlist
|
* **db_loglimit_index** - Number of index rows needed to be logged for indexes on the watchlist
|
||||||
* **db_loglimit_index_high** - Number of index rows to be logged anyway (for any index)
|
* **db_loglimit_index_high** - Number of index rows to be logged anyway (for any index)
|
||||||
* **db_log_index_blacklist** - Blacklist of indexes that shouldn't be watched
|
* **db_log_index_blacklist** - Blacklist of indexes that shouldn't be watched
|
||||||
* **dbclean** (Boolean) - Enable the automatic database cleanup process
|
|
||||||
* **dbclean-expire-days** (Integer) - Days after which remote items will be deleted. Own items, and marked or filed items are kept.
|
|
||||||
* **diaspora_test** (Boolean) - For development only. Disables the message transfer.
|
* **diaspora_test** (Boolean) - For development only. Disables the message transfer.
|
||||||
* **disable_email_validation** (Boolean) - Disables the check if a mail address is in a valid format and can be resolved via DNS.
|
* **disable_email_validation** (Boolean) - Disables the check if a mail address is in a valid format and can be resolved via DNS.
|
||||||
* **disable_url_validation** (Boolean) - Disables the DNS lookup of an URL.
|
* **disable_url_validation** (Boolean) - Disables the DNS lookup of an URL.
|
||||||
|
|
|
@ -1014,6 +1014,9 @@ function admin_page_site_post(App $a)
|
||||||
$ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0);
|
$ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0);
|
||||||
$force_ssl = ((x($_POST,'force_ssl')) ? True : False);
|
$force_ssl = ((x($_POST,'force_ssl')) ? True : False);
|
||||||
$hide_help = ((x($_POST,'hide_help')) ? True : False);
|
$hide_help = ((x($_POST,'hide_help')) ? True : False);
|
||||||
|
$dbclean = ((x($_POST,'dbclean')) ? True : False);
|
||||||
|
$dbclean_expire_days = ((x($_POST,'dbclean_expire_days')) ? intval($_POST['dbclean_expire_days']) : 0);
|
||||||
|
$dbclean_unclaimed = ((x($_POST,'dbclean_unclaimed')) ? intval($_POST['dbclean_unclaimed']) : 0);
|
||||||
$suppress_tags = ((x($_POST,'suppress_tags')) ? True : False);
|
$suppress_tags = ((x($_POST,'suppress_tags')) ? True : False);
|
||||||
$itemcache = ((x($_POST,'itemcache')) ? notags(trim($_POST['itemcache'])) : '');
|
$itemcache = ((x($_POST,'itemcache')) ? notags(trim($_POST['itemcache'])) : '');
|
||||||
$itemcache_duration = ((x($_POST,'itemcache_duration')) ? intval($_POST['itemcache_duration']) : 0);
|
$itemcache_duration = ((x($_POST,'itemcache_duration')) ? intval($_POST['itemcache_duration']) : 0);
|
||||||
|
@ -1169,6 +1172,15 @@ function admin_page_site_post(App $a)
|
||||||
Config::set('system', 'force_ssl', $force_ssl);
|
Config::set('system', 'force_ssl', $force_ssl);
|
||||||
Config::set('system', 'hide_help', $hide_help);
|
Config::set('system', 'hide_help', $hide_help);
|
||||||
|
|
||||||
|
Config::set('system', 'dbclean', $dbclean);
|
||||||
|
Config::set('system', 'dbclean-expire-days', $dbclean_expire_days);
|
||||||
|
|
||||||
|
if ($dbclean_unclaimed == 0) {
|
||||||
|
$dbclean_unclaimed = $dbclean_expire_days;
|
||||||
|
}
|
||||||
|
|
||||||
|
Config::set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
|
||||||
|
|
||||||
if ($itemcache != '') {
|
if ($itemcache != '') {
|
||||||
$itemcache = App::realpath($itemcache);
|
$itemcache = App::realpath($itemcache);
|
||||||
}
|
}
|
||||||
|
@ -1422,6 +1434,9 @@ function admin_page_site(App $a)
|
||||||
|
|
||||||
'$check_new_version_url' => ['check_new_version_url', L10n::t("Check upstream version"), Config::get('system', 'check_new_version_url'), L10n::t("Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview."), $check_git_version_choices],
|
'$check_new_version_url' => ['check_new_version_url', L10n::t("Check upstream version"), Config::get('system', 'check_new_version_url'), L10n::t("Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview."), $check_git_version_choices],
|
||||||
'$suppress_tags' => ['suppress_tags', L10n::t("Suppress Tags"), Config::get('system','suppress_tags'), L10n::t("Suppress showing a list of hashtags at the end of the posting.")],
|
'$suppress_tags' => ['suppress_tags', L10n::t("Suppress Tags"), Config::get('system','suppress_tags'), L10n::t("Suppress showing a list of hashtags at the end of the posting.")],
|
||||||
|
'$dbclean' => ['dbclean', L10n::t("Clean database"), Config::get('system','dbclean', false), L10n::t("Remove old remote items, orphaned database records and old content from some other helper tables.")],
|
||||||
|
'$dbclean_expire_days' => ['dbclean_expire_days', L10n::t("Lifespan of remote items"), Config::get('system','dbclean-expire-days', 0), L10n::t("When the database cleanup is enabled, this defines the days after which remote items will be deleted. Own items, and marked or filed items are always kept. 0 disables this behaviour.")],
|
||||||
|
'$dbclean_unclaimed' => ['dbclean_unclaimed', L10n::t("Lifespan of unclaimed items"), Config::get('system','dbclean-expire-unclaimed', 90), L10n::t("When the database cleanup is enabled, this defines the days after which unclaimed remote items (mostly content from the relay) will be deleted. Default value is 90 days. Defaults to the general lifespan value of remote items if set to 0.")],
|
||||||
'$itemcache' => ['itemcache', L10n::t("Path to item cache"), Config::get('system','itemcache'), L10n::t("The item caches buffers generated bbcode and external images.")],
|
'$itemcache' => ['itemcache', L10n::t("Path to item cache"), Config::get('system','itemcache'), L10n::t("The item caches buffers generated bbcode and external images.")],
|
||||||
'$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.")],
|
'$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.")],
|
'$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.")],
|
||||||
|
|
|
@ -69,15 +69,24 @@ class DBClean {
|
||||||
|
|
||||||
// Get the expire days for step 8 and 9
|
// Get the expire days for step 8 and 9
|
||||||
$days = Config::get('system', 'dbclean-expire-days', 0);
|
$days = Config::get('system', 'dbclean-expire-days', 0);
|
||||||
|
$days_unclaimed = Config::get('system', 'dbclean-expire-unclaimed', 90);
|
||||||
|
|
||||||
|
if ($days_unclaimed == 0) {
|
||||||
|
$days_unclaimed = $days;
|
||||||
|
}
|
||||||
|
|
||||||
if ($stage == 1) {
|
if ($stage == 1) {
|
||||||
|
if ($days_unclaimed <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$last_id = Config::get('system', 'dbclean-last-id-1', 0);
|
$last_id = Config::get('system', 'dbclean-last-id-1', 0);
|
||||||
|
|
||||||
logger("Deleting old global item entries from item table without user copy. Last ID: ".$last_id);
|
logger("Deleting old global item entries from item table without user copy. Last ID: ".$last_id);
|
||||||
$r = dba::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
$r = dba::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||||
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
||||||
`received` < UTC_TIMESTAMP() - INTERVAL 90 DAY AND `id` >= ?
|
`received` < UTC_TIMESTAMP() - INTERVAL ? DAY AND `id` >= ?
|
||||||
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
ORDER BY `id` LIMIT ".intval($limit), $days_unclaimed, $last_id);
|
||||||
$count = dba::num_rows($r);
|
$count = dba::num_rows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found global item orphans: ".$count);
|
logger("found global item orphans: ".$count);
|
||||||
|
|
|
@ -137,6 +137,9 @@
|
||||||
{{include file="field_input.tpl" field=$itemcache_duration}}
|
{{include file="field_input.tpl" field=$itemcache_duration}}
|
||||||
{{include file="field_input.tpl" field=$max_comments}}
|
{{include file="field_input.tpl" field=$max_comments}}
|
||||||
{{include file="field_checkbox.tpl" field=$proxy_disabled}}
|
{{include file="field_checkbox.tpl" field=$proxy_disabled}}
|
||||||
|
{{include file="field_checkbox.tpl" field=$dbclean}}
|
||||||
|
{{include file="field_input.tpl" field=$dbclean_expire_days}}
|
||||||
|
{{include file="field_input.tpl" field=$dbclean_unclaimed}}
|
||||||
<div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
|
<div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
|
||||||
|
|
||||||
<h3>{{$worker_title}}</h3>
|
<h3>{{$worker_title}}</h3>
|
||||||
|
|
Loading…
Reference in a new issue