Browse Source

Most functions now moved from include/items.php

pull/4351/head
Michael 3 years ago
parent
commit
7b27dda784
22 changed files with 1488 additions and 1523 deletions
  1. +1
    -1
      include/api.php
  2. +2
    -1
      include/event.php
  3. +7
    -1460
      include/items.php
  4. +2
    -1
      include/like.php
  5. +3
    -2
      mod/dfrn_confirm.php
  6. +1
    -1
      mod/item.php
  7. +2
    -1
      mod/notify.php
  8. +4
    -3
      mod/photos.php
  9. +2
    -1
      mod/poke.php
  10. +2
    -1
      mod/profiles.php
  11. +2
    -1
      mod/subthread.php
  12. +2
    -7
      mod/tagger.php
  13. +109
    -0
      src/Model/Contact.php
  14. +1310
    -10
      src/Model/Item.php
  15. +14
    -13
      src/Protocol/DFRN.php
  16. +7
    -6
      src/Protocol/Diaspora.php
  17. +2
    -2
      src/Protocol/Feed.php
  18. +8
    -7
      src/Protocol/OStatus.php
  19. +1
    -1
      src/Worker/Delivery.php
  20. +2
    -1
      src/Worker/Expire.php
  21. +3
    -2
      src/Worker/OnePoll.php
  22. +2
    -1
      src/Worker/SpoolPost.php

+ 1
- 1
include/api.php View File

