]> git.mxchange.org Git - friendica-addons.git/commitdiff
Deprecated parts removed
authorMichael <heluecht@pirati.ca>
Thu, 9 Mar 2017 06:58:36 +0000 (06:58 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 9 Mar 2017 06:58:36 +0000 (06:58 +0000)
appnet/appnet.php
buffer/buffer.php
pumpio/pumpio.php
pumpio/pumpio_sync.php
statusnet/statusnet.php
twitter/twitter.php
twitter/twitter_sync.php

index 0c53a49f470e07a79a458e6274effa54ff3a898d..042b2f8c18758c66268e0e4b3a6f8bc2ba84be7b 100644 (file)
@@ -5,6 +5,7 @@
  * Description: Bidirectional (posting and reading) connector for app.net.
  * Version: 0.2
  * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
  * Description: Bidirectional (posting and reading) connector for app.net.
  * Version: 0.2
  * 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,
-                               "network" => NETWORK_APPNET, "photo" => $contact["avatar_image"]["url"],
-                               "name" => $contact["name"], "nick" => $contact["username"],
-                               "about" => $contact["description"]["text"], "hide" => true,
-                               "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"])));
-       }
+       update_gcontact(array("url" => $contact["canonical_url"], "generation" => 2,
+                       "network" => NETWORK_APPNET, "photo" => $contact["avatar_image"]["url"],
+                       "name" => $contact["name"], "nick" => $contact["username"],
+                       "about" => $contact["description"]["text"], "hide" => true,
+                       "addr" => $contact["username"]."@app.net"));
 
        $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
                intval($uid), dbesc("adn::".$contact["id"]));
 
        $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
                intval($uid), dbesc("adn::".$contact["id"]));
@@ -1174,8 +1150,8 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
                // create contact record
                q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
                                        `name`, `nick`, `photo`, `network`, `rel`, `priority`,
                // create contact record
                q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
                                        `name`, `nick`, `photo`, `network`, `rel`, `priority`,
-                                       `writable`, `blocked`, `readonly`, `pending` )
-                                       VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
+                                       `about`, `writable`, `blocked`, `readonly`, `pending` )
+                                       VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, 0, 0, 0 ) ",
                        intval($uid),
                        dbesc(datetime_convert()),
                        dbesc($contact["canonical_url"]),
                        intval($uid),
                        dbesc(datetime_convert()),
                        dbesc($contact["canonical_url"]),
@@ -1190,6 +1166,7 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
                        dbesc(NETWORK_APPNET),
                        intval(CONTACT_IS_FRIEND),
                        intval(1),
                        dbesc(NETWORK_APPNET),
                        intval(CONTACT_IS_FRIEND),
                        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()),
                        intval($contact_id)
                );
                        dbesc(datetime_convert()),
                        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 {
                // update profile photos once every two weeks as we have no notification of when they change.
 
        } else {
                // 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',
                                                `addr` = '%s',
                                                `name` = '%s',
                                                `nurl` = '%s',
                                                `addr` = '%s',
                                                `name` = '%s',
-                                               `nick` = '%s'
+                                               `nick` = '%s',
+                                               `about` = '%s'
                                        WHERE `id` = %d",
                                dbesc($photos[0]),
                                dbesc($photos[1]),
                                        WHERE `id` = %d",
                                dbesc($photos[0]),
                                dbesc($photos[1]),
@@ -1279,16 +1248,9 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
                                dbesc($contact["username"]."@app.net"),
                                dbesc($contact["name"]),
                                dbesc($contact["username"]),
                                dbesc($contact["username"]."@app.net"),
                                dbesc($contact["name"]),
                                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'])
-                               );
                }
        }
 
                }
        }
 
index 162600d649c2facbfeec604ac743cba43365c20a..89000c1ff8772b7a88cda8dccdd288bd0ea12420 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * Name: Buffer Post Connector
 <?php
 /**
  * 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
  * Author: Michael Vogel <http://pirati.ca/profile/heluecht>
  */
  * Version: 0.2
  * Author: Michael Vogel <http://pirati.ca/profile/heluecht>
  */
