[various] Fix PHP 8 deprecation warnings

pull/1315/head
Hypolite Petovan 2022-11-19 19:19:30 -05:00
parent e8daa6b97d
commit f4130a9724
4 changed files with 6 additions and 7 deletions

View File

@ -145,7 +145,7 @@ function diaspora_hook_fork(App $a, array &$b)
$post = $b['data']; $post = $b['data'];
if ($post['deleted'] || $post['private'] || ($post['created'] !== $post['edited']) || if ($post['deleted'] || $post['private'] || ($post['created'] !== $post['edited']) ||
!strstr($post['postopts'], 'diaspora') || ($post['parent'] != $post['id'])) { !strstr($post['postopts'] ?? '', 'diaspora') || ($post['parent'] != $post['id'])) {
$b['execute'] = false; $b['execute'] = false;
return; return;
} }

View File

@ -266,7 +266,7 @@ function tumblr_hook_fork(App $a, array &$b)
$post = $b['data']; $post = $b['data'];
if ($post['deleted'] || $post['private'] || ($post['created'] !== $post['edited']) || if ($post['deleted'] || $post['private'] || ($post['created'] !== $post['edited']) ||
!strstr($post['postopts'], 'tumblr') || ($post['parent'] != $post['id'])) { !strstr($post['postopts'] ?? '', 'tumblr') || ($post['parent'] != $post['id'])) {
$b['execute'] = false; $b['execute'] = false;
return; return;
} }
@ -442,4 +442,3 @@ function tumblr_send(App $a, array &$b) {
} }
} }
} }

View File

@ -440,7 +440,7 @@ function twitter_hook_fork(App $a, array &$b)
return; return;
} }
if (substr($post['app'], 0, 7) == 'Twitter') { if (substr($post['app'] ?? '', 0, 7) == 'Twitter') {
DI::logger()->info('No Twitter app'); DI::logger()->info('No Twitter app');
$b['execute'] = false; $b['execute'] = false;
return; return;
@ -455,7 +455,7 @@ function twitter_hook_fork(App $a, array &$b)
} }
} else { } else {
// Comments are never exported when we don't import the twitter timeline // Comments are never exported when we don't import the twitter timeline
if (!strstr($post['postopts'], 'twitter') || ($post['parent'] != $post['id']) || $post['private']) { if (!strstr($post['postopts'] ?? '', 'twitter') || ($post['parent'] != $post['id']) || $post['private']) {
DI::logger()->info('Comments are never exported when we don\'t import the twitter timeline'); DI::logger()->info('Comments are never exported when we don\'t import the twitter timeline');
$b['execute'] = false; $b['execute'] = false;
return; return;
@ -1582,7 +1582,7 @@ function twitter_auto_follow(int $uid, object $data)
// We only probe on Mastodon style URL to reduce the number of unsuccessful probes // We only probe on Mastodon style URL to reduce the number of unsuccessful probes
twitter_add_contact($url->expanded_url, strpos($url->expanded_url, '@'), $uid); twitter_add_contact($url->expanded_url, strpos($url->expanded_url, '@'), $uid);
} }
} }
} }
/** /**

View File

@ -107,7 +107,7 @@ function wppost_hook_fork(App $a, array &$b)
$post = $b['data']; $post = $b['data'];
if ($post['deleted'] || $post['private'] || ($post['created'] !== $post['edited']) || if ($post['deleted'] || $post['private'] || ($post['created'] !== $post['edited']) ||
!strstr($post['postopts'], 'wppost') || ($post['parent'] != $post['id'])) { !strstr($post['postopts'] ?? '', 'wppost') || ($post['parent'] != $post['id'])) {
$b['execute'] = false; $b['execute'] = false;
return; return;
} }