@ -4731,7 +4731,7 @@ function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $f
. '[/url]';
// do the magic for storing the item in the database and trigger the federation to other contacts
item_store($arr);
Item::insert($arr);
}
/**


+ 2
- 1
include/event.php View File

@ -11,6 +11,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Item;
use Friendica\Model\Profile;
use Friendica\Util\Map;
@ -399,7 +400,7 @@ function event_store($arr) {
$item_arr['object'] .= '<content>' . xmlify(format_event_bbcode($event)) . '</content>';
$item_arr['object'] .= '</object>' . "\n";
$item_id = item_store($item_arr);
$item_id = Item::insert($item_arr);
if ($item_id) {
q("UPDATE `item` SET `event-id` = %d WHERE `uid` = %d AND `id` = %d",
intval($event['id']),


+ 7
- 1460
include/items.php
File diff suppressed because it is too large
View File


+ 2
- 1
include/like.php View File

@ -9,6 +9,7 @@ use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Protocol\Diaspora;
/**
@ -244,7 +245,7 @@ EOT;
'unseen' => 1,
];
$new_item_id = item_store($new_item);
$new_item_id = Item::insert($new_item);
// @todo: Explain this block
if (! $item['visible']) {


+ 3
- 2
mod/dfrn_confirm.php View File

@ -26,6 +26,7 @@ use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\User;
use Friendica\Network\Probe;
use Friendica\Protocol\Diaspora;
@ -439,7 +440,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$arr['deny_cid'] = $user['deny_cid'];
$arr['deny_gid'] = $user['deny_gid'];
$i = item_store($arr);
$i = Item::insert($arr);
if ($i) {
Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i);
}
@ -701,7 +702,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$arr['deny_cid'] = $user['deny_cid'];
$arr['deny_gid'] = $user['deny_gid'];
$i = item_store($arr);
$i = Item::insert($arr);
if ($i) {
Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i);
}


+ 1
- 1
mod/item.php View File

@ -729,7 +729,7 @@ function item_post(App $a) {
unset($datarray['self']);
unset($datarray['api_source']);
$post_id = item_store($datarray);
$post_id = Item::insert($datarray);
if (!$post_id) {
logger("Item wasn't stored.");


+ 2
- 1
mod/notify.php View File

@ -8,6 +8,7 @@ use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Module\Login;
use Friendica\Model\Item;
function notify_init(App $a)
{
@ -27,7 +28,7 @@ function notify_init(App $a)
require_once("include/items.php");
$urldata = parse_url($note['link']);
$guid = basename($urldata["path"]);
$itemdata = get_item_id($guid, local_user());
$itemdata = Item::getIdAndNickByGuid($guid, local_user());
if ($itemdata["id"] != 0) {
$note['link'] = System::baseUrl().'/display/'.$itemdata["nick"].'/'.$itemdata["id"];
}


+ 4
- 3
mod/photos.php View File

@ -13,6 +13,7 @@ use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Model\Profile;
use Friendica\Network\Probe;
@ -519,7 +520,7 @@ function photos_post(App $a)
. '[img]' . System::baseUrl() . '/photo/' . $p[0]['resource-id'] . '-' . $p[0]['scale'] . '.'. $ext . '[/img]'
. '[/url]';
$item_id = item_store($arr);
$item_id = Item::insert($arr);
}
if ($item_id) {
@ -709,7 +710,7 @@ function photos_post(App $a)
. System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '</id>';
$arr['target'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '" />' . "\n" . '<link rel="preview" type="'.$p[0]['type'].'" href="' . System::baseUrl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
$item_id = item_store($arr);
$item_id = Item::insert($arr);
if ($item_id) {
Worker::add(PRIORITY_HIGH, "Notifier", "tag", $item_id);
}
@ -931,7 +932,7 @@ function photos_post(App $a)
. '[img]' . System::baseUrl() . "/photo/{$photo_hash}-{$smallest}.".$Image->getExt() . '[/img]'
. '[/url]';
$item_id = item_store($arr);
$item_id = Item::insert($arr);
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);


+ 2
- 1
mod/poke.php View File

@ -19,6 +19,7 @@ use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Item;
require_once 'include/security.php';
require_once 'include/bbcode.php';
@ -132,7 +133,7 @@ function poke_init(App $a) {
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $target['photo'] . '" />' . "\n");
$arr['object'] .= '</link></object>' . "\n";
$item_id = item_store($arr);
$item_id = Item::insert($arr);
if($item_id) {
//q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d",
// dbesc(System::baseUrl() . '/display/' . $poster['nickname'] . '/' . $item_id),


+ 2
- 1
mod/profiles.php View File

@ -15,6 +15,7 @@ use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\GContact;
use Friendica\Model\Profile;
use Friendica\Model\Item;
use Friendica\Network\Probe;
function profiles_init(App $a) {
@ -601,7 +602,7 @@ function profile_activity($changed, $value) {
$arr['deny_cid'] = $a->user['deny_cid'];
$arr['deny_gid'] = $a->user['deny_gid'];
$i = item_store($arr);
$i = Item::insert($arr);
if ($i) {
Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i);
}


+ 2
- 1
mod/subthread.php View File

@ -7,6 +7,7 @@ use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Item;
require_once 'include/security.php';
require_once 'include/bbcode.php';
@ -149,7 +150,7 @@ EOT;
$arr['visible'] = 1;
$arr['unseen'] = 1;
$post_id = item_store($arr);
$post_id = Item::insert($arr);
if (! $item['visible']) {
$r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d AND `uid` = %d",


+ 2
- 7
mod/tagger.php View File

@ -8,6 +8,7 @@ use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Item;
require_once 'include/security.php';
require_once 'include/bbcode.php';
@ -145,13 +146,7 @@ EOT;
$arr['unseen'] = 1;
$arr['origin'] = 1;
$post_id = item_store($arr);
// q("UPDATE `item` set plink = '%s' where id = %d",
// dbesc(System::baseUrl() . '/display/' . $owner_nick . '/' . $post_id),
// intval($post_id)
// );
$post_id = Item::insert($arr);
if(! $item['visible']) {
$r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d AND `uid` = %d",


+ 109
- 0
src/Model/Contact.php View File

@ -1354,4 +1354,113 @@ class Contact extends BaseObject
return $contact;
}
public static function newFollower($importer, $contact, $datarray, $item, $sharing = false) {
$url = notags(trim($datarray['author-link']));
$name = notags(trim($datarray['author-name']));
$photo = notags(trim($datarray['author-avatar']));
if (is_object($item)) {
$rawtag = $item->get_item_tags(NAMESPACE_ACTIVITY,'actor');
if ($rawtag && $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']) {
$nick = $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data'];
}
} else {
$nick = $item;
}
if (is_array($contact)) {
if (($contact['network'] == NETWORK_OSTATUS && $contact['rel'] == CONTACT_IS_SHARING)
|| ($sharing && $contact['rel'] == CONTACT_IS_FOLLOWER)) {
dba::update('contact', ['rel' => CONTACT_IS_FRIEND, 'writable' => true],
['id' => $contact['id'], 'uid' => $importer['uid']]);
}
// send email notification to owner?
} else {
// create contact record
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `name`, `nick`, `photo`, `network`, `rel`,
`blocked`, `readonly`, `pending`, `writable`)
VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 0, 1, 1)",
intval($importer['uid']),
dbesc(datetime_convert()),
dbesc($url),
dbesc(normalise_link($url)),
dbesc($name),
dbesc($nick),
dbesc($photo),
dbesc(NETWORK_OSTATUS),
intval(CONTACT_IS_FOLLOWER)
);
$r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `pending` = 1 LIMIT 1",
intval($importer['uid']),
dbesc($url)
);
if (DBM::is_result($r)) {
$contact_record = $r[0];
Contact::updateAvatar($photo, $importer["uid"], $contact_record["id"], true);
}
/// @TODO Encapsulate this into a function/method
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($importer['uid'])
);
if (DBM::is_result($r) && !in_array($r[0]['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
// create notification
$hash = random_string();
if (is_array($contact_record)) {
dba::insert('intro', ['uid' => $importer['uid'], 'contact-id' => $contact_record['id'],
'blocked' => false, 'knowyou' => false,
'hash' => $hash, 'datetime' => datetime_convert()]);
}
Group::addMember(User::getDefaultGroup($importer['uid'], $contact_record["network"]), $contact_record['id']);
if (($r[0]['notify-flags'] & NOTIFY_INTRO) &&
in_array($r[0]['page-flags'], [PAGE_NORMAL])) {
notification([
'type' => NOTIFY_INTRO,
'notify_flags' => $r[0]['notify-flags'],
'language' => $r[0]['language'],
'to_name' => $r[0]['username'],
'to_email' => $r[0]['email'],
'uid' => $r[0]['uid'],
'link' => System::baseUrl() . '/notifications/intro',
'source_name' => ((strlen(stripslashes($contact_record['name']))) ? stripslashes($contact_record['name']) : L10n::t('[Name Withheld]')),
'source_link' => $contact_record['url'],
'source_photo' => $contact_record['photo'],
'verb' => ($sharing ? ACTIVITY_FRIEND : ACTIVITY_FOLLOW),
'otype' => 'intro'
]);
}
} elseif (DBM::is_result($r) && in_array($r[0]['page-flags'], [PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY])) {
q("UPDATE `contact` SET `pending` = 0 WHERE `uid` = %d AND `url` = '%s' AND `pending` LIMIT 1",
intval($importer['uid']),
dbesc($url)
);
}
}
}
public static function loseFollower($importer, $contact, array $datarray = [], $item = "") {
if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_SHARING)) {
dba::update('contact', ['rel' => CONTACT_IS_SHARING], ['id' => $contact['id']]);
} else {
Contact::remove($contact['id']);
}
}
public static function loseSharer($importer, $contact, array $datarray = [], $item = "") {
if (($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_FOLLOWER)) {
dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
} else {
Contact::remove($contact['id']);
}
}
}

+ 1310
- 10
src/Model/Item.php
File diff suppressed because it is too large
View File


+ 14
- 13
src/Protocol/DFRN.php View File

@ -19,6 +19,7 @@ use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Profile;
use Friendica\Model\Term;
use Friendica\Model\User;
@ -922,7 +923,7 @@ class DFRN
}
if ($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) {
$body = fix_private_photos($item['body'], $owner['uid'], $item, $cid);
$body = Item::fixPrivatePhotos($item['body'], $owner['uid'], $item, $cid);
} else {
$body = $item['body'];
}
@ -1059,7 +1060,7 @@ class DFRN
$entry->appendChild($actarg);
}
$tags = item_getfeedtags($item);
$tags = Item::getFeedTags($item);
if (count($tags)) {
foreach ($tags as $t) {
@ -2214,7 +2215,7 @@ class DFRN
"to_email" => $importer["email"],
"uid" => $importer["importer_uid"],
"item" => $item,
"link" => System::baseUrl()."/display/".urlencode(get_item_guid($posted_id)),
"link" => System::baseUrl()."/display/".urlencode(Item::getGuidById($posted_id)),
"source_name" => stripslashes($item["author-name"]),
"source_link" => $item["author-link"],
"source_photo" => ((link_compare($item["author-link"], $importer["url"]))
@ -2254,22 +2255,22 @@ class DFRN
// This function once was responsible for DFRN and OStatus.
if (activity_match($item["verb"], ACTIVITY_FOLLOW)) {
logger("New follower");
new_follower($importer, $contact, $item, $nickname);
Contact::newFollower($importer, $contact, $item, $nickname);
return false;
}
if (activity_match($item["verb"], ACTIVITY_UNFOLLOW)) {
logger("Lost follower");
lose_follower($importer, $contact, $item);
Contact::loseFollower($importer, $contact, $item);
return false;
}
if (activity_match($item["verb"], ACTIVITY_REQ_FRIEND)) {
logger("New friend request");
new_follower($importer, $contact, $item, $nickname, true);
Contact::newFollower($importer, $contact, $item, $nickname, true);
return false;
}
if (activity_match($item["verb"], ACTIVITY_UNFRIEND)) {
logger("Lost sharer");
lose_sharer($importer, $contact, $item);
Contact::loseSharer($importer, $contact, $item);
return false;
}
} else {
@ -2448,7 +2449,7 @@ class DFRN
// make sure nobody is trying to sneak some html tags by us
$item["body"] = notags(base64url_decode($item["body"]));
$item["body"] = limit_body_size($item["body"]);
$item["body"] = Item::limitBodySize($item["body"]);
/// @todo Do we really need this check for HTML elements? (It was copied from the old function)
if ((strpos($item['body'], '<') !== false) && (strpos($item['body'], '>') !== false)) {
@ -2502,7 +2503,7 @@ class DFRN
$item["guid"] = $xpath->query("dfrn:diaspora_guid/text()", $entry)->item(0)->nodeValue;
// We store the data from "dfrn:diaspora_signature" in a different table, this is done in "item_store"
// We store the data from "dfrn:diaspora_signature" in a different table, this is done in "Item::insert"
$dsprsig = unxmlify($xpath->query("dfrn:diaspora_signature/text()", $entry)->item(0)->nodeValue);
if ($dsprsig != "") {
$item["dsprsig"] = $dsprsig;
@ -2670,7 +2671,7 @@ class DFRN
}
if (in_array($entrytype, [DFRN_REPLY, DFRN_REPLY_RC])) {
$posted_id = item_store($item);
$posted_id = Item::insert($item);
$parent = 0;
if ($posted_id) {
@ -2700,7 +2701,7 @@ class DFRN
/*
* The item owner info is not our contact. It's OK and is to be expected if this is a tgroup delivery,
* but otherwise there's a possible data mixup on the sender's system.
* the tgroup delivery code called from item_store will correct it if it's a forum,
* the tgroup delivery code called from Item::insert will correct it if it's a forum,
* but we're going to unconditionally correct it here so that the post will always be owned by our contact.
*/
logger('Correcting item owner.', LOGGER_DEBUG);
@ -2716,9 +2717,9 @@ class DFRN
// This is my contact on another system, but it's really me.
// Turn this into a wall post.
$notify = item_is_remote_self($importer, $item);
$notify = Item::isRemoteSelf($importer, $item);
$posted_id = item_store($item, false, $notify);
$posted_id = Item::insert($item, false, $notify);
logger("Item was stored with id ".$posted_id, LOGGER_DEBUG);


