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.

This commit is contained in:
friendica 2014-10-05 01:09:57 -07:00
parent 9135ad30d8
commit 191ef124cf
2 changed files with 17 additions and 10 deletions

View File

@ -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');

View File

@ -1 +1 @@
2014-10-04.818
2014-10-05.819