aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-01-28 17:03:05 +0000
committerMario <mario@mariovavti.com>2024-01-28 17:03:05 +0000
commit09465619e53c9c0a04ee73cecc3fc2d87ee74d55 (patch)
tree1de11b57339b770c4fffc166c0feb7fb702a4cb5
parent390af7722df44dbfe4754f6814940d90774f5d15 (diff)
downloadvolse-hubzilla-09465619e53c9c0a04ee73cecc3fc2d87ee74d55.tar.gz
volse-hubzilla-09465619e53c9c0a04ee73cecc3fc2d87ee74d55.tar.bz2
volse-hubzilla-09465619e53c9c0a04ee73cecc3fc2d87ee74d55.zip
enable object cash by default, introduce system.cache_expire_days and default to 7, default system.default_expire_days to 30 and system.active_expire_days to 7
-rw-r--r--Zotlabs/Daemon/Cron.php4
-rw-r--r--Zotlabs/Daemon/Cron_daily.php4
-rw-r--r--Zotlabs/Daemon/Expire.php4
-rw-r--r--Zotlabs/Lib/ASCache.php2
-rw-r--r--Zotlabs/Lib/Activity.php2
-rw-r--r--Zotlabs/Lib/ActivityStreams.php2
-rw-r--r--Zotlabs/Module/Admin/Site.php4
7 files changed, 13 insertions, 9 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php
index caae0ce53..e0fa2d629 100644
--- a/Zotlabs/Daemon/Cron.php
+++ b/Zotlabs/Daemon/Cron.php
@@ -124,13 +124,13 @@ class Cron {
$r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s",
intval(PHOTO_CACHE),
db_utcnow(),
- db_quoteinterval(get_config('system', 'active_expire_days', '30') . ' DAY')
+ db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY')
);
if ($r) {
q("DELETE FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s",
intval(PHOTO_CACHE),
db_utcnow(),
- db_quoteinterval(get_config('system', 'active_expire_days', '30') . ' DAY')
+ db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY')
);
foreach ($r as $rr) {
$file = dbunescbin($rr['content']);
diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php
index 850d38229..98379be1b 100644
--- a/Zotlabs/Daemon/Cron_daily.php
+++ b/Zotlabs/Daemon/Cron_daily.php
@@ -65,10 +65,10 @@ class Cron_daily {
}
}
- // Clean up emdedded content cache
+ // Clean up cache
q("DELETE FROM cache WHERE updated < %s - INTERVAL %s",
db_utcnow(),
- db_quoteinterval(get_config('system', 'active_expire_days', '30') . ' DAY')
+ db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY')
);
//update statistics in config
diff --git a/Zotlabs/Daemon/Expire.php b/Zotlabs/Daemon/Expire.php
index 84a606dc2..6ab67150f 100644
--- a/Zotlabs/Daemon/Expire.php
+++ b/Zotlabs/Daemon/Expire.php
@@ -43,8 +43,8 @@ class Expire {
logger('expire: start with pid ' . $pid, LOGGER_DEBUG);
- $site_expire = intval(get_config('system', 'default_expire_days'));
- $commented_days = intval(get_config('system', 'active_expire_days'));
+ $site_expire = intval(get_config('system', 'default_expire_days', 30));
+ $commented_days = intval(get_config('system', 'active_expire_days', 7));
logger('site_expire: ' . $site_expire);
diff --git a/Zotlabs/Lib/ASCache.php b/Zotlabs/Lib/ASCache.php
index 63bd73ea7..4904a1d8a 100644
--- a/Zotlabs/Lib/ASCache.php
+++ b/Zotlabs/Lib/ASCache.php
@@ -8,7 +8,7 @@ namespace Zotlabs\Lib;
class ASCache {
public static function isEnabled() {
- return Config::Get('system', 'as_object_cache_enabled', false);
+ return Config::Get('system', 'as_object_cache_enabled', true);
}
public static function getAge() {
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index a225e551b..a6a194045 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -3084,9 +3084,11 @@ class Activity {
while ($current_item['parent_mid'] !== $current_item['mid']) {
$cached = ASCache::Get($current_item['parent_mid']);
if ($cached) {
+ // logger('cached: ' . $current_item['parent_mid']);
$n = unserialise($cached);
}
else {
+ // logger('fetching: ' . $current_item['parent_mid']);
$n = self::fetch($current_item['parent_mid'], $channel);
if (!$n) {
break;
diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php
index 3749126d3..b37efdd26 100644
--- a/Zotlabs/Lib/ActivityStreams.php
+++ b/Zotlabs/Lib/ActivityStreams.php
@@ -405,9 +405,11 @@ class ActivityStreams {
if ($this->is_url($x)) {
$cached = ASCache::Get($x);
if ($cached) {
+ // logger('AS cached: ' . $x);
$y = unserialise($cached);
}
else {
+ // logger('AS fetching: ' . $x);
$y = $this->fetch_property($x);
if ($y) {
ASCache::Set($x, serialise($y));
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php
index b24821b28..d53322573 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -68,7 +68,7 @@ class Site {
$login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False);
$enable_context_help = ((x($_POST,'enable_context_help')) ? True : False);
$no_community_page = !((x($_POST,'no_community_page')) ? True : False);
- $default_expire_days = ((array_key_exists('default_expire_days',$_POST)) ? intval($_POST['default_expire_days']) : 0);
+ $default_expire_days = ((array_key_exists('default_expire_days',$_POST)) ? intval($_POST['default_expire_days']) : 30);
$active_expire_days = ((array_key_exists('active_expire_days',$_POST)) ? intval($_POST['active_expire_days']) : 7);
$reply_address = ((array_key_exists('reply_address',$_POST) && trim($_POST['reply_address'])) ? trim($_POST['reply_address']) : 'noreply@' . \App::get_hostname());
@@ -536,7 +536,7 @@ class Site {
'$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
'$imagick_path' => array('imagick_path', t("Path to ImageMagick convert program"), get_config('system','imagick_convert_path'), t("If set, use this program to generate photo thumbnails for huge images ( > 4000 pixels in either dimension), otherwise memory exhaustion may occur. Example: /usr/bin/convert")),
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
- '$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days')), t('0 for no expiration of imported content')),
+ '$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days', 30)), t('0 for no expiration of imported content')),
'$active_expire_days' => array('active_expire_days', t('Do not expire any posts which have comments less than this many days ago'), intval(get_config('system','active_expire_days',7)), ''),
'$sellpage' => array('site_sellpage', t('Public servers: Optional landing (marketing) webpage for new registrants'), get_config('system','sellpage',''), sprintf( t('Create this page first. Default is %s/register'),z_root())),
'$first_page' => array('first_page', t('Page to display after creating a new channel'), get_config('system','workflow_channel_next','profiles'), t('Default: profiles')),