X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fupdate_gcontact.php;h=97c825352eb26919930ea92c99727077875389d9;hb=c105a67cd9cb0669c492cb20d1153fac1c001b56;hp=88e1817f0b991ff6a0749c2d794b71510ab62b22;hpb=a4dd0b835c90c5dcd611a39354370cb3f860c7d7;p=friendica.git diff --git a/include/update_gcontact.php b/include/update_gcontact.php index 88e1817f0b..97c825352e 100644 --- a/include/update_gcontact.php +++ b/include/update_gcontact.php @@ -1,53 +1,33 @@ set_baseurl(get_config('system','url')); - - load_hooks(); + require_once 'include/probe.php'; + require_once 'include/socgraph.php'; logger('update_gcontact: start'); - if(($argc > 1) && (intval($argv[1]))) + if (($argc > 1) && (intval($argv[1]))) { $contact_id = intval($argv[1]); + } - if(!$contact_id) { + if (!$contact_id) { logger('update_gcontact: no contact'); return; } - // Don't check this stuff if the function is called by the poller - if (App::callstack() != "poller_run") - if (App::is_already_running('update_gcontact'.$contact_id, '', 540)) - return; - $r = q("SELECT * FROM `gcontact` WHERE `id` = %d", intval($contact_id)); - if (!$r) + if (!dbm::is_result($r)) { return; + } - if (!in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) + if (!in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) { return; + } $data = probe_url($r[0]["url"]); @@ -60,16 +40,16 @@ function update_gcontact_run(&$argv, &$argc){ return; } - if (($data["name"] == "") AND ($r[0]['name'] != "")) + if (($data["name"] == "") && ($r[0]['name'] != "")) $data["name"] = $r[0]['name']; - if (($data["nick"] == "") AND ($r[0]['nick'] != "")) + if (($data["nick"] == "") && ($r[0]['nick'] != "")) $data["nick"] = $r[0]['nick']; - if (($data["addr"] == "") AND ($r[0]['addr'] != "")) + if (($data["addr"] == "") && ($r[0]['addr'] != "")) $data["addr"] = $r[0]['addr']; - if (($data["photo"] == "") AND ($r[0]['photo'] != "")) + if (($data["photo"] == "") && ($r[0]['photo'] != "")) $data["photo"] = $r[0]['photo']; @@ -97,8 +77,3 @@ function update_gcontact_run(&$argv, &$argc){ dbesc(normalise_link($data["url"])) ); } - -if (array_search(__file__,get_included_files())===0){ - update_gcontact_run($_SERVER["argv"],$_SERVER["argc"]); - killme(); -}