diff options
author | friendica <info@friendica.com> | 2014-10-05 01:09:57 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-10-05 01:09:57 -0700 |
commit | 191ef124cf6f6ec3978eededba13bd13463140a1 (patch) | |
tree | 5a2dc19d5983e9a411563414a4dbd05072214002 /mod | |
parent | 9135ad30d8b964b292777d6671f6fe004462d0ce (diff) | |
download | volse-hubzilla-191ef124cf6f6ec3978eededba13bd13463140a1.tar.gz volse-hubzilla-191ef124cf6f6ec3978eededba13bd13463140a1.tar.bz2 volse-hubzilla-191ef124cf6f6ec3978eededba13bd13463140a1.zip |
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.
Diffstat (limited to 'mod')
-rw-r--r-- | mod/item.php | 25 |
1 files changed, 16 insertions, 9 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'); |