From eac4bc196083d3680b8a40781afb0074127fcfd2 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 9 Jan 2018 20:03:00 +0000 Subject: [PATCH 1/6] We now are using a single function to store items --- mod/item.php | 242 ++++++++++++--------------------------------------- 1 file changed, 57 insertions(+), 185 deletions(-) diff --git a/mod/item.php b/mod/item.php index 1053919b7..d0524266d 100644 --- a/mod/item.php +++ b/mod/item.php @@ -58,12 +58,12 @@ function item_post(App $a) { // logger('postinput ' . file_get_contents('php://input')); logger('postvars ' . print_r($_REQUEST,true), LOGGER_DATA); - $api_source = ((x($_REQUEST, 'api_source') && $_REQUEST['api_source']) ? true : false); + $api_source = x($_REQUEST, 'api_source') && $_REQUEST['api_source']; $message_id = ((x($_REQUEST, 'message_id') && $api_source) ? strip_tags($_REQUEST['message_id']) : ''); - $return_path = ((x($_REQUEST, 'return')) ? $_REQUEST['return'] : ''); - $preview = ((x($_REQUEST, 'preview')) ? intval($_REQUEST['preview']) : 0); + $return_path = (x($_REQUEST, 'return') ? $_REQUEST['return'] : ''); + $preview = (x($_REQUEST, 'preview') ? intval($_REQUEST['preview']) : 0); /* * Check for doubly-submitted posts, and reject duplicates @@ -94,7 +94,7 @@ function item_post(App $a) { $objecttype = ACTIVITY_OBJ_COMMENT; - if (! x($_REQUEST, 'type')) { + if (!x($_REQUEST, 'type')) { $_REQUEST['type'] = 'net-comment'; } @@ -122,7 +122,7 @@ function item_post(App $a) { } if (!DBM::is_result($r)) { - notice( t('Unable to locate original post.') . EOL); + notice(t('Unable to locate original post.') . EOL); if (x($_REQUEST, 'return')) { goaway($return_path); } @@ -175,11 +175,11 @@ function item_post(App $a) { logger('mod_item: item_post parent=' . $parent); } - $profile_uid = ((x($_REQUEST, 'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0); - $post_id = ((x($_REQUEST, 'post_id')) ? intval($_REQUEST['post_id']) : 0); - $app = ((x($_REQUEST, 'source')) ? strip_tags($_REQUEST['source']) : ''); - $extid = ((x($_REQUEST, 'extid')) ? strip_tags($_REQUEST['extid']) : ''); - $object = ((x($_REQUEST, 'object')) ? $_REQUEST['object'] : ''); + $profile_uid = (x($_REQUEST, 'profile_uid') ? intval($_REQUEST['profile_uid']) : 0); + $post_id = (x($_REQUEST, 'post_id') ? intval($_REQUEST['post_id']) : 0); + $app = (x($_REQUEST, 'source') ? strip_tags($_REQUEST['source']) : ''); + $extid = (x($_REQUEST, 'extid') ? strip_tags($_REQUEST['extid']) : ''); + $object = (x($_REQUEST, 'object') ? $_REQUEST['object'] : ''); // Check for multiple posts with the same message id (when the post was created via API) if (($message_id != '') && ($profile_uid != 0)) { @@ -233,7 +233,7 @@ function item_post(App $a) { intval($profile_uid), intval($post_id) ); - if (! DBM::is_result($i)) { + if (!DBM::is_result($i)) { killme(); } $orig_post = $i[0]; @@ -277,10 +277,10 @@ function item_post(App $a) { */ /// @TODO use x($_REQUEST, 'foo') here if (($api_source) - && (! array_key_exists('contact_allow', $_REQUEST)) - && (! array_key_exists('group_allow', $_REQUEST)) - && (! array_key_exists('contact_deny', $_REQUEST)) - && (! array_key_exists('group_deny', $_REQUEST))) { + && !array_key_exists('contact_allow', $_REQUEST) + && !array_key_exists('group_allow', $_REQUEST) + && !array_key_exists('contact_deny', $_REQUEST) + && !array_key_exists('group_deny', $_REQUEST)) { $str_group_allow = $user['allow_gid']; $str_contact_allow = $user['allow_cid']; $str_group_deny = $user['deny_gid']; @@ -331,13 +331,13 @@ function item_post(App $a) { $private = $parent_item['private']; } - $pubmail_enable = ((x($_REQUEST, 'pubmail_enable') && intval($_REQUEST['pubmail_enable']) && (! $private)) ? 1 : 0); + $pubmail_enable = ((x($_REQUEST, 'pubmail_enable') && intval($_REQUEST['pubmail_enable']) && !$private) ? 1 : 0); // if using the API, we won't see pubmail_enable - figure out if it should be set - if ($api_source && $profile_uid && $profile_uid == local_user() && (! $private)) { - $mail_disabled = ((function_exists('imap_open') && (! Config::get('system', 'imap_disabled'))) ? 0 : 1); - if (! $mail_disabled) { + if ($api_source && $profile_uid && $profile_uid == local_user() && !$private) { + $mail_disabled = ((function_exists('imap_open') && !Config::get('system', 'imap_disabled')) ? 0 : 1); + if (!$mail_disabled) { /// @TODO Check if only pubmail is loaded, * loads all columns $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval(local_user()) @@ -348,11 +348,11 @@ function item_post(App $a) { } } - if (! strlen($body)) { + if (!strlen($body)) { if ($preview) { killme(); } - info(t('Empty post discarded.') . EOL ); + info(t('Empty post discarded.') . EOL); if (x($_REQUEST, 'return')) { goaway($return_path); } @@ -496,7 +496,7 @@ function item_post(App $a) { continue; } - $success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network); + $success = handle_tag($a, $body, $inform, $str_tags, local_user() ? local_user() : $profile_uid, $tag, $network); if ($success['replaced']) { $tagged[] = $tag; } @@ -571,7 +571,7 @@ function item_post(App $a) { intval($profile_uid) ); - if (! DBM::is_result($r)) { + if (!DBM::is_result($r)) { continue; } @@ -595,7 +595,7 @@ function item_post(App $a) { */ $match = false; - if ((! $preview) && preg_match_all("/\[attachment\](.*?)\[\/attachment\]/", $body, $match)) { + if (!$preview && preg_match_all("/\[attachment\](.*?)\[\/attachment\]/", $body, $match)) { $attaches = $match[1]; if (count($attaches)) { foreach ($attaches as $attach) { @@ -676,24 +676,24 @@ function item_post(App $a) { $wall = 1; } - if (! strlen($verb)) { - $verb = ACTIVITY_POST ; + if (!strlen($verb)) { + $verb = ACTIVITY_POST; } if ($network == "") { $network = NETWORK_DFRN; } - $gravity = (($parent) ? 6 : 0 ); + $gravity = ($parent ? 6 : 0); // even if the post arrived via API we are considering that it // originated on this site by default for determining relayability. - $origin = ((x($_REQUEST, 'origin')) ? intval($_REQUEST['origin']) : 1); + $origin = (x($_REQUEST, 'origin') ? intval($_REQUEST['origin']) : 1); - $notify_type = (($parent) ? 'comment-new' : 'wall-new' ); + $notify_type = ($parent ? 'comment-new' : 'wall-new'); - $uri = (($message_id) ? $message_id : item_new_uri($a->get_hostname(),$profile_uid, $guid)); + $uri = ($message_id ? $message_id : item_new_uri($a->get_hostname(),$profile_uid, $guid)); // Fallback so that we alway have a thr-parent if (!$thr_parent) { @@ -756,7 +756,6 @@ function item_post(App $a) { */ $datarray['parent'] = $parent; $datarray['self'] = $self; -// $datarray['prvnets'] = $user['prvnets']; // This triggers posts via API and the mirror functions $datarray['api_source'] = $api_source; @@ -819,20 +818,23 @@ function item_post(App $a) { $datarray = store_conversation($datarray); + unset($datarray['edit']); + unset($datarray['self']); + unset($datarray['api_source']); + if ($orig_post) { - $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d", - dbesc($datarray['title']), - dbesc($datarray['body']), - dbesc($datarray['tag']), - dbesc($datarray['attach']), - dbesc($datarray['file']), - dbesc($datarray['rendered-html']), - dbesc($datarray['rendered-hash']), - dbesc(datetime_convert()), - dbesc(datetime_convert()), - intval($post_id), - intval($profile_uid) - ); + $fields = array( + 'title' => $datarray['title'], + 'body' => $datarray['body'], + 'tag' => $datarray['tag'], + 'attach' => $datarray['attach'], + 'file' => $datarray['file'], + 'rendered-html' => $datarray['rendered-html'], + 'rendered-hash' => $datarray['rendered-hash'], + 'edited' => datetime_convert(), + 'changed' => datetime_convert()); + + dba::update('item', $fields, ['id' => $post_id]); create_tags_from_item($post_id); create_files_from_item($post_id); @@ -842,7 +844,7 @@ function item_post(App $a) { file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); Worker::add(PRIORITY_HIGH, "Notifier", 'edit_post', $post_id); - if ((x($_REQUEST, 'return')) && strlen($return_path)) { + if (x($_REQUEST, 'return') && strlen($return_path)) { logger('return: ' . $return_path); goaway($return_path); } @@ -851,123 +853,15 @@ function item_post(App $a) { $post_id = 0; } - dba::transaction(); - - $r = q("INSERT INTO `item` (`guid`, `extid`, `uid`,`type`,`wall`,`gravity`, `network`, `contact-id`, - `owner-name`,`owner-link`,`owner-avatar`, `owner-id`, - `author-name`, `author-link`, `author-avatar`, `author-id`, - `created`, `edited`, `commented`, `received`, `changed`, - `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`, - `tag`, `inform`, `verb`, `object-type`, `postopts`, - `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, - `pubmail`, `attach`, `bookmark`,`origin`, `moderated`, `file`, - `rendered-html`, `rendered-hash`, `gcontact-id`, `object`, - `parent`, `parent-uri`, `plink`, `last-child`, `visible`) - VALUES('%s', '%s', %d, '%s', %d, %d, '%s', %d, - '%s', '%s', '%s', %d, - '%s', '%s', '%s', %d, - '%s', '%s', '%s', '%s', '%s', - '%s', '%s', '%s', '%s', '%s', '%s', '%s', - '%s', '%s', '%s', '%s', '%s', - '%s', '%s', '%s', '%s', %d, - %d, '%s', %d, %d, %d, '%s', - '%s', '%s', %d, '%s', - %d, '%s', '%s', %d, %d)", - dbesc($datarray['guid']), - dbesc($datarray['extid']), - intval($datarray['uid']), - dbesc($datarray['type']), - intval($datarray['wall']), - intval($datarray['gravity']), - dbesc($datarray['network']), - intval($datarray['contact-id']), - dbesc($datarray['owner-name']), - dbesc($datarray['owner-link']), - dbesc($datarray['owner-avatar']), - intval($datarray['owner-id']), - dbesc($datarray['author-name']), - dbesc($datarray['author-link']), - dbesc($datarray['author-avatar']), - intval($datarray['author-id']), - dbesc($datarray['created']), - dbesc($datarray['edited']), - dbesc($datarray['commented']), - dbesc($datarray['received']), - dbesc($datarray['changed']), - dbesc($datarray['uri']), - dbesc($datarray['thr-parent']), - dbesc($datarray['title']), - dbesc($datarray['body']), - dbesc($datarray['app']), - dbesc($datarray['location']), - dbesc($datarray['coord']), - dbesc($datarray['tag']), - dbesc($datarray['inform']), - dbesc($datarray['verb']), - dbesc($datarray['object-type']), - dbesc($datarray['postopts']), - dbesc($datarray['allow_cid']), - dbesc($datarray['allow_gid']), - dbesc($datarray['deny_cid']), - dbesc($datarray['deny_gid']), - intval($datarray['private']), - intval($datarray['pubmail']), - dbesc($datarray['attach']), - intval($datarray['bookmark']), - intval($datarray['origin']), - intval($datarray['moderated']), - dbesc($datarray['file']), - dbesc($datarray['rendered-html']), - dbesc($datarray['rendered-hash']), - intval($datarray['gcontact-id']), - dbesc($datarray['object']), - intval($datarray['parent']), - dbesc($datarray['parent-uri']), - dbesc($datarray['plink']), - intval($datarray['last-child']), - intval($datarray['visible']) - ); - - if (DBM::is_result($r)) { - $post_id = dba::lastInsertId(); - } else { - logger('mod_item: unable to create post.'); - $post_id = 0; - } - - if ($post_id == 0) { - dba::commit(); - logger('mod_item: unable to retrieve post that was just stored.'); - notice(t('System error. Post not saved.') . EOL); - goaway($return_path); - // NOTREACHED - } - - logger('mod_item: saved item ' . $post_id); + $post_id = item_store($datarray); $datarray["id"] = $post_id; - item_set_last_item($datarray); - // update filetags in pconfig - file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); + file_tag_update_pconfig($uid, $categories_old, $categories_new, 'category'); + // These notifications are sent if someone else is commenting other your wall if ($parent) { - - // This item is the last leaf and gets the comment box, clear any ancestors - $r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent` = %d AND `last-child` AND `id` != %d", - dbesc(datetime_convert()), - intval($parent), - intval($post_id) - ); - - // update the commented timestamp on the parent - q("UPDATE `item` SET `visible` = 1, `commented` = '%s', `changed` = '%s' WHERE `id` = %d", - dbesc(datetime_convert()), - dbesc(datetime_convert()), - intval($parent) - ); - if ($contact_record != $author) { notification(array( 'type' => NOTIFY_COMMENT, @@ -986,20 +880,11 @@ function item_post(App $a) { 'parent' => $parent, 'parent_uri' => $parent_item['uri'] )); - } - // Store the comment signature information in case we need to relay to Diaspora Diaspora::storeCommentSignature($datarray, $author, ($self ? $user['prvkey'] : false), $post_id); - } else { - $parent = $post_id; - - $r = q("UPDATE `item` SET `parent` = %d WHERE `id` = %d", - intval($parent), - intval($post_id)); - if (($contact_record != $author) && !count($forum_contact)) { notification(array( 'type' => NOTIFY_WALL, @@ -1026,17 +911,17 @@ function item_post(App $a) { if (count($erecips)) { foreach ($erecips as $recip) { $addr = trim($recip); - if (! strlen($addr)) { + if (!strlen($addr)) { continue; } - $disclaimer = '
' . sprintf( t('This message was sent to you by %s, a member of the Friendica social network.'), $a->user['username']) + $disclaimer = '
' . sprintf(t('This message was sent to you by %s, a member of the Friendica social network.'), $a->user['username']) . '
'; - $disclaimer .= sprintf( t('You may visit them online at %s'), System::baseUrl() . '/profile/' . $a->user['nickname']) . EOL; + $disclaimer .= sprintf(t('You may visit them online at %s'), System::baseUrl() . '/profile/' . $a->user['nickname']) . EOL; $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL; if (!$datarray['title']=='') { $subject = Email::encodeHeader($datarray['title'], 'UTF-8'); } else { - $subject = Email::encodeHeader('[Friendica]' . ' ' . sprintf( t('%s posted an update.'), $a->user['username']), 'UTF-8'); + $subject = Email::encodeHeader('[Friendica]' . ' ' . sprintf(t('%s posted an update.'), $a->user['username']), 'UTF-8'); } $link = '' . $a->user['username'] . '

'; $html = prepare_body($datarray); @@ -1056,19 +941,6 @@ function item_post(App $a) { } } - if ($post_id == $parent) { - add_thread($post_id); - } else { - update_thread($parent, true); - } - - dba::commit(); - - create_tags_from_item($post_id); - create_files_from_item($post_id); - - check_user_notification($post_id); - // Insert an item entry for UID=0 for global entries. // We now do it in the background to save some time. // This is important in interactive environments like the frontend or the API. @@ -1110,7 +982,7 @@ function item_post_return($baseurl, $api_source, $return_path) { function item_content(App $a) { - if ((! local_user()) && (! remote_user())) { + if (!local_user() && !remote_user()) { return; } @@ -1329,7 +1201,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n $newtag = $tag_type.'[url=' . $profile . ']' . $newname . '[/url]'; $body = str_replace($tag_type . $name, $newtag, $body); // append tag to str_tags - if (! stristr($str_tags, $newtag)) { + if (!stristr($str_tags, $newtag)) { if (strlen($str_tags)) { $str_tags .= ','; } @@ -1342,7 +1214,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n */ if (strlen($alias)) { $newtag = '@[url=' . $alias . ']' . $newname . '[/url]'; - if (! stristr($str_tags, $newtag)) { + if (!stristr($str_tags, $newtag)) { if (strlen($str_tags)) { $str_tags .= ','; } From ec879f3194f343534c00f0ec7e41d5398c59a9c1 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 9 Jan 2018 20:50:06 +0000 Subject: [PATCH 2/6] Removed unneeded stuff --- mod/item.php | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/mod/item.php b/mod/item.php index d0524266d..8426c2d2b 100644 --- a/mod/item.php +++ b/mod/item.php @@ -13,9 +13,6 @@ * * All of these become an "item" which is our basic unit of * information. - * - * Posts that originate externally or do not fall into the above - * posting categories go through item_store() instead of this function. */ use Friendica\App; use Friendica\Core\Config; @@ -37,7 +34,6 @@ require_once 'include/text.php'; require_once 'include/items.php'; function item_post(App $a) { - if (!local_user() && !remote_user() && !x($_REQUEST, 'commenter')) { return; } @@ -132,7 +128,6 @@ function item_post(App $a) { $parent = $r[0]['id']; // multi-level threading - preserve the info but re-parent to our single level threading - //if(($parid) && ($parid != $parent)) $thr_parent = $parent_uri; if ($parent_item['contact-id'] && $uid) { @@ -276,7 +271,7 @@ function item_post(App $a) { * been supplied via a form. */ /// @TODO use x($_REQUEST, 'foo') here - if (($api_source) + if ($api_source && !array_key_exists('contact_allow', $_REQUEST) && !array_key_exists('group_allow', $_REQUEST) && !array_key_exists('contact_deny', $_REQUEST) @@ -485,7 +480,7 @@ function item_post(App $a) { * Robert Johnson should be first in the $tags array */ $fullnametagged = false; - /// @TODO $tagged is initialized above if() block and is not filled, maybe old-lost code? + /// @TODO $tagged is initialized above if () block and is not filled, maybe old-lost code? foreach ($tagged as $nextTag) { if (stristr($nextTag, $tag . ' ')) { $fullnametagged = true; @@ -813,15 +808,6 @@ function item_post(App $a) { killme(); } - // Fill the cache field - put_item_in_cache($datarray); - - $datarray = store_conversation($datarray); - - unset($datarray['edit']); - unset($datarray['self']); - unset($datarray['api_source']); - if ($orig_post) { $fields = array( 'title' => $datarray['title'], @@ -853,6 +839,10 @@ function item_post(App $a) { $post_id = 0; } + unset($datarray['edit']); + unset($datarray['self']); + unset($datarray['api_source']); + $post_id = item_store($datarray); $datarray["id"] = $post_id; @@ -1138,7 +1128,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } // select someone by attag or nick and the name passed in the current network - if(!DBM::is_result($r) && ($network != "")) + if (!DBM::is_result($r) && ($network != "")) $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `network` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1", dbesc($name), dbesc($name), @@ -1156,7 +1146,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } // select someone by attag or nick and the name passed in - if(!DBM::is_result($r)) { + if (!DBM::is_result($r)) { $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1", dbesc($name), dbesc($name), @@ -1165,7 +1155,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } // select someone from this user's contacts by name - if(!DBM::is_result($r)) { + if (!DBM::is_result($r)) { $r = q("SELECT `id`, `url`, `nick`, `name`, `alias`, `network` FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", dbesc($name), intval($profile_uid) From 81925e37300e666d0b7efef997f9177b5e4fdfd4 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 9 Jan 2018 21:13:45 +0000 Subject: [PATCH 3/6] We now are having an item class and a method to change item entries --- mod/item.php | 8 ++----- src/Model/Item.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 src/Model/Item.php diff --git a/mod/item.php b/mod/item.php index 8426c2d2b..5d9ca8199 100644 --- a/mod/item.php +++ b/mod/item.php @@ -21,6 +21,7 @@ use Friendica\Core\Worker; use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; +use Friendica\Model\Item; use Friendica\Network\Probe; use Friendica\Protocol\Diaspora; use Friendica\Protocol\Email; @@ -820,16 +821,11 @@ function item_post(App $a) { 'edited' => datetime_convert(), 'changed' => datetime_convert()); - dba::update('item', $fields, ['id' => $post_id]); - - create_tags_from_item($post_id); - create_files_from_item($post_id); - update_thread($post_id); + Item::update($fields, ['id' => $post_id]); // update filetags in pconfig file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); - Worker::add(PRIORITY_HIGH, "Notifier", 'edit_post', $post_id); if (x($_REQUEST, 'return') && strlen($return_path)) { logger('return: ' . $return_path); goaway($return_path); diff --git a/src/Model/Item.php b/src/Model/Item.php new file mode 100644 index 000000000..c65e8f1aa --- /dev/null +++ b/src/Model/Item.php @@ -0,0 +1,56 @@ + Date: Tue, 9 Jan 2018 22:16:16 +0000 Subject: [PATCH 4/6] Return the number of affected rows --- src/Model/Item.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index c65e8f1aa..49cb499c3 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -21,7 +21,12 @@ class Item * @param array $fields The fields that are to be changed * @param array $condition The condition for finding the item entries * - * @return boolean success + * In the future we may have to change permissions as well. + * Then we had to add the user id as third parameter. + * + * A return value of "0" doesn't mean an error - but that 0 rows had been changed. + * + * @return integer|boolean number of affected rows - or "false" if there was an error */ public static function update(array $fields, array $condition) { @@ -35,6 +40,8 @@ class Item return false; } + $rows = dba::affected_rows(); + // We cannot simply expand the condition to check for origin entries // The condition needn't to be a simple array but could be a complex condition. $items = dba::select('item', ['id', 'origin'], $condition); @@ -51,6 +58,6 @@ class Item Worker::add(PRIORITY_HIGH, "Notifier", 'edit_post', $item['id']); } - return true; + return $rows; } } From 8060ad265e6f1ac90462c1f119944e841f5127b5 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 9 Jan 2018 22:35:50 +0000 Subject: [PATCH 5/6] Fill the cache fields as well --- mod/item.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mod/item.php b/mod/item.php index 5d9ca8199..fd6af802b 100644 --- a/mod/item.php +++ b/mod/item.php @@ -810,6 +810,11 @@ function item_post(App $a) { } if ($orig_post) { + + // Fill the cache field + // This could be done in Item::update as well - but we hasd to check for the existance of some fields. + put_item_in_cache($datarray); + $fields = array( 'title' => $datarray['title'], 'body' => $datarray['body'], From 1549b1d8c18b8186efd496aad8a54b95f730f127 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 10 Jan 2018 06:58:20 +0000 Subject: [PATCH 6/6] Typo --- mod/item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/item.php b/mod/item.php index fd6af802b..868ed54ad 100644 --- a/mod/item.php +++ b/mod/item.php @@ -812,7 +812,7 @@ function item_post(App $a) { if ($orig_post) { // Fill the cache field - // This could be done in Item::update as well - but we hasd to check for the existance of some fields. + // This could be done in Item::update as well - but we have to check for the existance of some fields. put_item_in_cache($datarray); $fields = array(