@@ -328,15 +328,14 @@ function buffer_send(&$a,&$b) {
                                if (isset($post["preview"]))
                                        $post["preview"] = proxy_url($post["preview"]);
 
                                if (isset($post["preview"]))
                                        $post["preview"] = proxy_url($post["preview"]);
 
-                               //if ($profile->service == "twitter") {
-                               if ($includedlinks) {
-                                       if (isset($post["url"]))
-                                               $post["url"] = short_link($post["url"]);
-                                       if (isset($post["image"]))
-                                               $post["image"] = short_link($post["image"]);
-                                       if (isset($post["preview"]))
-                                               $post["preview"] = short_link($post["preview"]);
-                               }
+                               //if ($includedlinks) {
+                               //      if (isset($post["url"]))
+                               //              $post["url"] = short_link($post["url"]);
+                               //      if (isset($post["image"]))
+                               //              $post["image"] = short_link($post["image"]);
+                               //      if (isset($post["preview"]))
+                               //              $post["preview"] = short_link($post["preview"]);
+                               //}
 
                                // Seems like a bug to me
                                // Buffer doesn't add links to Twitter and App.net (but pictures)
 
                                // Seems like a bug to me
                                // Buffer doesn't add links to Twitter and App.net (but pictures)
index 65f55552573b79c0e09e228000530bc5e9516e6e..fb7ce8c1ecd5453d764718d7d813a8aa049b66bb 100644 (file)
@@ -976,8 +976,8 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
                // create contact record
                q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
                                        `name`, `nick`, `photo`, `network`, `rel`, `priority`,
                // create contact record
                q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
                                        `name`, `nick`, `photo`, `network`, `rel`, `priority`,
-                                       `writable`, `blocked`, `readonly`, `pending` )
-                               VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0)",
+                                       `location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
+                               VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
                        intval($uid),
                        dbesc(datetime_convert()),
                        dbesc($contact->url),
                        intval($uid),
                        dbesc(datetime_convert()),
                        dbesc($contact->url),
@@ -992,6 +992,8 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
                        dbesc(NETWORK_PUMPIO),
                        intval(CONTACT_IS_FRIEND),
                        intval(1),
                        dbesc(NETWORK_PUMPIO),
                        intval(CONTACT_IS_FRIEND),
                        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');
                        group_add_member($uid,'',$contact_id,$g[0]['def_gid']);
                }
                        require_once('include/group.php');
                        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 {
                $contact_id = $r[0]["id"];
 
        } else {
                $contact_id = $r[0]["id"];
 
index 346376fa00d6fde9d26e40f1e972441a7d4607cb..af843c1d7a42841cc5aa79f120010e6c6a484ef3 100644 (file)
@@ -41,21 +41,23 @@ function pumpio_sync_run(&$argv, &$argc){
                }
        }
 
                }
        }
 
-       $lockpath = get_lockpath();
-       if ($lockpath != '') {
-               $pidfile = new pidfile($lockpath, 'pumpio_sync');
-               if($pidfile->is_already_running()) {
-                       logger("Already running");
-                       if ($pidfile->running_time() > 9*60) {
-                               $pidfile->kill();
-                               logger("killed stale process");
-                               // Calling a new instance
-                               proc_run('php','addon/pumpio/pumpio_sync.php');
+       // This is deprecated with the worker
+       if (function_exists("get_lockpath")) {
+               $lockpath = get_lockpath();
+               if ($lockpath != '') {
+                       $pidfile = new pidfile($lockpath, 'pumpio_sync');
+                       if($pidfile->is_already_running()) {
+                               logger("Already running");
+                               if ($pidfile->running_time() > 9*60) {
+                                       $pidfile->kill();
+                                       logger("killed stale process");
+                                       // Calling a new instance
+                                       proc_run('php','addon/pumpio/pumpio_sync.php');
+                               }
+                               exit;
                        }
                        }
-                       exit;
                }
        }
                }
        }
-
        pumpio_sync($a);
 }
 
        pumpio_sync($a);
 }
 
index bc9bc125f4a1ffb0a3f0e25470049eefd3f14a9a..9c44ef0236b68182a2e2e2bf48e31491d6dc6743 100644 (file)
@@ -920,36 +920,11 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
        if ($contact->statusnet_profile_url == "")
                return(-1);
 
        if ($contact->statusnet_profile_url == "")
                return(-1);
 
-       if (function_exists("update_gcontact"))
-               update_gcontact(array("url" => $contact->statusnet_profile_url,
-                               "network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
-                               "name" => $contact->name, "nick" => $contact->screen_name,
-                               "location" => $contact->location, "about" => $contact->description,
-                               "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)));
-       }
+       update_gcontact(array("url" => $contact->statusnet_profile_url,
+                       "network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
+                       "name" => $contact->name, "nick" => $contact->screen_name,
+                       "location" => $contact->location, "about" => $contact->description,
+                       "addr" => statusnet_address($contact), "generation" => 3));
 
        $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));
 
        $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));
@@ -966,8 +941,8 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
                // create contact record
                q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
                                        `name`, `nick`, `photo`, `network`, `rel`, `priority`,
                // create contact record
                q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
                                        `name`, `nick`, `photo`, `network`, `rel`, `priority`,
-                                       `writable`, `blocked`, `readonly`, `pending` )
-                                       VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
+                                       `location`, `about`, `writable`, `blocked`, `readonly`, `pending` )
+                                       VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0 ) ",
                        intval($uid),
                        dbesc(datetime_convert()),
                        dbesc($contact->statusnet_profile_url),
                        intval($uid),
                        dbesc(datetime_convert()),
                        dbesc($contact->statusnet_profile_url),
@@ -982,6 +957,8 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
                        dbesc(NETWORK_STATUSNET),
                        intval(CONTACT_IS_FRIEND),
                        intval(1),
                        dbesc(NETWORK_STATUSNET),
                        intval(CONTACT_IS_FRIEND),
                        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()),
                        intval($contact_id)
                );
                        dbesc(datetime_convert()),
                        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 {
                // update profile photos once every two weeks as we have no notification of when they change.
 
        } else {
                // 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',
                                                `addr` = '%s',
                                                `name` = '%s',
                                                `nurl` = '%s',
                                                `addr` = '%s',
                                                `name` = '%s',
-                                               `nick` = '%s'
+                                               `nick` = '%s',
+                                               `location` = '%s',
+                                               `about` = '%s'
                                        WHERE `id` = %d",
                                dbesc($photos[0]),
                                dbesc($photos[1]),
                                        WHERE `id` = %d",
                                dbesc($photos[0]),
                                dbesc($photos[1]),
@@ -1068,17 +1037,10 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
                                dbesc(statusnet_address($contact)),
                                dbesc($contact->name),
                                dbesc($contact->screen_name),
                                dbesc(statusnet_address($contact)),
                                dbesc($contact->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'])
-                               );
                }
        }
 
                }
        }
 
index 0f074ba3179375587accbd77f283a6cc81e58cad..74121d295e7a8084d467a122880174b59a512737 100644 (file)
@@ -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,
-                               "network" => NETWORK_TWITTER, "photo" => $avatar,  "hide" => true,
-                               "name" => $contact->name, "nick" => $contact->screen_name,
-                               "location" => $contact->location, "about" => $contact->description,
-                               "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)));
-       }
+       update_gcontact(array("url" => "https://twitter.com/".$contact->screen_name,
+                       "network" => NETWORK_TWITTER, "photo" => $avatar,  "hide" => true,
+                       "name" => $contact->name, "nick" => $contact->screen_name,
+                       "location" => $contact->location, "about" => $contact->description,
+                       "addr" => $contact->screen_name."@twitter.com", "generation" => 2));
 
        $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
                intval($uid), dbesc("twitter::".$contact->id_str));
 
        $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
                intval($uid), dbesc("twitter::".$contact->id_str));
@@ -979,10 +954,10 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
 
        if(!count($r)) {
                // create contact record
 
        if(!count($r)) {
                // 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` )
