Commit 2805520d authored by Mario's avatar Mario
Browse files

Merge remote-tracking branch 'origin/8.0RC'

parents f6d94060 fb7ca188
Pipeline #565312 passed with stage
in 51 seconds
Hubzilla 8.0 (2023-01-13)
Updated ru strings
Implement ability to edit addon PDL with pdledit_gui and pdledit
Implement queueworker auto sleep time
Always add sys channel to receivers for public items
Improved server sent events loop
Exclude not tagable xchan networks handle_tag()
Add mark html tag to the html2bbcode parser
Embed or attach uploaded files depending on file type
Changed logic to enable site only public stream - please revisit admin setting
Updated nb-no strings
Moved queueworker to core
Provide a PDL file for mod invite and set the profile
Disabled outdated context help
Mark unseen items seen after a certain amount of time (default 90 days)
Slightly restructure lib webfinger
Improved redbasic dark schema
Implement unseen thread and unseen items count in HQ widget
In unseen items notifications just count the first 99 and display 99+ if there are more
Bugfixes
- Fix race conditions when processing multiple choice polls
- Fix affinity slider updates - issue #1714
- Fix issue where accounts created with a did2 could change their password
- Fix no message displayed if file not found in mod cloud
- Fix pubstream tagcloud unthreaded view
- Fix french invite template
- Fix comment permission issue in site only public stream
- Fix privacy tag not referring to latest hubloc entry
- Fix selected item not highlighted
- Fix poll issue when special chars and spaces are involved
- Fix prune_hub_reinstalls() to only care about zot6 hublocs
- Fix redis session PHP warnings
- Fix remote visitor photo uploads
- Fix mod shredwithme not showing any items
- Fix api_auth not referring to latest hubloc entry
- Fix category widget URLs
- Fix poller always polling broken feeds
- Fix sse event always triggered if public stream notification are off or the app is not installed
- Fix more PHP8 warnings
- Fix wrong variable in tag_deliver()
- Fix mod follow use trim() after punify() - issue #1698
Addons
- Cards: update widget info
- Articles: update widget info
- Wiki: update widget info
- Sse: filter apporvals
- Cards: use html_entity_decode before purify and html2plain for summary
- Articles: use html_entity_decode before purify and html2plain for summary
- Wiki: use html_entity_decode before purify and html2plain for summary
- Cards: fix comments not displayed if filter by category
- Articles: fix comments not displayed if filter by category
- Sse: respect the site public stream setting
- Queueworker: moved to core
- Pubcrawl: move db query out of foreach loop
- Pubcrawl: add mentions and thread owner to recipients for public items
Hubzilla 7.8.7 (2022-12-03)
- Fix regression when adding feed contacts
- Fix regression new channel calendar event not created
......
......@@ -7,6 +7,7 @@ class Addon {
static public function run($argc, $argv) {
call_hooks('daemon_addon', $argv);
return;
}
......
......@@ -19,8 +19,10 @@ class Cache_embeds {
$item = $c[0];
// bbcode conversion by default processes embeds that aren't already cached.
// Ignore the returned html output.
// Ignore the returned html output.
bbcode($item['body']);
return;
}
}
......@@ -24,7 +24,7 @@ class Cache_query {
array_shift($argv);
array_shift($argv);
$arr = json_decode(base64_decode($argv[0]), true);
$r = call_user_func_array('q', $arr);
......@@ -32,5 +32,7 @@ class Cache_query {
Cache::set($key, serialize($r));
del_config('procid', $key);
return;
}
}
......@@ -9,6 +9,7 @@ class Cli_suggest {
static public function run($argc,$argv) {
update_suggestions();
return;
}
}
......@@ -30,6 +30,7 @@ class Convo {
intval($channel_id),
dbesc($contact_hash)
);
if (!$r) {
return;
}
......@@ -40,19 +41,25 @@ class Convo {
$messages = $obj->get();
if ($messages) {
foreach ($messages as $message) {
if (is_string($message)) {
$message = Activity::fetch($message, $channel);
}
// set client flag because comments will probably just be objects and not full blown activities
// and that lets us use implied_create
$AS = new ActivityStreams($message);
if ($AS->is_valid() && is_array($AS->obj)) {
$item = Activity::decode_note($AS);
Activity::store($channel, $contact['abook_xchan'], $AS, $item);
}
if (!$messages) {
return;
}
foreach ($messages as $message) {
if (is_string($message)) {
$message = Activity::fetch($message, $channel);
}
// set client flag because comments will probably just be objects and not full blown activities
// and that lets us use implied_create
$AS = new ActivityStreams($message);
if ($AS->is_valid() && is_array($AS->obj)) {
$item = Activity::decode_note($AS);
Activity::store($channel, $contact['abook_xchan'], $AS, $item);
}
}
return;
}
}
......@@ -19,6 +19,7 @@ class Cron {
}
}
/*
// Check for a lockfile. If it exists, but is over an hour old, it's stale. Ignore it.
$lockfile = 'store/[data]/cron';
if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 3600))
......@@ -30,6 +31,7 @@ class Cron {
// Create a lockfile. Needs two vars, but $x doesn't need to contain anything.
$x = '';
file_put_contents($lockfile, $x);
*/
logger('cron: start');
......@@ -50,7 +52,7 @@ class Cron {
require_once('include/account.php');
remove_expired_registrations();
$interval = get_config('system', 'delivery_interval', 3);
$interval = get_config('queueworker', 'queue_interval', 500000);
// expire any expired items
......@@ -65,8 +67,10 @@ class Cron {
if ($rr['item_wall']) {
// The notifier isn't normally invoked unless item_drop is interactive.
Master::Summon(['Notifier', 'drop', $rr['id']]);
if ($interval)
@time_sleep_until(microtime(true) + (float)$interval);
if ($interval) {
usleep($interval);
}
}
}
}
......@@ -96,8 +100,10 @@ class Cron {
if ($r) {
foreach ($r as $rr) {
Master::Summon(array('Directory', $rr['channel_id'], 'force'));
if ($interval)
@time_sleep_until(microtime(true) + (float)$interval);
if ($interval) {
usleep($interval);
}
}
}
......@@ -151,8 +157,10 @@ class Cron {
);
}
Master::Summon(array('Notifier', 'wall-new', $rr['id']));
if ($interval)
@time_sleep_until(microtime(true) + (float)$interval);
if ($interval) {
usleep($interval);
}
}
}
}
......@@ -203,10 +211,10 @@ class Cron {
}
// pull in some public posts
// pull in some public posts if allowed
$disable_discover_tab = get_config('system', 'disable_discover_tab') || get_config('system', 'disable_discover_tab') === false;
if (!$disable_discover_tab)
$disable_externals = get_config('system', 'disable_discover_tab') || get_config('system', 'disable_discover_tab') === false || get_config('system', 'site_firehose');
if (!$disable_externals)
Master::Summon(['Externals']);
$restart = false;
......@@ -228,7 +236,7 @@ class Cron {
set_config('system', 'lastcron', datetime_convert());
//All done - clear the lockfile
@unlink($lockfile);
//@unlink($lockfile);
return;
}
......
......@@ -49,6 +49,22 @@ class Cron_daily {
dbesc('sse_id.%')
);
// Mark items seen after X days (default 90)
$r = dbq("select channel_id from channel where channel_removed = 0");
if ($r) {
foreach ($r as $rr) {
$mark_seen_days = get_pconfig($rr['channel_id'], 'system', 'mark_seen_days', 90);
q("UPDATE item SET item_unseen = 0 WHERE
uid = %d AND item_unseen = 1
AND created < %s - INTERVAL %s",
intval($rr['channel_id']),
db_utcnow(),
db_quoteinterval($mark_seen_days . ' DAY')
);
}
}
// Clean up emdedded content cache
q("DELETE FROM cache WHERE updated < %s - INTERVAL %s",
db_utcnow(),
......@@ -103,5 +119,7 @@ class Cron_daily {
/**
* End Cron Daily
*/
return;
}
}
......@@ -22,12 +22,12 @@ class Cron_weekly {
mark_orphan_hubsxchans();
// Find channels that were removed in the last three weeks, but
// Find channels that were removed in the last three weeks, but
// haven't been finally cleaned up. These should be older than 10
// days to ensure that "purgeall" messages have gone out or bounced
// or timed out.
// days to ensure that "purgeall" messages have gone out or bounced
// or timed out.
$r = q("select channel_id from channel where channel_removed = 1 and
$r = q("select channel_id from channel where channel_removed = 1 and
channel_deleted > %s - INTERVAL %s and channel_deleted < %s - INTERVAL %s",
db_utcnow(), db_quoteinterval('21 DAY'),
db_utcnow(), db_quoteinterval('10 DAY')
......@@ -59,5 +59,6 @@ class Cron_weekly {
* End Cron Weekly
*/
return;
}
}
\ No newline at end of file
}
......@@ -28,6 +28,8 @@ class Deliver {
}
return;
}
}
......@@ -12,8 +12,12 @@ class Deliver_hooks {
$r = q("select * from item where id = '%d'",
intval($argv[1])
);
if ($r)
if ($r) {
call_hooks('notifier_normal', $r[0]);
}
return;
}
}
......
......@@ -97,5 +97,7 @@ class Directory {
if ($pushall) {
Master::Summon(array('Notifier', 'refresh_all', $channel['channel_id']));
}
return;
}
}
......@@ -103,5 +103,7 @@ class Expire {
}
del_config('procid', 'expire');
return;
}
}
......@@ -19,6 +19,7 @@ class Externals {
$importer = get_sys_channel();
$total = 0;
$attempts = 0;
$url = '';
logger('externals: startup', LOGGER_DEBUG);
......@@ -67,9 +68,8 @@ class Externals {
datetime_convert('UTC', 'UTC', 'now - 30 days')
);
$contact = $r[0];
if ($contact) {
if ($r) {
$contact = $r[0];
$url = $contact['hubloc_id_url'];
}
}
......@@ -143,7 +143,7 @@ class Externals {
$AS = new ActivityStreams($message);
if ($AS->is_valid() && is_array($AS->obj)) {
$item = Activity::decode_note($AS);
Activity::store($importer, $contact['abook_xchan'], $AS, $item);
Activity::store($importer, $contact['hubloc_hash'], $AS, $item);
$total++;
}
}
......
......@@ -11,6 +11,8 @@ class Importdoc {
self::update_docs_dir('doc/*');
return;
}
static public function update_docs_dir($s) {
......
......@@ -2,6 +2,8 @@
namespace Zotlabs\Daemon;
use Zotlabs\Lib\QueueWorker;
if (array_search(__file__, get_included_files()) === 0) {
require_once('include/cli_startup.php');
array_shift($argv);
......@@ -9,6 +11,7 @@ if (array_search(__file__, get_included_files()) === 0) {
if ($argc)
Master::Release($argc, $argv);
return;
}
......@@ -16,6 +19,10 @@ if (array_search(__file__, get_included_files()) === 0) {
class Master {
static public function Summon($arr) {
QueueWorker::Summon($arr);
return;
/*
$hookinfo = [
'argv' => $arr
];
......@@ -32,11 +39,15 @@ class Master {
$phpbin = get_config('system', 'phpbin', 'php');
proc_run($phpbin, 'Zotlabs/Daemon/Master.php', $arr);
*/
}
static public function Release($argc, $argv) {
cli_startup();
QueueWorker::Release($argv);
return;
/*
$hookinfo = [
'argv' => $argv
];
......@@ -54,5 +65,6 @@ class Master {
logger('Master: release: ' . json_encode($argv), LOGGER_ALL, LOG_DEBUG);
$cls = '\\Zotlabs\\Daemon\\' . $argv[0];
$cls::run($argc, $argv);
*/
}
}
......@@ -79,10 +79,7 @@ class Notifier {
static public $encoded_item = null;
static public $channel = null;
static public $private = false;
// $fragment can contain additional info to omit de-duplication in the queueworker.
// E.g. if an item is updated many times in a row from different sources (multiple vote updates) the
// update source mid or a timestamp or random string can be added.
static public $fragment = null;
static public function run($argc, $argv) {
......@@ -107,7 +104,6 @@ class Notifier {
self::$encoded_item = null;
self::$channel = null;
self::$private = false;
self::$fragment = null;
$sys = get_sys_channel();
$normal_mode = true;
......@@ -233,8 +229,6 @@ class Notifier {
// Fetch the target item
self::$fragment = $argv[3] ?? '';
$r = q("SELECT * FROM item WHERE id = %d AND parent != 0",
intval($item_id)
);
......@@ -509,6 +503,7 @@ class Notifier {
// public posts won't make it to the local public stream unless there's a recipient on this site.
// This code block sees if it's a public post and localhost is missing, and if so adds an entry for the local sys channel to the $hubs list
/* sys channel is now added in collect recipients
if (!self::$private) {
$found_localhost = false;
if ($hubs) {
......@@ -529,6 +524,7 @@ class Notifier {
}
}
}
*/
if (!$hubs) {
logger('notifier: no hubs', LOGGER_NORMAL, LOG_NOTICE);
......@@ -699,7 +695,7 @@ class Notifier {
// This wastes a process if there are no delivery hooks configured, so check this before launching the new process
$x = q("select * from hook where hook = 'notifier_normal'");
if ($x) {
Master::Summon(['Deliver_hooks', $target_item['id'], self::$fragment]);
Master::Summon(['Deliver_hooks', $target_item['id']]);
}
}
......
......@@ -64,12 +64,21 @@ class Onepoll {
if ($contact['xchan_network'] === 'rss') {
logger('onepoll: processing feed ' . $contact['xchan_name'], LOGGER_DEBUG);
$alive = handle_feed($importer['channel_id'], $contact_id, $contact['xchan_hash']);
if ($alive) {
q("update abook set abook_connected = '%s' where abook_id = %d",
if (!$alive) {
q("update abook set abook_updated = '%s' where abook_id = %d",
dbesc(datetime_convert()),
intval($contact['abook_id'])
);
return;
}
q("update abook set abook_updated = '%s', abook_connected = '%s' where abook_id = %d",
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($contact['abook_id'])
);
return;
}
......
......@@ -17,9 +17,12 @@ class Poller {
}
}
$interval = intval(get_config('system', 'poll_interval'));
if (!$interval)
$interval = get_config('queueworker', 'queue_interval', 500000);
/*
if (!$interval) {
$interval = ((get_config('system', 'delivery_interval') === false) ? 3 : intval(get_config('system', 'delivery_interval')));
}
// Check for a lockfile. If it exists, but is over an hour old, it's stale. Ignore it.
$lockfile = 'store/[data]/poller';
......@@ -32,6 +35,7 @@ class Poller {
// Create a lockfile. Needs two vars, but $x doesn't need to contain anything.
$x = '';
file_put_contents($lockfile, $x);
*/
logger('poller: start');
......@@ -93,13 +97,24 @@ class Poller {
$min = intval(get_config('system', 'minimum_feedcheck_minutes'));
if (!$min)
$min = 60;
if ($t !== $c) {
// if the last fetch failed only attempt fetch once a day
$min = 60 * 24;
}
$x = datetime_convert('UTC', 'UTC', "now - $min minutes");
if ($c < $x) {
if ($t < $x) {
Master::Summon(['Onepoll', $contact['abook_id']]);
if ($interval)
@time_sleep_until(microtime(true) + (float)$interval);
if ($interval) {
usleep($interval);
}
}
continue;
}
if ($contact['xchan_network'] !== 'zot6')
......@@ -158,9 +173,10 @@ class Poller {
continue;
Master::Summon(['Onepoll', $contact['abook_id']]);
if ($interval)
@time_sleep_until(microtime(true) + (float)$interval);
if ($interval) {
usleep($interval);
}
}
}
......@@ -181,9 +197,12 @@ class Poller {
if ($rr['ud_last'] > NULL_DATE)
if ($rr['ud_last'] > datetime_convert('UTC', 'UTC', 'now - 1 day'))
continue;
Master::Summon(['Onedirsync', $rr['ud_id']]);
if ($interval)
@time_sleep_until(microtime(true) + (float)$interval);
if ($interval) {
usleep($interval);
}
}
}
}
......@@ -191,9 +210,9 @@ class Poller {
set_config('system', 'lastpoll', datetime_convert());
//All done - clear the lockfile
/*
@unlink($lockfile);
*/
return;
}
}
......@@ -79,5 +79,7 @@ class Queue {
foreach ($r as $rv) {
LibQueue::deliver($rv);
}
return;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment