import events (not just event posts) from zot
This commit is contained in:
parent
ddd8a0e062
commit
a9f4a47a35
2
boot.php
2
boot.php
@ -16,7 +16,7 @@ require_once('include/features.php');
|
|||||||
define ( 'FRIENDICA_PLATFORM', 'Friendica Red');
|
define ( 'FRIENDICA_PLATFORM', 'Friendica Red');
|
||||||
define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R');
|
define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R');
|
||||||
define ( 'ZOT_REVISION', 1 );
|
define ( 'ZOT_REVISION', 1 );
|
||||||
define ( 'DB_UPDATE_VERSION', 1019 );
|
define ( 'DB_UPDATE_VERSION', 1020 );
|
||||||
|
|
||||||
define ( 'EOL', '<br />' . "\r\n" );
|
define ( 'EOL', '<br />' . "\r\n" );
|
||||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||||
|
@ -209,10 +209,7 @@ function event_store($arr) {
|
|||||||
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
|
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert());
|
||||||
$arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
|
$arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
|
||||||
$arr['event_xchan'] = (($arr['event_xchan']) ? $arr['event_xchan'] : '');
|
$arr['event_xchan'] = (($arr['event_xchan']) ? $arr['event_xchan'] : '');
|
||||||
$arr['message_id'] = (x($arr,'message_id') ? $arr['message_id'] : item_message_id());
|
|
||||||
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0);
|
|
||||||
|
|
||||||
|
|
||||||
// Existing event being modified
|
// Existing event being modified
|
||||||
|
|
||||||
if($arr['id']) {
|
if($arr['id']) {
|
||||||
|
@ -885,13 +885,40 @@ function process_delivery($sender,$arr,$deliveries,$relay) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($arr['item_restrict'] & ITEM_DELETED) {
|
if($arr['item_restrict'] & ITEM_DELETED) {
|
||||||
delete_imported_item($sender,$arr,$channel['channel_id']);
|
delete_imported_item($sender,$arr,$channel['channel_id']);
|
||||||
$result[] = array($d['hash'],'deleted');
|
$result[] = array($d['hash'],'deleted');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for events, extract the event info and create and event linked to an item
|
||||||
|
|
||||||
|
if((x($arr,'obj_type')) && (activity_compare($arr['obj_type'],ACTIVITY_OBJ_EVENT))) {
|
||||||
|
require_once('include/event.php');
|
||||||
|
$ev = bbtoevent($arr['body']);
|
||||||
|
if(x($ev,'desc') && x($ev,'start')) {
|
||||||
|
$ev['event_xchan'] = $arr['author_xchan'];
|
||||||
|
$ev['uid'] = $channel['channel_id'];
|
||||||
|
$ev['account'] = $channel['channel_account_id'];
|
||||||
|
$ev['edited'] = $arr['edited'];
|
||||||
|
|
||||||
|
// is this an edit?
|
||||||
|
|
||||||
|
$r = q("SELECT * FROM event left join item on resource_id = event_hash WHERE resource_type = 'event' and
|
||||||
|
`uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
|
dbesc($arr['uri']),
|
||||||
|
intval($importer['uid'])
|
||||||
|
);
|
||||||
|
if($r)
|
||||||
|
$ev['event_hash'] = $r[0]['event_hash'];
|
||||||
|
$xyz = event_store($ev);
|
||||||
|
$result = array($d['hash'],'event processed');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$r = q("select id, edited from item where uri = '%s' and uid = %d limit 1",
|
$r = q("select id, edited from item where uri = '%s' and uid = %d limit 1",
|
||||||
dbesc($arr['uri']),
|
dbesc($arr['uri']),
|
||||||
intval($channel['channel_id'])
|
intval($channel['channel_id'])
|
||||||
|
@ -224,7 +224,6 @@ CREATE TABLE IF NOT EXISTS `event` (
|
|||||||
`uid` int(11) NOT NULL,
|
`uid` int(11) NOT NULL,
|
||||||
`event_xchan` char(255) NOT NULL DEFAULT '',
|
`event_xchan` char(255) NOT NULL DEFAULT '',
|
||||||
`event_hash` char(255) NOT NULL DEFAULT '',
|
`event_hash` char(255) NOT NULL DEFAULT '',
|
||||||
`message_id` char(255) NOT NULL,
|
|
||||||
`created` datetime NOT NULL,
|
`created` datetime NOT NULL,
|
||||||
`edited` datetime NOT NULL,
|
`edited` datetime NOT NULL,
|
||||||
`start` datetime NOT NULL,
|
`start` datetime NOT NULL,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1019 );
|
define( 'UPDATE_VERSION' , 1020 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -279,3 +279,9 @@ ADD INDEX ( `event_hash` )");
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function update_r1019() {
|
||||||
|
$r = q"ALTER TABLE `event` DROP `message_id` ");
|
||||||
|
if($r)
|
||||||
|
return UPDATE_SUCCESS;
|
||||||
|
return UPDATE_FAILED;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user