aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-08-30 18:47:07 -0700
committerfriendica <info@friendica.com>2012-08-30 18:47:07 -0700
commit80bd128425b99d91ddca897bc2cd6dcef5268fe4 (patch)
tree5d45270dbbdfc12674cd79b580a7fd19c7fa4d9c /include
parent08508c4216ba4750fc0f1c0f521a69b0b91090e0 (diff)
downloadvolse-hubzilla-80bd128425b99d91ddca897bc2cd6dcef5268fe4.tar.gz
volse-hubzilla-80bd128425b99d91ddca897bc2cd6dcef5268fe4.tar.bz2
volse-hubzilla-80bd128425b99d91ddca897bc2cd6dcef5268fe4.zip
more DB cleanup
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php8
-rw-r--r--include/api.php16
-rw-r--r--include/delivery.php12
-rw-r--r--include/follow.php19
-rw-r--r--include/identity.php2
-rw-r--r--include/iquery.php2
-rwxr-xr-xinclude/items.php81
-rw-r--r--include/notifier.php12
-rw-r--r--include/onepoll.php61
-rw-r--r--include/poller.php26
-rw-r--r--include/queue_fn.php2
-rw-r--r--include/user.php2
12 files changed, 77 insertions, 166 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 9a6c64693..c141fa188 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -139,8 +139,8 @@ function mark_for_death($contact) {
if($contact['archive'])
return;
- if($contact['term-date'] == '0000-00-00 00:00:00') {
- q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d LIMIT 1",
+ if($contact['term_date'] == '0000-00-00 00:00:00') {
+ q("UPDATE `contact` SET `term_date` = '%s' WHERE `id` = %d LIMIT 1",
dbesc(datetime_convert()),
intval($contact['id'])
);
@@ -151,7 +151,7 @@ function mark_for_death($contact) {
// so they won't be surprised when the contact vanishes and can take
// remedial action if this was a serious mistake or glitch
- $expiry = $contact['term-date'] . ' + 32 days ';
+ $expiry = $contact['term_date'] . ' + 32 days ';
if(datetime_convert() > datetime_convert('UTC','UTC',$expiry)) {
// relationship is really truly dead.
@@ -172,7 +172,7 @@ function mark_for_death($contact) {
if(! function_exists('unmark_for_death')) {
function unmark_for_death($contact) {
// It's a miracle. Our dead contact has inexplicably come back to life.
- q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d LIMIT 1",
+ q("UPDATE `contact` SET `term_date` = '%s' WHERE `id` = %d LIMIT 1",
dbesc('0000-00-00 00:00:00'),
intval($contact['id'])
);
diff --git a/include/api.php b/include/api.php
index b63ae0fee..6b2fd008b 100644
--- a/include/api.php
+++ b/include/api.php
@@ -326,7 +326,7 @@
'contact_url' => $a->get_baseurl()."/contacts/".$uinfo[0]['cid'],
'protected' => false,
'friends_count' => intval($countfriends),
- 'created_at' => api_date($uinfo[0]['name-date']),
+ 'created_at' => api_date($uinfo[0]['name_date']),
'utc_offset' => "+00:00",
'time_zone' => 'UTC', //$uinfo[0]['timezone'],
'geo_enabled' => false,
@@ -738,7 +738,7 @@
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
- `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact`
WHERE `item`.`uid` = %d
@@ -808,7 +808,7 @@
/*$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
- `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact`
WHERE `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
@@ -887,7 +887,7 @@
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
- `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact`
WHERE `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
@@ -932,7 +932,7 @@
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`nick` as `reply_author`,
`contact`.`name`, `contact`.`photo`, `contact`.`url` as `reply_url`, `contact`.`rel`,
- `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact`
WHERE `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
@@ -1034,7 +1034,7 @@
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
- `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact`
WHERE `item`.`uid` = %d
@@ -1100,7 +1100,7 @@
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
- `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact`
WHERE `item`.`uid` = %d
@@ -1155,7 +1155,7 @@
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
- `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact`
WHERE `item`.`uid` = %d
diff --git a/include/delivery.php b/include/delivery.php
index f6ebe9ded..09448fcae 100644
--- a/include/delivery.php
+++ b/include/delivery.php
@@ -262,9 +262,9 @@ function delivery_run($argv, $argc){
'$profile_page' => xmlify($owner['url']),
'$photo' => xmlify($owner['photo']),
'$thumb' => xmlify($owner['thumb']),
- '$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) ,
- '$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri-date'] . '+00:00' , ATOM_TIME)) ,
- '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) ,
+ '$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar_date'] . '+00:00' , ATOM_TIME)) ,
+ '$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri_date'] . '+00:00' , ATOM_TIME)) ,
+ '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name_date'] . '+00:00' , ATOM_TIME)) ,
'$birthday' => $birthday,
'$community' => (($owner['page-flags'] == PAGE_COMMUNITY) ? '<dfrn:community>1</dfrn:community>' : '')
));
@@ -300,10 +300,10 @@ function delivery_run($argv, $argc){
if(link_compare($basepath,$a->get_baseurl())) {
$nickname = basename($contact['url']);
- if($contact['issued-id'])
- $sql_extra = sprintf(" AND `dfrn-id` = '%s' ", dbesc($contact['issued-id']));
+ if($contact['issued_id'])
+ $sql_extra = sprintf(" AND `dfrn_id` = '%s' ", dbesc($contact['issued_id']));
else
- $sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($contact['dfrn-id']));
+ $sql_extra = sprintf(" AND `issued_id` = '%s' ", dbesc($contact['dfrn_id']));
$x = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`,
`contact`.`pubkey` AS `cpubkey`,
diff --git a/include/follow.php b/include/follow.php
index 35dbb0236..8b075c173 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -95,7 +95,6 @@ function new_contact($uid,$url,$interactive = false) {
$writeable = ((($ret['network'] === NETWORK_OSTATUS) && ($ret['notify'])) ? 1 : 0);
- $subhub = (($ret['network'] === NETWORK_OSTATUS) ? true : false);
$hidden = 0;
@@ -112,9 +111,8 @@ function new_contact($uid,$url,$interactive = false) {
if(count($r)) {
// update contact
if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
- q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ q("UPDATE `contact` SET `rel` = %d , `readonly` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval(CONTACT_IS_FRIEND),
- intval($subhub),
intval($r[0]['id']),
intval($uid)
);
@@ -152,8 +150,8 @@ function new_contact($uid,$url,$interactive = false) {
// create contact record
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`,
- `writable`, `hidden`, `blocked`, `readonly`, `pending`, `subhub` )
- VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0, %d ) ",
+ `writable`, `hidden`, `blocked`, `readonly`, `pending` )
+ VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0) ",
intval($uid),
dbesc(datetime_convert()),
dbesc($ret['url']),
@@ -172,8 +170,7 @@ function new_contact($uid,$url,$interactive = false) {
intval($new_relation),
intval($ret['priority']),
intval($writeable),
- intval($hidden),
- intval($subhub)
+ intval($hidden)
);
}
@@ -206,9 +203,9 @@ function new_contact($uid,$url,$interactive = false) {
$r = q("UPDATE `contact` SET `photo` = '%s',
`thumb` = '%s',
`micro` = '%s',
- `name-date` = '%s',
- `uri-date` = '%s',
- `avatar-date` = '%s'
+ `name_date` = '%s',
+ `uri_date` = '%s',
+ `avatar_date` = '%s'
WHERE `id` = %d LIMIT 1
",
dbesc($photos[0]),
@@ -221,7 +218,7 @@ function new_contact($uid,$url,$interactive = false) {
);
- // pull feed and consume it, which should subscribe to the hub.
+ // pull feed and consume it
proc_run('php',"include/poller.php","$contact_id");
diff --git a/include/identity.php b/include/identity.php
index 9f262f1c0..7b80d383c 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -111,7 +111,7 @@ function create_identity($arr) {
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}")
);
- $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `name-date`, `uri-date`, `avatar-date`, `closeness` )
+ $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `name_date`, `uri_date`, `avatar_date`, `closeness` )
VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', 0 ) ",
intval($ret['entity']['entity_id']),
datetime_convert(),
diff --git a/include/iquery.php b/include/iquery.php
index dfcba52d9..03264de28 100644
--- a/include/iquery.php
+++ b/include/iquery.php
@@ -25,7 +25,7 @@ function network_query($a,$arr) {
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`,
- `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1
diff --git a/include/items.php b/include/items.php
index f3e549e2b..63e9a646d 100755
--- a/include/items.php
+++ b/include/items.php
@@ -52,15 +52,15 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
$sql_extra = '';
switch($direction) {
case (-1):
- $sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($dfrn_id));
+ $sql_extra = sprintf(" AND `issued_id` = '%s' ", dbesc($dfrn_id));
$my_id = $dfrn_id;
break;
case 0:
- $sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
+ $sql_extra = sprintf(" AND `issued_id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
$my_id = '1:' . $dfrn_id;
break;
case 1:
- $sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
+ $sql_extra = sprintf(" AND `dfrn_id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
$my_id = '0:' . $dfrn_id;
break;
default:
@@ -120,8 +120,8 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`network`, `contact`.`photo`, `contact`.`url`,
- `contact`.`name-date`, `contact`.`uri-date`, `contact`.`avatar-date`,
- `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
+ `contact`.`name_date`, `contact`.`uri_date`, `contact`.`avatar_date`,
+ `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
`contact`.`id` AS `contact-id`, `contact`.`uid` AS `contact-uid`,
`sign`.`signed_text`, `sign`.`signature`, `sign`.`signer`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
@@ -162,9 +162,9 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
'$profile_page' => xmlify($owner['url']),
'$photo' => xmlify($owner['photo']),
'$thumb' => xmlify($owner['thumb']),
- '$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) ,
- '$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri-date'] . '+00:00' , ATOM_TIME)) ,
- '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) ,
+ '$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar_date'] . '+00:00' , ATOM_TIME)) ,
+ '$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri_date'] . '+00:00' , ATOM_TIME)) ,
+ '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name_date'] . '+00:00' , ATOM_TIME)) ,
'$birthday' => ((strlen($birthday)) ? '<dfrn:birthday>' . xmlify($birthday) . '</dfrn:birthday>' : ''),
'$community' => (($owner['page-flags'] == PAGE_COMMUNITY) ? '<dfrn:community>1</dfrn:community>' : '')
));
@@ -1301,11 +1301,11 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$a = get_app();
- $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
+ $idtosend = $orig_id = (($contact['dfrn_id']) ? $contact['dfrn_id'] : $contact['issued_id']);
- if($contact['duplex'] && $contact['dfrn-id'])
+ if($contact['duplex'] && $contact['dfrn_id'])
$idtosend = '0:' . $orig_id;
- if($contact['duplex'] && $contact['issued-id'])
+ if($contact['duplex'] && $contact['issued_id'])
$idtosend = '1:' . $orig_id;
$rino = ((function_exists('mcrypt_encrypt')) ? 1 : 0);
@@ -1474,7 +1474,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
return 3;
}
- if($contact['term-date'] != '0000-00-00 00:00:00') {
+ if($contact['term_date'] != '0000-00-00 00:00:00') {
logger("dfrn_deliver: $url back from the dead - removing mark for death");
require_once('include/Contact.php');
unmark_for_death($contact);
@@ -1568,7 +1568,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
}
}
- if((is_array($contact)) && ($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $contact['avatar-date'])) {
+ if((is_array($contact)) && ($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $contact['avatar_date'])) {
logger('consume_feed: Updating photo for ' . $contact['name']);
require_once("Photo.php");
$photo_failure = false;
@@ -1614,7 +1614,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
$a = get_app();
- q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
+ q("UPDATE `contact` SET `avatar_date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
WHERE `uid` = %d AND `id` = %d LIMIT 1",
dbesc(datetime_convert()),
dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()),
@@ -1626,13 +1626,13 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
}
}
- if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name-date'])) {
+ if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name_date'])) {
$r = q("select * from contact where uid = %d and id = %d limit 1",
intval($contact['uid']),
intval($contact['id'])
);
- $x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
+ $x = q("UPDATE `contact` SET `name` = '%s', `name_date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
dbesc(notags(trim($new_name))),
dbesc(datetime_convert()),
intval($contact['uid']),
@@ -2100,7 +2100,7 @@ function local_delivery($importer,$data) {
}
}
- if(($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $importer['avatar-date'])) {
+ if(($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $importer['avatar_date'])) {
logger('local_delivery: Updating photo for ' . $importer['name']);
require_once("Photo.php");
$photo_failure = false;
@@ -2146,7 +2146,7 @@ function local_delivery($importer,$data) {
$a = get_app();
- q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
+ q("UPDATE `contact` SET `avatar_date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
WHERE `uid` = %d AND `id` = %d LIMIT 1",
dbesc(datetime_convert()),
dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()),
@@ -2158,13 +2158,13 @@ function local_delivery($importer,$data) {
}
}
- if(($name_updated) && (strlen($new_name)) && ($name_updated > $importer['name-date'])) {
+ if(($name_updated) && (strlen($new_name)) && ($name_updated > $importer['name_date'])) {
$r = q("select * from contact where uid = %d and id = %d limit 1",
intval($importer['importer_uid']),
intval($importer['id'])
);
- $x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
+ $x = q("UPDATE `contact` SET `name` = '%s', `name_date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
dbesc(notags(trim($new_name))),
dbesc(datetime_convert()),
intval($importer['importer_uid']),
@@ -2199,7 +2199,7 @@ function local_delivery($importer,$data) {
$newloc['confirm'] = notags(unxmlify($base['confirm'][0]['data']));
$newloc['notify'] = notags(unxmlify($base['notify'][0]['data']));
$newloc['poll'] = notags(unxmlify($base['poll'][0]['data']));
- $newloc['site-pubkey'] = notags(unxmlify($base['site-pubkey'][0]['data']));
+ $newloc['site_pubkey'] = notags(unxmlify($base['site_pubkey'][0]['data']));
$newloc['pubkey'] = notags(unxmlify($base['pubkey'][0]['data']));
$newloc['prvkey'] = notags(unxmlify($base['prvkey'][0]['data']));
@@ -3168,45 +3168,6 @@ function lose_sharer($importer,$contact,$datarray,$item) {
}
-function subscribe_to_hub($url,$importer,$contact,$hubmode = 'subscribe') {
-
- $a = get_app();
-
- if(is_array($importer)) {
- $r = q("SELECT `nickname` FROM `user` WHERE `uid` = %d LIMIT 1",
- intval($importer['uid'])
- );
- }
-
- if(! count($r))
- return;
-
- $push_url = get_config('system','url') . '/pubsub/' . $r[0]['nickname'] . '/' . $contact['id'];
-
- // Use a single verify token, even if multiple hubs
-
- $verify_token = ((strlen($contact['hub-verify'])) ? $contact['hub-verify'] : random_string());
-
- $params= 'hub.mode=' . $hubmode . '&hub.callback=' . urlencode($push_url) . '&hub.topic=' . urlencode($contact['poll']) . '&hub.verify=async&hub.verify_token=' . $verify_token;
-
- logger('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: ' . $push_url . ' with verifier ' . $verify_token);
-
- if(! strlen($contact['hub-verify'])) {
- $r = q("UPDATE `contact` SET `hub-verify` = '%s' WHERE `id` = %d LIMIT 1",
- dbesc($verify_token),
- intval($contact['id'])
- );
- }
-
- post_url($url,$params);
-
- logger('subscribe_to_hub: returns: ' . $a->get_curl_code(), LOGGER_DEBUG);
-
- return;
-
-}
-
-
function atom_author($tag,$name,$uri,$h,$w,$photo) {
$o = '';
if(! $tag)
diff --git a/include/notifier.php b/include/notifier.php
index 6bc0d98b3..6e3cede56 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -344,9 +344,9 @@ function notifier_run($argv, $argc){
'$profile_page' => xmlify($owner['url']),
'$photo' => xmlify($owner['photo']),
'$thumb' => xmlify($owner['thumb']),
- '$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) ,
- '$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri-date'] . '+00:00' , ATOM_TIME)) ,
- '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) ,
+ '$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar_date'] . '+00:00' , ATOM_TIME)) ,
+ '$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri_date'] . '+00:00' , ATOM_TIME)) ,
+ '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name_date'] . '+00:00' , ATOM_TIME)) ,
'$birthday' => $birthday,
'$community' => (($owner['page-flags'] == PAGE_COMMUNITY) ? '<dfrn:community>1</dfrn:community>' : '')
@@ -520,10 +520,10 @@ function notifier_run($argv, $argc){
if(link_compare($basepath,$a->get_baseurl())) {
$nickname = basename($contact['url']);
- if($contact['issued-id'])
- $sql_extra = sprintf(" AND `dfrn-id` = '%s' ", dbesc($contact['issued-id']));
+ if($contact['issued_id'])
+ $sql_extra = sprintf(" AND `dfrn_id` = '%s' ", dbesc($contact['issued_id']));
else
- $sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($contact['dfrn-id']));
+ $sql_extra = sprintf(" AND `issued_id` = '%s' ", dbesc($contact['dfrn_id']));
$x = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`,
`contact`.`pubkey` AS `cpubkey`,
diff --git a/include/onepoll.php b/include/onepoll.php
index 4ba2df515..467bb0f2c 100644
--- a/include/onepoll.php
+++ b/include/onepoll.php
@@ -38,7 +38,7 @@ function onepoll_run($argv, $argc){
$manual_id = 0;
$generation = 0;
- $hub_update = false;
+
$force = false;
$restart = false;
@@ -73,18 +73,7 @@ function onepoll_run($argv, $argc){
$xml = false;
- $t = $contact['last-update'];
-
- if($contact['subhub']) {
- $poll_interval = get_config('system','pushpoll_frequency');
- $contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
- $hub_update = false;
-
- if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day"))
- $hub_update = true;
- }
- else
- $hub_update = false;
+ $t = $contact['last_update'];
$importer_uid = $contact['uid'];
@@ -99,17 +88,17 @@ function onepoll_run($argv, $argc){
logger("onepoll: poll: ({$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");
- $last_update = (($contact['last-update'] === '0000-00-00 00:00:00')
+ $last_update = (($contact['last_update'] === '0000-00-00 00:00:00')
? datetime_convert('UTC','UTC','now - 7 days', ATOM_TIME)
- : datetime_convert('UTC','UTC',$contact['last-update'], ATOM_TIME)
+ : datetime_convert('UTC','UTC',$contact['last_update'], ATOM_TIME)
);
if($contact['network'] === NETWORK_DFRN) {
- $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
- if(intval($contact['duplex']) && $contact['dfrn-id'])
+ $idtosend = $orig_id = (($contact['dfrn_id']) ? $contact['dfrn_id'] : $contact['issued_id']);
+ if(intval($contact['duplex']) && $contact['dfrn_id'])
$idtosend = '0:' . $orig_id;
- if(intval($contact['duplex']) && $contact['issued-id'])
+ if(intval($contact['duplex']) && $contact['issued_id'])
$idtosend = '1:' . $orig_id;
// they have permission to write to us. We already filtered this in the contact query.
@@ -135,8 +124,8 @@ function onepoll_run($argv, $argc){
mark_for_death($contact);
- // set the last-update so we don't keep polling
- $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
+ // set the last_update so we don't keep polling
+ $r = q("UPDATE `contact` SET `last_update` = '%s' WHERE `id` = %d LIMIT 1",
dbesc(datetime_convert()),
intval($contact['id'])
);
@@ -149,7 +138,7 @@ function onepoll_run($argv, $argc){
mark_for_death($contact);
- $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
+ $r = q("UPDATE `contact` SET `last_update` = '%s' WHERE `id` = %d LIMIT 1",
dbesc(datetime_convert()),
intval($contact['id'])
);
@@ -163,17 +152,17 @@ function onepoll_run($argv, $argc){
logger("poller: $url replied status 1 - marking for death ");
// we may not be friends anymore. Will keep trying for one month.
- // set the last-update so we don't keep polling
+ // set the last_update so we don't keep polling
- $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
+ $r = q("UPDATE `contact` SET `last_update` = '%s' WHERE `id` = %d LIMIT 1",
dbesc(datetime_convert()),
intval($contact['id'])
);
mark_for_death($contact);
}
else {
- if($contact['term-date'] != '0000-00-00 00:00:00') {
+ if($contact['term_date'] != '0000-00-00 00:00:00') {
logger("poller: $url back from the dead - removing mark for death");
unmark_for_death($contact);
}
@@ -228,7 +217,7 @@ function onepoll_run($argv, $argc){
logger('poller: received xml : ' . $xml, LOGGER_DATA);
if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) {
logger('poller: post_handshake: response from ' . $url . ' did not contain XML.');
- $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
+ $r = q("UPDATE `contact` SET `last_update` = '%s' WHERE `id` = %d LIMIT 1",
dbesc(datetime_convert()),
intval($contact['id'])
);
@@ -243,30 +232,12 @@ function onepoll_run($argv, $argc){
consume_feed($xml,$importer,$contact,$hub,1,2);
- $hubmode = 'subscribe';
- if($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly'])
- $hubmode = 'unsubscribe';
-
- if($contact['network'] === NETWORK_OSTATUS && (! $contact['hub-verify']))
- $hub_update = true;
-
- if((strlen($hub)) && ($hub_update) && ($contact['rel'] != CONTACT_IS_FOLLOWER)) {
- logger('poller: hub ' . $hubmode . ' : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']);
- $hubs = explode(',', $hub);
- if(count($hubs)) {
- foreach($hubs as $h) {
- $h = trim($h);
- if(! strlen($h))
- continue;
- subscribe_to_hub($h,$importer,$contact,$hubmode);
- }
- }
- }
+
}
$updated = datetime_convert();
- $r = q("UPDATE `contact` SET `last-update` = '%s', `success_update` = '%s' WHERE `id` = %d LIMIT 1",
+ $r = q("UPDATE `contact` SET `last_update` = '%s', `success_update` = '%s' WHERE `id` = %d LIMIT 1",
dbesc($updated),
dbesc($updated),
intval($contact['id'])
diff --git a/include/poller.php b/include/poller.php
index fefc9b381..d2780be0a 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -107,7 +107,7 @@ function poller_run($argv, $argc){
$manual_id = 0;
$generation = 0;
- $hub_update = false;
+
$force = false;
$restart = false;
@@ -179,7 +179,7 @@ function poller_run($argv, $argc){
$xml = false;
if($manual_id)
- $contact['last-update'] = '0000-00-00 00:00:00';
+ $contact['last_update'] = '0000-00-00 00:00:00';
if($contact['network'] === NETWORK_DFRN)
$contact['priority'] = 2;
@@ -187,29 +187,11 @@ function poller_run($argv, $argc){
if(!get_config('system','ostatus_use_priority') and ($contact['network'] === NETWORK_OSTATUS))
$contact['priority'] = 2;
- if($contact['priority'] || $contact['subhub']) {
+ if($contact['priority']) {
- $hub_update = true;
$update = false;
- $t = $contact['last-update'];
-
- // We should be getting everything via a hub. But just to be sure, let's check once a day.
- // (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
- // This also lets us update our subscription to the hub, and add or replace hubs in case it
- // changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'.
-
-
- if($contact['subhub']) {
- $poll_interval = get_config('system','pushpoll_frequency');
- $contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
- $hub_update = false;
-
- if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) || $force)
- $hub_update = true;
- }
- else
- $hub_update = false;
+ $t = $contact['last_update'];
/**
* Based on $contact['priority'], should we poll this site now? Or later?
diff --git a/include/queue_fn.php b/include/queue_fn.php
index e43912431..6e8933aba 100644
--- a/include/queue_fn.php
+++ b/include/queue_fn.php
@@ -24,7 +24,7 @@ function was_recently_delayed($cid) {
if(count($r))
return true;
- $r = q("select `term-date` from contact where id = %d and `term-date` != '' and `term-date` != '0000-00-00 00:00:00' limit 1",
+ $r = q("select `term_date` from contact where id = %d and `term_date` != '' and `term_date` != '0000-00-00 00:00:00' limit 1",
intval($cid)
);
if(count($r))
diff --git a/include/user.php b/include/user.php
index 6514b269a..b94317dab 100644
--- a/include/user.php
+++ b/include/user.php
@@ -233,7 +233,7 @@ function create_user($arr) {
return $result;
}
$r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `nurl`,
- `request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date`, `closeness` )
+ `request`, `notify`, `poll`, `confirm`, `poco`, `name_date`, `uri_date`, `avatar_date`, `closeness` )
VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0 ) ",
intval($newuid),
datetime_convert(),