-                                       VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0) ",
+                                       `location`, `about`, `writable`, `blocked`, `readonly`, `pending`)
+                                       VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, 0, 0, 0)",
                        intval($uid),
                        dbesc(datetime_convert()),
                        dbesc("https://twitter.com/".$contact->screen_name),
                        intval($uid),
                        dbesc(datetime_convert()),
                        dbesc("https://twitter.com/".$contact->screen_name),
@@ -997,6 +972,8 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
                        dbesc(NETWORK_TWITTER),
                        intval(CONTACT_IS_FRIEND),
                        intval(1),
                        dbesc(NETWORK_TWITTER),
                        intval(CONTACT_IS_FRIEND),
                        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);
-
-               q("UPDATE `contact` SET `photo` = '%s',
-                                       `thumb` = '%s',
-                                       `micro` = '%s',
-                                       `name-date` = '%s',
-                                       `uri-date` = '%s',
-                                       `avatar-date` = '%s'
-                               WHERE `id` = %d",
-                       dbesc($photos[0]),
-                       dbesc($photos[1]),
-                       dbesc($photos[2]),
-                       dbesc(datetime_convert()),
-                       dbesc(datetime_convert()),
-                       dbesc(datetime_convert()),
-                       intval($contact_id)
-               );
+               $photos = import_profile_photo($avatar, $uid, $contact_id, true);
 
 
-               if (DB_UPDATE_VERSION >= "1177")
-                       q("UPDATE `contact` SET `location` = '%s',
-                                               `about` = '%s'
+               if ($photos) {
+                       q("UPDATE `contact` SET `photo` = '%s',
+                                               `thumb` = '%s',
+                                               `micro` = '%s',
+                                               `name-date` = '%s',
+                                               `uri-date` = '%s',
+                                                       `avatar-date` = '%s'
                                        WHERE `id` = %d",
                                        WHERE `id` = %d",
-                               dbesc($contact->location),
-                               dbesc($contact->description),
+                               dbesc($photos[0]),
+                               dbesc($photos[1]),
+                               dbesc($photos[2]),
+                               dbesc(datetime_convert()),
+                               dbesc(datetime_convert()),
+                               dbesc(datetime_convert()),
                                intval($contact_id)
                        );
                                intval($contact_id)
                        );
-
+               }
        } else {
                // update profile photos once every two weeks as we have no notification of when they change.
 
        } else {
                // 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']);
-
-                       q("UPDATE `contact` SET `photo` = '%s',
-                                               `thumb` = '%s',
-                                               `micro` = '%s',
-                                               `name-date` = '%s',
-                                               `uri-date` = '%s',
-                                               `avatar-date` = '%s',
-                                               `url` = '%s',
-                                               `nurl` = '%s',
-                                               `addr` = '%s',
-                                               `name` = '%s',
-                                               `nick` = '%s'
-                                       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),
-                               intval($r[0]['id'])
-                       );
-
-                       if (DB_UPDATE_VERSION >= "1177")
-                               q("UPDATE `contact` SET `location` = '%s',
+                       $photos = import_profile_photo($avatar, $uid, $r[0]['id'], true);
+
+                       if ($photos) {
+                               q("UPDATE `contact` SET `photo` = '%s',
+                                                       `thumb` = '%s',
+                                                       `micro` = '%s',
+                                                       `name-date` = '%s',
+                                                       `uri-date` = '%s',
+                                                       `avatar-date` = '%s',
+                                                       `url` = '%s',
+                                                       `nurl` = '%s',
+                                                       `addr` = '%s',
+                                                       `name` = '%s',
+                                                       `nick` = '%s',
+                                                       `location` = '%s',
                                                        `about` = '%s'
                                                WHERE `id` = %d",
                                                        `about` = '%s'
                                                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->description),
                                        intval($r[0]['id'])
                                );
                                        dbesc($contact->location),
                                        dbesc($contact->description),
                                        intval($r[0]['id'])
                                );
