aboutsummaryrefslogtreecommitdiffstats
path: root/mod/import_items.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-09-07 18:14:30 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-09-07 18:14:30 -0700
commit6d1b64065aa1f44e2b9d864ddba97891ca85d1e5 (patch)
treebfc5961a5391cb8bd43ca7071e45c344f510992c /mod/import_items.php
parent2f52b6c164a76435a957ad6a0562a55ae0becc2a (diff)
downloadvolse-hubzilla-6d1b64065aa1f44e2b9d864ddba97891ca85d1e5.tar.gz
volse-hubzilla-6d1b64065aa1f44e2b9d864ddba97891ca85d1e5.tar.bz2
volse-hubzilla-6d1b64065aa1f44e2b9d864ddba97891ca85d1e5.zip
consolidate import_items/sync_items
Diffstat (limited to 'mod/import_items.php')
-rw-r--r--mod/import_items.php49
1 files changed, 3 insertions, 46 deletions
diff --git a/mod/import_items.php b/mod/import_items.php
index 1e54c0deb..6b97939c9 100644
--- a/mod/import_items.php
+++ b/mod/import_items.php
@@ -1,5 +1,6 @@
<?php
+require_once('include/import.php');
function import_items_post(&$a) {
@@ -88,57 +89,13 @@ function import_items_post(&$a) {
$saved_notification_flags = notifications_off($channel['channel_id']);
if(array_key_exists('item',$data) && $data['item']) {
-
- foreach($data['item'] as $i) {
- $item = get_item_elements($i);
-
- $r = q("select id, edited from item where mid = '%s' and uid = %d limit 1",
- dbesc($item['mid']),
- intval($channel['channel_id'])
- );
- if($r) {
- if($item['edited'] > $r[0]['edited']) {
- $item['id'] = $r[0]['id'];
- $item['uid'] = $channel['channel_id'];
- item_store_update($item);
- continue;
- }
- }
- else {
- $item['aid'] = $channel['channel_account_id'];
- $item['uid'] = $channel['channel_id'];
- $item_result = item_store($item);
- }
-
- }
-
+ import_items($channel,$data['item']);
}
notifications_on($channel['channel_id'],$saved_notification_flags);
if(array_key_exists('item_id',$data) && $data['item_id']) {
- foreach($data['item_id'] as $i) {
- $r = q("select id from item where mid = '%s' and uid = %d limit 1",
- dbesc($i['mid']),
- intval($channel['channel_id'])
- );
- if(! $r)
- continue;
- $z = q("select * from item_id where service = '%s' and sid = '%s' and iid = %d and uid = %d limit 1",
- dbesc($i['service']),
- dbesc($i['sid']),
- intval($r[0]['id']),
- intval($channel['channel_id'])
- );
- if(! $z) {
- q("insert into item_id (iid,uid,sid,service) values(%d,%d,'%s','%s')",
- intval($r[0]['id']),
- intval($channel['channel_id']),
- dbesc($i['sid']),
- dbesc($i['service'])
- );
- }
- }
+ import_item_ids($channel,$data['item_id']);
}
info( t('Import completed') . EOL);