+ 7
- 6
src/Protocol/Diaspora.php View File

@ -20,6 +20,7 @@ use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Profile;
use Friendica\Model\Queue;
use Friendica\Model\User;
@ -1730,7 +1731,7 @@ class Diaspora
self::fetchGuid($datarray);
$message_id = item_store($datarray);
$message_id = Item::insert($datarray);
if ($message_id <= 0) {
return false;
@ -2051,7 +2052,7 @@ class Diaspora
$datarray["body"] = self::constructLikeBody($contact, $parent_item, $guid);
$message_id = item_store($datarray);
$message_id = Item::insert($datarray);
if ($message_id <= 0) {
return false;
@ -2417,7 +2418,7 @@ class Diaspora
$arr["deny_cid"] = $user["deny_cid"];
$arr["deny_gid"] = $user["deny_gid"];
$i = item_store($arr);
$i = Item::insert($arr);
if ($i) {
Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i);
}
@ -2501,7 +2502,7 @@ class Diaspora
return true;
} else {
logger("Author ".$author." doesn't want to follow us anymore.", LOGGER_DEBUG);
lose_follower($importer, $contact);
Contact::loseFollower($importer, $contact);
return true;
}
}
@ -2780,7 +2781,7 @@ class Diaspora
$datarray["object-type"] = $original_item["object-type"];
self::fetchGuid($datarray);
$message_id = item_store($datarray);
$message_id = Item::insert($datarray);
self::sendParticipation($contact, $datarray);
@ -3020,7 +3021,7 @@ class Diaspora
}
self::fetchGuid($datarray);
$message_id = item_store($datarray);
$message_id = Item::insert($datarray);
self::sendParticipation($contact, $datarray);