+                       }
                }
        }
 
                }
        }
 
index 434cb20421132b2315938b368aa7292aa313973e..6c76af7ce9b49cdefba058fa9b5ad47c7f924248 100644 (file)
@@ -49,19 +49,21 @@ function twitter_sync_run($argv, $argc){
        $mode = intval($argv[1]);
        $uid = intval($argv[2]);
 
        $mode = intval($argv[1]);
        $uid = intval($argv[2]);
 
-       /// @todo Replace it with "App::is_already_running" in the next release
-       $lockpath = get_lockpath();
-       if ($lockpath != '') {
-               $pidfile = new pidfile($lockpath, 'twitter_sync-'.$mode.'-'.$uid);
-               if ($pidfile->is_already_running()) {
-                       logger("Already running");
-                       if ($pidfile->running_time() > 9*60) {
-                               $pidfile->kill();
-                               logger("killed stale process");
-                               // Calling a new instance
-                               proc_run('php','addon/twitter/twitter_sync.php', $mode, $uid);
+       // This is deprecated with the worker
+       if (function_exists("get_lockpath")) {
+               $lockpath = get_lockpath();
+               if ($lockpath != '') {
+                       $pidfile = new pidfile($lockpath, 'twitter_sync-'.$mode.'-'.$uid);
+                       if ($pidfile->is_already_running()) {
+                               logger("Already running");
+                               if ($pidfile->running_time() > 9*60) {
+                                       $pidfile->kill();
+                                       logger("killed stale process");
+                                       // Calling a new instance
+                                       proc_run('php','addon/twitter/twitter_sync.php', $mode, $uid);
+                               }
+                               exit;
                        }
                        }
-                       exit;
                }
        }
 
                }
        }