From 191ef124cf6f6ec3978eededba13bd13463140a1 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 5 Oct 2014 01:09:57 -0700 Subject: add 'nopush' option to the post API so somebody could bulk load a bunch of existing content via the API without invoking the notifier and sending each out as a fresh post. --- mod/item.php | 25 ++++++++++++++++--------- version.inc | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/mod/item.php b/mod/item.php index 7f25b35b8..2364e6abf 100644 --- a/mod/item.php +++ b/mod/item.php @@ -81,18 +81,22 @@ function item_post(&$a) { $layout_mid = ((x($_REQUEST,'layout_mid')) ? escape_tags($_REQUEST['layout_mid']): ''); $plink = ((x($_REQUEST,'permalink')) ? escape_tags($_REQUEST['permalink']) : ''); + // allow API to bulk load a bunch of imported items with sending out a bunch of posts. + $nopush = ((x($_REQUEST,'nopush')) ? intval($_REQUEST['nopush']) : 0); + /* - Check service class limits - */ + * Check service class limits + */ if (local_user() && !(x($_REQUEST,'parent')) && !(x($_REQUEST,'post_id'))) { - $ret=item_check_service_class(local_user(),x($_REQUEST,'webpage')); - if (!$ret['success']) { - notice( t($ret['message']) . EOL) ; - if(x($_REQUEST,'return')) + $ret = item_check_service_class(local_user(),x($_REQUEST,'webpage')); + if (!$ret['success']) { + notice( t($ret['message']) . EOL) ; + if(x($_REQUEST,'return')) goaway($a->get_baseurl() . "/" . $return_path ); killme(); + } } - } + if($pagetitle) { require_once('library/urlify/URLify.php'); $pagetitle = strtolower(URLify::transliterate($pagetitle)); @@ -780,7 +784,9 @@ function item_post(&$a) { update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remote_id,$mid); - proc_run('php', "include/notifier.php", 'edit_post', $post_id); + if(! $nopush) + proc_run('php', "include/notifier.php", 'edit_post', $post_id); + if((x($_REQUEST,'return')) && strlen($return_path)) { logger('return: ' . $return_path); goaway($a->get_baseurl() . "/" . $return_path ); @@ -866,7 +872,8 @@ function item_post(&$a) { call_hooks('post_local_end', $datarray); - proc_run('php', 'include/notifier.php', $notify_type, $post_id); + if(! $nopush) + proc_run('php', 'include/notifier.php', $notify_type, $post_id); logger('post_complete'); diff --git a/version.inc b/version.inc index 712d00b5b..3a7d86ed7 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2014-10-04.818 +2014-10-05.819 -- cgit v1.2.3