+ 2
- 2
src/Protocol/Feed.php View File

@ -423,7 +423,7 @@ class Feed {
if (!$simulate) {
logger("Stored feed: ".print_r($item, true), LOGGER_DEBUG);
$notify = item_is_remote_self($contact, $item);
$notify = Item::isRemoteSelf($contact, $item);
// Distributed items should have a well formatted URI.
// Additionally we have to avoid conflicts with identical URI between imported feeds and these items.
@ -433,7 +433,7 @@ class Feed {
unset($item['parent-uri']);
}
$id = item_store($item, false, $notify);
$id = Item::insert($item, false, $notify);
logger("Feed for contact ".$contact["url"]." stored under id ".$id);
} else {


+ 8
- 7
src/Protocol/OStatus.php View File

@ -14,6 +14,7 @@ use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\Conversation;
use Friendica\Model\Item;
use Friendica\Network\Probe;
use Friendica\Object\Image;
use Friendica\Util\Lock;
@ -455,12 +456,12 @@ class OStatus
}
if ($item["verb"] == ACTIVITY_FOLLOW) {
new_follower($importer, $contact, $item, $nickname);
Contact::newFollower($importer, $contact, $item, $nickname);
continue;
}
if ($item["verb"] == NAMESPACE_OSTATUS."/unfollow") {
lose_follower($importer, $contact, $item, $dummy);
Contact::loseFollower($importer, $contact, $item, $dummy);
continue;
}
@ -521,12 +522,12 @@ class OStatus
logger("Item with uri ".$item["uri"]." is from a blocked contact.", LOGGER_DEBUG);
} else {
// We are having duplicated entries. Hopefully this solves it.
if (Lock::set('ostatus_process_item_store')) {
$ret = item_store($item);
Lock::remove('ostatus_process_item_store');
if (Lock::set('ostatus_process_item_insert')) {
$ret = Item::insert($item);
Lock::remove('ostatus_process_item_insert');
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"].' stored. Return value: '.$ret);
} else {
$ret = item_store($item);
$ret = Item::insert($item);
logger("We couldn't lock - but tried to store the item anyway. Return value is ".$ret);
}
}
@ -1996,7 +1997,7 @@ class OStatus
XML::addElement($doc, $entry, "ostatus:conversation", $conversation_uri, $attributes);
}
$tags = item_getfeedtags($item);
$tags = item::getFeedTags($item);
if (count($tags)) {
foreach ($tags as $t) {


+ 1
- 1
src/Worker/Delivery.php View File

@ -207,7 +207,7 @@ class Delivery {
logger('notifier: '.$target_item["guid"].' dfrndelivery: '.$contact['name']);
if ($mail) {
$item['body'] = fix_private_photos($item['body'],$owner['uid'],null,$message[0]['contact-id']);
$item['body'] = Item::fixPrivatePhotos($item['body'],$owner['uid'],null,$message[0]['contact-id']);
$atom = DFRN::mail($item, $owner);
} elseif ($fsuggest) {
$atom = DFRN::fsuggest($item, $owner);


+ 2
- 1
src/Worker/Expire.php View File

@ -9,6 +9,7 @@ namespace Friendica\Worker;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Worker;
use Friendica\Model\Item;
use Friendica\Database\DBM;
use dba;
@ -43,7 +44,7 @@ class Expire {
$user = dba::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]);
if (DBM::is_result($user)) {
logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG);
item_expire($user['uid'], $user['expire']);
Item::expire($user['uid'], $user['expire']);
logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - done ', LOGGER_DEBUG);
}
return;


+ 3
- 2
src/Worker/OnePoll.php View File

@ -8,6 +8,7 @@ use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Protocol\Email;
use Friendica\Protocol\PortableContact;
use Friendica\Util\Network;
@ -487,7 +488,7 @@ class OnePoll
continue;
}
$datarray['body'] = escape_tags($r['body']);
$datarray['body'] = limit_body_size($datarray['body']);
$datarray['body'] = Item::limitBodySize($datarray['body']);
logger("Mail: Importing ".$msg_uid." for ".$mailconf['user']);
@ -531,7 +532,7 @@ class OnePoll
$datarray['allow_cid'] = '<' . $contact['id'] . '>';
}
$stored_item = item_store($datarray);
$stored_item = Item::insert($datarray);
switch ($mailconf['action']) {
case 0:


+ 2
- 1
src/Worker/SpoolPost.php View File

@ -5,6 +5,7 @@
*/
namespace Friendica\Worker;
use Friendica\Model\Item;
use Friendica\Core\Config;
require_once("include/items.php");
@ -46,7 +47,7 @@ class SpoolPost {
continue;
}
$result = item_store($arr);
$result = Item::insert($arr);
logger("Spool file ".$file." stored: ".$result, LOGGER_DEBUG);
unlink($fullfile);


Loading…
Cancel
Save