Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
d7c9f2ccba
2
boot.php
2
boot.php
@ -50,7 +50,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
|
||||
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'H');
|
||||
define ( 'ZOT_REVISION', 1 );
|
||||
|
||||
define ( 'DB_UPDATE_VERSION', 1153 );
|
||||
define ( 'DB_UPDATE_VERSION', 1154 );
|
||||
|
||||
/**
|
||||
* @brief Constant with a HTML line break.
|
||||
|
@ -286,6 +286,7 @@ class Item extends BaseObject {
|
||||
'body' => $body,
|
||||
'text' => strip_tags($body),
|
||||
'id' => $this->get_id(),
|
||||
'mid' => $item['mid'],
|
||||
'isevent' => $isevent,
|
||||
'attend' => $attend,
|
||||
'consensus' => $consensus,
|
||||
@ -301,6 +302,7 @@ class Item extends BaseObject {
|
||||
'vwall' => t('via Wall-To-Wall:'),
|
||||
'profile_url' => $profile_link,
|
||||
'item_photo_menu' => item_photo_menu($item),
|
||||
'dreport' => t('Delivery Report'),
|
||||
'name' => $profile_name,
|
||||
'thumb' => $profile_avatar,
|
||||
'osparkle' => $osparkle,
|
||||
|
@ -15,7 +15,10 @@ function deliver_run($argv, $argc) {
|
||||
|
||||
logger('deliver: invoked: ' . print_r($argv,true), LOGGER_DATA);
|
||||
|
||||
|
||||
for($x = 1; $x < $argc; $x ++) {
|
||||
|
||||
$dresult = null;
|
||||
$r = q("select * from outq where outq_hash = '%s' limit 1",
|
||||
dbesc($argv[$x])
|
||||
);
|
||||
@ -98,11 +101,29 @@ function deliver_run($argv, $argc) {
|
||||
}
|
||||
else {
|
||||
$msg = array('body' => json_encode(array('success' => true, 'pickup' => array(array('notify' => $notify,'message' => $m)))));
|
||||
zot_import($msg,z_root());
|
||||
$dresult = zot_import($msg,z_root());
|
||||
}
|
||||
$r = q("delete from outq where outq_hash = '%s'",
|
||||
dbesc($argv[$x])
|
||||
);
|
||||
if($dresult && is_array($dresult)) {
|
||||
foreach($dresult as $xx) {
|
||||
if(is_array($xx) && array_key_exists('message_id',$xx)) {
|
||||
q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_result, dreport_time, dreport_xchan ) values ( '%s', '%s','%s','%s','%s','%s' ) ",
|
||||
dbesc($xx['message_id']),
|
||||
dbesc($xx['location']),
|
||||
dbesc($xx['recipient']),
|
||||
dbesc($xx['status']),
|
||||
dbesc(datetime_convert($xx['date'])),
|
||||
dbesc($xx['sender'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
q("delete from dreport where dreport_queue = '%s' limit 1",
|
||||
dbesc($argv[$x])
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -662,6 +662,18 @@ function notifier_run($argv, $argc){
|
||||
dbesc($n),
|
||||
dbesc(json_encode($encoded_item))
|
||||
);
|
||||
// only create delivery reports for normal undeleted items
|
||||
if(array_key_exists('postopts',$target_item) && (! $target_item['item_deleted'])) {
|
||||
q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_result, dreport_time, dreport_xchan, dreport_queue ) values ( '%s','%s','%s','%s','%s','%s','%s' ) ",
|
||||
dbesc($target_item['mid']),
|
||||
dbesc($hub['hubloc_host']),
|
||||
dbesc($hub['hubloc_host']),
|
||||
dbesc('queued'),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($channel['channel_hash']),
|
||||
dbesc($hash)
|
||||
);
|
||||
}
|
||||
}
|
||||
$deliver[] = $hash;
|
||||
|
||||
|
@ -201,6 +201,17 @@ function poller_run($argv, $argc){
|
||||
db_utcnow(), db_quoteinterval('30 DAY')
|
||||
);
|
||||
|
||||
// expire old delivery reports
|
||||
|
||||
$keep_reports = intval(get_config('system','expire_delivery_reports'));
|
||||
if($keep_reports === 0)
|
||||
$keep_reports = 30;
|
||||
|
||||
q("delete from dreport where dreport_time < %s - INTERVAL %s",
|
||||
db_utcnow(),
|
||||
db_quoteinterval($keep_reports . ' DAY')
|
||||
);
|
||||
|
||||
// expire any expired accounts
|
||||
downgrade_accounts();
|
||||
|
||||
|
@ -957,7 +957,7 @@ function zot_process_response($hub, $arr, $outq) {
|
||||
logger('zot_process_response: headers: ' . print_r($arr['header'],true), LOGGER_DATA);
|
||||
}
|
||||
|
||||
if(array_key_exists('delivery_report',$x)) {
|
||||
if(is_array($x) && array_key_exists('delivery_report',$x) && is_array($x['delivery_report'])) {
|
||||
foreach($x['delivery_report'] as $xx) {
|
||||
if(is_array($xx) && array_key_exists('message_id',$xx)) {
|
||||
q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_result, dreport_time, dreport_xchan ) values ( '%s', '%s','%s','%s','%s','%s' ) ",
|
||||
@ -972,6 +972,10 @@ function zot_process_response($hub, $arr, $outq) {
|
||||
}
|
||||
}
|
||||
|
||||
q("delete from dreport where dreport_queue = '%s' limit 1",
|
||||
dbesc($outq['outq_hash'])
|
||||
);
|
||||
|
||||
// update the timestamp for this site
|
||||
|
||||
q("update site set site_dead = 0, site_update = '%s' where site_url = '%s'",
|
||||
@ -1579,6 +1583,14 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
|
||||
$DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>');
|
||||
|
||||
|
||||
// uncomment this once we find out what's stopping the clone sync of the item from working
|
||||
// if($d['hash'] === $sender['hash']) {
|
||||
// $DR->update('self delivery ignored');
|
||||
// $result[] = $DR->get();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
|
||||
// allow public postings to the sys channel regardless of permissions, but not
|
||||
// for comments travelling upstream. Wait and catch them on the way down.
|
||||
// They may have been blocked by the owner.
|
||||
|
@ -359,11 +359,13 @@ CREATE TABLE IF NOT EXISTS `dreport` (
|
||||
`dreport_result` char(255) NOT NULL DEFAULT '',
|
||||
`dreport_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`dreport_xchan` char(255) NOT NULL DEFAULT '',
|
||||
`dreport_queue` char(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`dreport_id`),
|
||||
KEY `dreport_mid` (`dreport_mid`),
|
||||
KEY `dreport_site` (`dreport_site`),
|
||||
KEY `dreport_time` (`dreport_time`),
|
||||
KEY `dreport_xchan` (`dreport_xchan`),
|
||||
KEY `dreport_queue` (`dreport_queue`),
|
||||
KEY `dreport_channel` (`dreport_channel`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -350,6 +350,7 @@ CREATE TABLE IF NOT EXISTS "dreport" (
|
||||
"dreport_result" char(255) NOT NULL DEFAULT '',
|
||||
"dreport_time" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||
"dreport_xchan" char(255) NOT NULL DEFAULT '',
|
||||
"dreport_queue" char(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY ("dreport_id")
|
||||
);
|
||||
|
||||
@ -357,6 +358,7 @@ create index "dreport_mid" on dreport ("dreport_mid");
|
||||
create index "dreport_site" on dreport ("dreport_site");
|
||||
create index "dreport_time" on dreport ("dreport_time");
|
||||
create index "dreport_xchan" on dreport ("dreport_xchan");
|
||||
create index "dreport_queue" on dreport ("dreport_queue");
|
||||
create index "dreport_channel" on dreport ("dreport_channel");
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
define( 'UPDATE_VERSION' , 1153 );
|
||||
define( 'UPDATE_VERSION' , 1154 );
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1854,3 +1854,14 @@ function update_r1152() {
|
||||
return UPDATE_FAILED;
|
||||
|
||||
}
|
||||
|
||||
function update_r1153() {
|
||||
|
||||
$r1 = q("ALTER TABLE dreport ADD dreport_queue CHAR( 255 ) NOT NULL DEFAULT '' ");
|
||||
$r2 = q("create index dreport_queue on dreport ( dreport_queue) ");
|
||||
if($r1 && $r2)
|
||||
return UPDATE_SUCCESS;
|
||||
return UPDATE_FAILED;
|
||||
|
||||
|
||||
}
|
||||
|
43
mod/dreport.php
Normal file
43
mod/dreport.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
function dreport_content(&$a) {
|
||||
|
||||
if(! local_channel()) {
|
||||
notice( t('Permission denied') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
$channel = $a->get_channel();
|
||||
|
||||
$mid = ((argc() > 1) ? argv(1) : '');
|
||||
|
||||
if(! $mid) {
|
||||
notice( t('Invalid message') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
$r = q("select * from dreport where dreport_xchan = '%s' and dreport_mid = '%s'",
|
||||
dbesc($channel['channel_hash']),
|
||||
dbesc($mid)
|
||||
);
|
||||
|
||||
if(! $r) {
|
||||
notice( t('no results') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$o .= '<h2>' . sprintf( t('Delivery report for %1$s'),substr($mid,0,32)) . '...' . '</h2>';
|
||||
$o .= '<table>';
|
||||
|
||||
foreach($r as $rr) {
|
||||
$name = escape_tags(substr($rr['dreport_recip'],strpos($rr['dreport_recip'],' ')));
|
||||
$o .= '<tr><td>' . $name . '</td><td>' . escape_tags($rr['dreport_result']) . '</td><td>' . escape_tags($rr['dreport_time']) . '</td></tr>';
|
||||
}
|
||||
$o .= '</table>';
|
||||
|
||||
return $o;
|
||||
|
||||
|
||||
|
||||
}
|
@ -641,6 +641,7 @@ function item_post(&$a) {
|
||||
$item_unseen = ((local_channel() != $profile_uid) ? 1 : 0);
|
||||
$item_wall = (($post_type === 'wall' || $post_type === 'wall-comment') ? 1 : 0);
|
||||
$item_origin = (($origin) ? 1 : 0);
|
||||
$item_consensus = (($consensus) ? 1 : 0);
|
||||
|
||||
|
||||
// determine if this is a wall post
|
||||
|
@ -1 +1 @@
|
||||
2015-09-21.1162
|
||||
2015-09-22.1163
|
||||
|
@ -123,6 +123,11 @@
|
||||
{{if $item.item_photo_menu}}
|
||||
<li role="presentation" class="divider"></li>
|
||||
{{$item.item_photo_menu}}
|
||||
|
||||
{{if $item.edpost}}
|
||||
<li role="presentation"><a role="menuitem" href="dreport/{{$item.mid}}">{{$item.dreport}}</a></li>
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
</ul>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user