]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
Preloading of items in the cache when receiving them.
[friendica.git] / mod / item.php
index 8399b796dcd7e048b91bee005a07bf3b009b0e9e..452ec8a36de917d90b8f18b194895793239782b6 100644 (file)
@@ -19,6 +19,7 @@ require_once('include/crypto.php');
 require_once('include/enotify.php');
 require_once('include/email.php');
 require_once('library/langdet/Text/LanguageDetect.php');
+require_once('include/tags.php');
 
 function item_post(&$a) {
 
@@ -685,6 +686,7 @@ function item_post(&$a) {
                        intval($post_id),
                        intval($profile_uid)
                );
+               create_tags_from_itemuri($post_id, $profile_uid);
 
                // update filetags in pconfig
                 file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
@@ -750,10 +752,20 @@ function item_post(&$a) {
        if(count($r)) {
                $post_id = $r[0]['id'];
                logger('mod_item: saved item ' . $post_id);
+               create_tags_from_item($post_id);
 
                // update filetags in pconfig
                 file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
 
+               // Store the fresh generated item into the cache
+               $cachefile = get_cachefile($datarray["guid"]."-".hash("md5", $datarray['body']));
+
+               if (($cachefile != '') AND !file_exists($cachefile)) {
+                       $s = prepare_text($datarray['body']);
+                       file_put_contents($cachefile, $s);
+                       logger('mod_item: put item '.$r[0]['id'].' into cachefile '.$cachefile);
+               }
+
                if($parent) {
 
                        // This item is the last leaf and gets the comment box, clear any ancestors