forked from friendica/friendica-addons
Deprecated parts removed
This commit is contained in:
parent
dd7dc77a10
commit
12994aaccd
7 changed files with 118 additions and 232 deletions
|
@ -5,6 +5,7 @@
|
||||||
* Description: Bidirectional (posting and reading) connector for app.net.
|
* Description: Bidirectional (posting and reading) connector for app.net.
|
||||||
* Version: 0.2
|
* Version: 0.2
|
||||||
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||||
|
* Status: Unsupported
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1118,36 +1119,11 @@ function appnet_expand_annotations($a, $annotations) {
|
||||||
|
|
||||||
function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
|
function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
|
||||||
|
|
||||||
if (function_exists("update_gcontact"))
|
update_gcontact(array("url" => $contact["canonical_url"], "generation" => 2,
|
||||||
update_gcontact(array("url" => $contact["canonical_url"], "generation" => 2,
|
"network" => NETWORK_APPNET, "photo" => $contact["avatar_image"]["url"],
|
||||||
"network" => NETWORK_APPNET, "photo" => $contact["avatar_image"]["url"],
|
"name" => $contact["name"], "nick" => $contact["username"],
|
||||||
"name" => $contact["name"], "nick" => $contact["username"],
|
"about" => $contact["description"]["text"], "hide" => true,
|
||||||
"about" => $contact["description"]["text"], "hide" => true,
|
"addr" => $contact["username"]."@app.net"));
|
||||||
"addr" => $contact["username"]."@app.net"));
|
|
||||||
else {
|
|
||||||
// Old Code
|
|
||||||
$r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1",
|
|
||||||
dbesc(normalise_link($contact["canonical_url"])));
|
|
||||||
|
|
||||||
if (count($r) == 0)
|
|
||||||
q("INSERT INTO unique_contacts (url, name, nick, avatar) VALUES ('%s', '%s', '%s', '%s')",
|
|
||||||
dbesc(normalise_link($contact["canonical_url"])),
|
|
||||||
dbesc($contact["name"]),
|
|
||||||
dbesc($contact["username"]),
|
|
||||||
dbesc($contact["avatar_image"]["url"]));
|
|
||||||
else
|
|
||||||
q("UPDATE unique_contacts SET name = '%s', nick = '%s', avatar = '%s' WHERE url = '%s'",
|
|
||||||
dbesc($contact["name"]),
|
|
||||||
dbesc($contact["username"]),
|
|
||||||
dbesc($contact["avatar_image"]["url"]),
|
|
||||||
dbesc(normalise_link($contact["canonical_url"])));
|
|
||||||
|
|
||||||
if (DB_UPDATE_VERSION >= "1177")
|
|
||||||
q("UPDATE `unique_contacts` SET `location` = '%s', `about` = '%s' WHERE url = '%s'",
|
|
||||||
dbesc(""),
|
|
||||||
dbesc($contact["description"]["text"]),
|
|
||||||
dbesc(normalise_link($contact["canonical_url"])));
|
|
||||||
}
|
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
|
||||||
intval($uid), dbesc("adn::".$contact["id"]));
|
intval($uid), dbesc("adn::".$contact["id"]));
|
||||||
|
@ -1174,8 +1150,8 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
|
||||||
// create contact record
|
// create contact record
|
||||||
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
||||||
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
||||||
`writable`, `blocked`, `readonly`, `pending` )
|
`about`, `writable`, `blocked`, `readonly`, `pending` )
|
||||||
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
|
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, 0, 0, 0 ) ",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($contact["canonical_url"]),
|
dbesc($contact["canonical_url"]),
|
||||||
|
@ -1190,6 +1166,7 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
|
||||||
dbesc(NETWORK_APPNET),
|
dbesc(NETWORK_APPNET),
|
||||||
intval(CONTACT_IS_FRIEND),
|
intval(CONTACT_IS_FRIEND),
|
||||||
intval(1),
|
intval(1),
|
||||||
|
dbesc($contact["description"]["text"]),
|
||||||
intval(1)
|
intval(1)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1231,15 +1208,6 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($contact_id)
|
intval($contact_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DB_UPDATE_VERSION >= "1177")
|
|
||||||
q("UPDATE `contact` SET `location` = '%s',
|
|
||||||
`about` = '%s'
|
|
||||||
WHERE `id` = %d",
|
|
||||||
dbesc(""),
|
|
||||||
dbesc($contact["description"]["text"]),
|
|
||||||
intval($contact_id)
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
// update profile photos once every two weeks as we have no notification of when they change.
|
// update profile photos once every two weeks as we have no notification of when they change.
|
||||||
|
|
||||||
|
@ -1266,7 +1234,8 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
|
||||||
`nurl` = '%s',
|
`nurl` = '%s',
|
||||||
`addr` = '%s',
|
`addr` = '%s',
|
||||||
`name` = '%s',
|
`name` = '%s',
|
||||||
`nick` = '%s'
|
`nick` = '%s',
|
||||||
|
`about` = '%s'
|
||||||
WHERE `id` = %d",
|
WHERE `id` = %d",
|
||||||
dbesc($photos[0]),
|
dbesc($photos[0]),
|
||||||
dbesc($photos[1]),
|
dbesc($photos[1]),
|
||||||
|
@ -1279,16 +1248,9 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
|
||||||
dbesc($contact["username"]."@app.net"),
|
dbesc($contact["username"]."@app.net"),
|
||||||
dbesc($contact["name"]),
|
dbesc($contact["name"]),
|
||||||
dbesc($contact["username"]),
|
dbesc($contact["username"]),
|
||||||
|
dbesc($contact["description"]["text"]),
|
||||||
intval($r[0]['id'])
|
intval($r[0]['id'])
|
||||||
);
|
);
|
||||||
if (DB_UPDATE_VERSION >= "1177")
|
|
||||||
q("UPDATE `contact` SET `location` = '%s',
|
|
||||||
`about` = '%s'
|
|
||||||
WHERE `id` = %d",
|
|
||||||
dbesc(""),
|
|
||||||
dbesc($contact["description"]["text"]),
|
|
||||||
intval($r[0]['id'])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Name: Buffer Post Connector
|
* Name: Buffer Post Connector
|
||||||
* Description: Post to Buffer (Linkedin, App.net, Google+, Facebook, Twitter)
|
* Description: Post to Buffer (Facebook, Google+, LinkedIn, Twitter)
|
||||||
* Version: 0.2
|
* Version: 0.2
|
||||||
* Author: Michael Vogel <http://pirati.ca/profile/heluecht>
|
* Author: Michael Vogel <http://pirati.ca/profile/heluecht>
|
||||||
*/
|
*/
|
||||||
|
@ -328,15 +328,14 @@ function buffer_send(&$a,&$b) {
|
||||||
if (isset($post["preview"]))
|
if (isset($post["preview"]))
|
||||||
$post["preview"] = proxy_url($post["preview"]);
|
$post["preview"] = proxy_url($post["preview"]);
|
||||||
|
|
||||||
//if ($profile->service == "twitter") {
|
//if ($includedlinks) {
|
||||||
if ($includedlinks) {
|
// if (isset($post["url"]))
|
||||||
if (isset($post["url"]))
|
// $post["url"] = short_link($post["url"]);
|
||||||
$post["url"] = short_link($post["url"]);
|
// if (isset($post["image"]))
|
||||||
if (isset($post["image"]))
|
// $post["image"] = short_link($post["image"]);
|
||||||
$post["image"] = short_link($post["image"]);
|
// if (isset($post["preview"]))
|
||||||
if (isset($post["preview"]))
|
// $post["preview"] = short_link($post["preview"]);
|
||||||
$post["preview"] = short_link($post["preview"]);
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
// Seems like a bug to me
|
// Seems like a bug to me
|
||||||
// Buffer doesn't add links to Twitter and App.net (but pictures)
|
// Buffer doesn't add links to Twitter and App.net (but pictures)
|
||||||
|
|
|
@ -976,8 +976,8 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
|
||||||
// create contact record
|
// create contact record
|
||||||
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
||||||
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
||||||
`writable`, `blocked`, `readonly`, `pending` )
|
`location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
|
||||||
VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0)",
|
VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($contact->url),
|
dbesc($contact->url),
|
||||||
|
@ -992,6 +992,8 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
|
||||||
dbesc(NETWORK_PUMPIO),
|
dbesc(NETWORK_PUMPIO),
|
||||||
intval(CONTACT_IS_FRIEND),
|
intval(CONTACT_IS_FRIEND),
|
||||||
intval(1),
|
intval(1),
|
||||||
|
dbesc($contact->location->displayName),
|
||||||
|
dbesc($contact->summary),
|
||||||
intval(1)
|
intval(1)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1014,15 +1016,6 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
|
||||||
require_once('include/group.php');
|
require_once('include/group.php');
|
||||||
group_add_member($uid,'',$contact_id,$g[0]['def_gid']);
|
group_add_member($uid,'',$contact_id,$g[0]['def_gid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DB_UPDATE_VERSION >= "1177")
|
|
||||||
q("UPDATE `contact` SET `location` = '%s',
|
|
||||||
`about` = '%s'
|
|
||||||
WHERE `id` = %d",
|
|
||||||
dbesc($contact->location->displayName),
|
|
||||||
dbesc($contact->summary),
|
|
||||||
intval($contact_id)
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
$contact_id = $r[0]["id"];
|
$contact_id = $r[0]["id"];
|
||||||
|
|
||||||
|
|
|
@ -41,21 +41,23 @@ function pumpio_sync_run(&$argv, &$argc){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$lockpath = get_lockpath();
|
// This is deprecated with the worker
|
||||||
if ($lockpath != '') {
|
if (function_exists("get_lockpath")) {
|
||||||
$pidfile = new pidfile($lockpath, 'pumpio_sync');
|
$lockpath = get_lockpath();
|
||||||
if($pidfile->is_already_running()) {
|
if ($lockpath != '') {
|
||||||
logger("Already running");
|
$pidfile = new pidfile($lockpath, 'pumpio_sync');
|
||||||
if ($pidfile->running_time() > 9*60) {
|
if($pidfile->is_already_running()) {
|
||||||
$pidfile->kill();
|
logger("Already running");
|
||||||
logger("killed stale process");
|
if ($pidfile->running_time() > 9*60) {
|
||||||
// Calling a new instance
|
$pidfile->kill();
|
||||||
proc_run('php','addon/pumpio/pumpio_sync.php');
|
logger("killed stale process");
|
||||||
|
// Calling a new instance
|
||||||
|
proc_run('php','addon/pumpio/pumpio_sync.php');
|
||||||
|
}
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pumpio_sync($a);
|
pumpio_sync($a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -920,36 +920,11 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
|
||||||
if ($contact->statusnet_profile_url == "")
|
if ($contact->statusnet_profile_url == "")
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
if (function_exists("update_gcontact"))
|
update_gcontact(array("url" => $contact->statusnet_profile_url,
|
||||||
update_gcontact(array("url" => $contact->statusnet_profile_url,
|
"network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
|
||||||
"network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
|
"name" => $contact->name, "nick" => $contact->screen_name,
|
||||||
"name" => $contact->name, "nick" => $contact->screen_name,
|
"location" => $contact->location, "about" => $contact->description,
|
||||||
"location" => $contact->location, "about" => $contact->description,
|
"addr" => statusnet_address($contact), "generation" => 3));
|
||||||
"addr" => statusnet_address($contact), "generation" => 3));
|
|
||||||
else {
|
|
||||||
// Old Code
|
|
||||||
$r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1",
|
|
||||||
dbesc(normalise_link($contact->statusnet_profile_url)));
|
|
||||||
|
|
||||||
if (count($r) == 0)
|
|
||||||
q("INSERT INTO unique_contacts (url, name, nick, avatar) VALUES ('%s', '%s', '%s', '%s')",
|
|
||||||
dbesc(normalise_link($contact->statusnet_profile_url)),
|
|
||||||
dbesc($contact->name),
|
|
||||||
dbesc($contact->screen_name),
|
|
||||||
dbesc($contact->profile_image_url));
|
|
||||||
else
|
|
||||||
q("UPDATE unique_contacts SET name = '%s', nick = '%s', avatar = '%s' WHERE url = '%s'",
|
|
||||||
dbesc($contact->name),
|
|
||||||
dbesc($contact->screen_name),
|
|
||||||
dbesc($contact->profile_image_url),
|
|
||||||
dbesc(normalise_link($contact->statusnet_profile_url)));
|
|
||||||
|
|
||||||
if (DB_UPDATE_VERSION >= "1177")
|
|
||||||
q("UPDATE `unique_contacts` SET `location` = '%s', `about` = '%s' WHERE url = '%s'",
|
|
||||||
dbesc($contact->location),
|
|
||||||
dbesc($contact->description),
|
|
||||||
dbesc(normalise_link($contact->statusnet_profile_url)));
|
|
||||||
}
|
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1",
|
||||||
intval($uid), dbesc(normalise_link($contact->statusnet_profile_url)), dbesc(NETWORK_STATUSNET));
|
intval($uid), dbesc(normalise_link($contact->statusnet_profile_url)), dbesc(NETWORK_STATUSNET));
|
||||||
|
@ -966,8 +941,8 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
|
||||||
// create contact record
|
// create contact record
|
||||||
q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
||||||
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
||||||
`writable`, `blocked`, `readonly`, `pending` )
|
`location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
|
||||||
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
|
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0 ) ",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($contact->statusnet_profile_url),
|
dbesc($contact->statusnet_profile_url),
|
||||||
|
@ -982,6 +957,8 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
|
||||||
dbesc(NETWORK_STATUSNET),
|
dbesc(NETWORK_STATUSNET),
|
||||||
intval(CONTACT_IS_FRIEND),
|
intval(CONTACT_IS_FRIEND),
|
||||||
intval(1),
|
intval(1),
|
||||||
|
dbesc($contact->location),
|
||||||
|
dbesc($contact->description),
|
||||||
intval(1)
|
intval(1)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1019,16 +996,6 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($contact_id)
|
intval($contact_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DB_UPDATE_VERSION >= "1177")
|
|
||||||
q("UPDATE `contact` SET `location` = '%s',
|
|
||||||
`about` = '%s'
|
|
||||||
WHERE `id` = %d",
|
|
||||||
dbesc($contact->location),
|
|
||||||
dbesc($contact->description),
|
|
||||||
intval($contact_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// update profile photos once every two weeks as we have no notification of when they change.
|
// update profile photos once every two weeks as we have no notification of when they change.
|
||||||
|
|
||||||
|
@ -1055,7 +1022,9 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
|
||||||
`nurl` = '%s',
|
`nurl` = '%s',
|
||||||
`addr` = '%s',
|
`addr` = '%s',
|
||||||
`name` = '%s',
|
`name` = '%s',
|
||||||
`nick` = '%s'
|
`nick` = '%s',
|
||||||
|
`location` = '%s',
|
||||||
|
`about` = '%s'
|
||||||
WHERE `id` = %d",
|
WHERE `id` = %d",
|
||||||
dbesc($photos[0]),
|
dbesc($photos[0]),
|
||||||
dbesc($photos[1]),
|
dbesc($photos[1]),
|
||||||
|
@ -1068,17 +1037,10 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
|
||||||
dbesc(statusnet_address($contact)),
|
dbesc(statusnet_address($contact)),
|
||||||
dbesc($contact->name),
|
dbesc($contact->name),
|
||||||
dbesc($contact->screen_name),
|
dbesc($contact->screen_name),
|
||||||
|
dbesc($contact->location),
|
||||||
|
dbesc($contact->description),
|
||||||
intval($r[0]['id'])
|
intval($r[0]['id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DB_UPDATE_VERSION >= "1177")
|
|
||||||
q("UPDATE `contact` SET `location` = '%s',
|
|
||||||
`about` = '%s'
|
|
||||||
WHERE `id` = %d",
|
|
||||||
dbesc($contact->location),
|
|
||||||
dbesc($contact->description),
|
|
||||||
intval($r[0]['id'])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -935,36 +935,11 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
|
||||||
|
|
||||||
$avatar = twitter_fix_avatar($contact->profile_image_url_https);
|
$avatar = twitter_fix_avatar($contact->profile_image_url_https);
|
||||||
|
|
||||||
if (function_exists("update_gcontact"))
|
update_gcontact(array("url" => "https://twitter.com/".$contact->screen_name,
|
||||||
update_gcontact(array("url" => "https://twitter.com/".$contact->screen_name,
|
"network" => NETWORK_TWITTER, "photo" => $avatar, "hide" => true,
|
||||||
"network" => NETWORK_TWITTER, "photo" => $avatar, "hide" => true,
|
"name" => $contact->name, "nick" => $contact->screen_name,
|
||||||
"name" => $contact->name, "nick" => $contact->screen_name,
|
"location" => $contact->location, "about" => $contact->description,
|
||||||
"location" => $contact->location, "about" => $contact->description,
|
"addr" => $contact->screen_name."@twitter.com", "generation" => 2));
|
||||||
"addr" => $contact->screen_name."@twitter.com", "generation" => 2));
|
|
||||||
else {
|
|
||||||
// Old Code
|
|
||||||
$r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1",
|
|
||||||
dbesc(normalise_link("https://twitter.com/".$contact->screen_name)));
|
|
||||||
|
|
||||||
if (count($r) == 0)
|
|
||||||
q("INSERT INTO unique_contacts (url, name, nick, avatar) VALUES ('%s', '%s', '%s', '%s')",
|
|
||||||
dbesc(normalise_link("https://twitter.com/".$contact->screen_name)),
|
|
||||||
dbesc($contact->name),
|
|
||||||
dbesc($contact->screen_name),
|
|
||||||
dbesc($avatar));
|
|
||||||
else
|
|
||||||
q("UPDATE unique_contacts SET name = '%s', nick = '%s', avatar = '%s' WHERE url = '%s'",
|
|
||||||
dbesc($contact->name),
|
|
||||||
dbesc($contact->screen_name),
|
|
||||||
dbesc($avatar),
|
|
||||||
dbesc(normalise_link("https://twitter.com/".$contact->screen_name)));
|
|
||||||
|
|
||||||
if (DB_UPDATE_VERSION >= "1177")
|
|
||||||
q("UPDATE `unique_contacts` SET `location` = '%s', `about` = '%s' WHERE url = '%s'",
|
|
||||||
dbesc($contact->location),
|
|
||||||
dbesc($contact->description),
|
|
||||||
dbesc(normalise_link("https://twitter.com/".$contact->screen_name)));
|
|
||||||
}
|
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
|
||||||
intval($uid), dbesc("twitter::".$contact->id_str));
|
intval($uid), dbesc("twitter::".$contact->id_str));
|
||||||
|
@ -979,10 +954,10 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
|
||||||
|
|
||||||
if(!count($r)) {
|
if(!count($r)) {
|
||||||
// create contact record
|
// create contact record
|
||||||
q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
||||||
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
||||||
`writable`, `blocked`, `readonly`, `pending` )
|
`location`, `about`, `writable`, `blocked`, `readonly`, `pending`)
|
||||||
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0) ",
|
VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc("https://twitter.com/".$contact->screen_name),
|
dbesc("https://twitter.com/".$contact->screen_name),
|
||||||
|
@ -997,6 +972,8 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
|
||||||
dbesc(NETWORK_TWITTER),
|
dbesc(NETWORK_TWITTER),
|
||||||
intval(CONTACT_IS_FRIEND),
|
intval(CONTACT_IS_FRIEND),
|
||||||
intval(1),
|
intval(1),
|
||||||
|
dbesc($contact->location),
|
||||||
|
dbesc($contact->description),
|
||||||
intval(1)
|
intval(1)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1021,33 +998,25 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
|
||||||
|
|
||||||
require_once("Photo.php");
|
require_once("Photo.php");
|
||||||
|
|
||||||
$photos = import_profile_photo($avatar,$uid,$contact_id);
|
$photos = import_profile_photo($avatar, $uid, $contact_id, true);
|
||||||
|
|
||||||
q("UPDATE `contact` SET `photo` = '%s',
|
if ($photos) {
|
||||||
`thumb` = '%s',
|
q("UPDATE `contact` SET `photo` = '%s',
|
||||||
`micro` = '%s',
|
`thumb` = '%s',
|
||||||
`name-date` = '%s',
|
`micro` = '%s',
|
||||||
`uri-date` = '%s',
|
`name-date` = '%s',
|
||||||
`avatar-date` = '%s'
|
`uri-date` = '%s',
|
||||||
WHERE `id` = %d",
|
`avatar-date` = '%s'
|
||||||
dbesc($photos[0]),
|
|
||||||
dbesc($photos[1]),
|
|
||||||
dbesc($photos[2]),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
intval($contact_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (DB_UPDATE_VERSION >= "1177")
|
|
||||||
q("UPDATE `contact` SET `location` = '%s',
|
|
||||||
`about` = '%s'
|
|
||||||
WHERE `id` = %d",
|
WHERE `id` = %d",
|
||||||
dbesc($contact->location),
|
dbesc($photos[0]),
|
||||||
dbesc($contact->description),
|
dbesc($photos[1]),
|
||||||
|
dbesc($photos[2]),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
intval($contact_id)
|
intval($contact_id)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// update profile photos once every two weeks as we have no notification of when they change.
|
// update profile photos once every two weeks as we have no notification of when they change.
|
||||||
|
|
||||||
|
@ -1062,42 +1031,39 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
|
||||||
|
|
||||||
require_once("Photo.php");
|
require_once("Photo.php");
|
||||||
|
|
||||||
$photos = import_profile_photo($avatar, $uid, $r[0]['id']);
|
$photos = import_profile_photo($avatar, $uid, $r[0]['id'], true);
|
||||||
|
|
||||||
q("UPDATE `contact` SET `photo` = '%s',
|
if ($photos) {
|
||||||
`thumb` = '%s',
|
q("UPDATE `contact` SET `photo` = '%s',
|
||||||
`micro` = '%s',
|
`thumb` = '%s',
|
||||||
`name-date` = '%s',
|
`micro` = '%s',
|
||||||
`uri-date` = '%s',
|
`name-date` = '%s',
|
||||||
`avatar-date` = '%s',
|
`uri-date` = '%s',
|
||||||
`url` = '%s',
|
`avatar-date` = '%s',
|
||||||
`nurl` = '%s',
|
`url` = '%s',
|
||||||
`addr` = '%s',
|
`nurl` = '%s',
|
||||||
`name` = '%s',
|
`addr` = '%s',
|
||||||
`nick` = '%s'
|
`name` = '%s',
|
||||||
WHERE `id` = %d",
|
`nick` = '%s',
|
||||||
dbesc($photos[0]),
|
`location` = '%s',
|
||||||
dbesc($photos[1]),
|
|
||||||
dbesc($photos[2]),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc("https://twitter.com/".$contact->screen_name),
|
|
||||||
dbesc(normalise_link("https://twitter.com/".$contact->screen_name)),
|
|
||||||
dbesc($contact->screen_name."@twitter.com"),
|
|
||||||
dbesc($contact->name),
|
|
||||||
dbesc($contact->screen_name),
|
|
||||||
intval($r[0]['id'])
|
|
||||||
);
|
|
||||||
|
|
||||||
if (DB_UPDATE_VERSION >= "1177")
|
|
||||||
q("UPDATE `contact` SET `location` = '%s',
|
|
||||||
`about` = '%s'
|
`about` = '%s'
|
||||||
WHERE `id` = %d",
|
WHERE `id` = %d",
|
||||||
|
dbesc($photos[0]),
|
||||||
|
dbesc($photos[1]),
|
||||||
|
dbesc($photos[2]),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
|
dbesc("https://twitter.com/".$contact->screen_name),
|
||||||
|
dbesc(normalise_link("https://twitter.com/".$contact->screen_name)),
|
||||||
|
dbesc($contact->screen_name."@twitter.com"),
|
||||||
|
dbesc($contact->name),
|
||||||
|
dbesc($contact->screen_name),
|
||||||
dbesc($contact->location),
|
dbesc($contact->location),
|
||||||
dbesc($contact->description),
|
dbesc($contact->description),
|
||||||
intval($r[0]['id'])
|
intval($r[0]['id'])
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,19 +49,21 @@ function twitter_sync_run($argv, $argc){
|
||||||
$mode = intval($argv[1]);
|
$mode = intval($argv[1]);
|
||||||
$uid = intval($argv[2]);
|
$uid = intval($argv[2]);
|
||||||
|
|
||||||
/// @todo Replace it with "App::is_already_running" in the next release
|
// This is deprecated with the worker
|
||||||
$lockpath = get_lockpath();
|
if (function_exists("get_lockpath")) {
|
||||||
if ($lockpath != '') {
|
$lockpath = get_lockpath();
|
||||||
$pidfile = new pidfile($lockpath, 'twitter_sync-'.$mode.'-'.$uid);
|
if ($lockpath != '') {
|
||||||
if ($pidfile->is_already_running()) {
|
$pidfile = new pidfile($lockpath, 'twitter_sync-'.$mode.'-'.$uid);
|
||||||
logger("Already running");
|
if ($pidfile->is_already_running()) {
|
||||||
if ($pidfile->running_time() > 9*60) {
|
logger("Already running");
|
||||||
$pidfile->kill();
|
if ($pidfile->running_time() > 9*60) {
|
||||||
logger("killed stale process");
|
$pidfile->kill();
|
||||||
// Calling a new instance
|
logger("killed stale process");
|
||||||
proc_run('php','addon/twitter/twitter_sync.php', $mode, $uid);
|
// Calling a new instance
|
||||||
|
proc_run('php','addon/twitter/twitter_sync.php', $mode, $uid);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue