]> git.mxchange.org Git - friendica.git/commitdiff
scrape_url - use feed url if no name can be found
authorFriendika <info@friendika.com>
Sun, 4 Sep 2011 12:07:25 +0000 (05:07 -0700)
committerFriendika <info@friendika.com>
Sun, 4 Sep 2011 12:07:25 +0000 (05:07 -0700)
include/Scrape.php
include/delivery.php
include/notifier.php

index cc46af64454be5d6b9254da8b3cdc5f9510ff0a7..bf64c2243fedac734009bb6faa3aa561bb0c2f42 100644 (file)
@@ -332,10 +332,12 @@ function probe_url($url, $mode = PROBE_NORMAL) {
        if(! $url)
                return $result;
 
+       $network = null;
        $diaspora = false;
        $diaspora_base = '';
        $diaspora_guid = '';    
        $diaspora_key = '';
+       $has_lrdd = false;
        $email_conversant = false;
 
        $twitter = ((strpos($url,'twitter.com') !== false) ? true : false);
@@ -352,6 +354,8 @@ function probe_url($url, $mode = PROBE_NORMAL) {
                        $links = lrdd($url);
 
                if(count($links)) {
+                       $has_lrdd = true;
+
                        logger('probe_url: found lrdd links: ' . print_r($links,true), LOGGER_DATA);
                        foreach($links as $link) {
                                if($link['@attributes']['rel'] === NAMESPACE_ZOT)
@@ -493,7 +497,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
        if($network !== NETWORK_ZOT && $network !== NETWORK_DFRN && $network !== NETWORK_MAIL) {
                if($diaspora)
                        $network = NETWORK_DIASPORA;
-               else
+               elseif($has_lrdd)
                        $network  = NETWORK_OSTATUS;
                $priority = 0;
 
@@ -637,7 +641,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
                                        $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
                        }
                        if(! $network)
-                               $network = 'feed';
+                               $network = NETWORK_FEED;
                        if(! $priority)
                                $priority = 2;
                }
@@ -651,10 +655,14 @@ function probe_url($url, $mode = PROBE_NORMAL) {
        if(! $profile)
                $profile = $url;
 
-       $vcard['fn'] = notags($vcard['fn']);
-       $vcard['nick'] = str_replace(' ','',notags($vcard['nick']));
+       // No human could be associated with this link, use the URL as the contact name
 
+       if(($network === NETWORK_FEED) && ($poll) && (! x($vcard,'fn')))
+               $vcard['fn'] = $url;
 
+       $vcard['fn'] = notags($vcard['fn']);
+       $vcard['nick'] = str_replace(' ','',notags($vcard['nick']));
+               
        $result['name'] = $vcard['fn'];
        $result['nick'] = $vcard['nick'];
        $result['url'] = $profile;
index 7f45fb2fa71ab977d2ae08679731c6235a24ff6a..18ef09a3121a8ee0f4d72bc2f686d07828e68a44 100644 (file)
@@ -419,7 +419,8 @@ function delivery_run($argv, $argc){
                                diaspora_send_relay($target_item,$owner,$contact);
                                break;
                        }               
-                       elseif($top_level) {
+                       elseif(($top_level) && (! $walltowall)) {
+                               // currently no workable solution for sending walltowall
                                logger('delivery: diaspora status: ' . $contact['name']);
                                diaspora_send_status($target_item,$owner,$contact);
                                break;
index 0bb82b7bf802015401567c74d5faae102cd035bd..6ac882c1992cf96511901f3c6f54033444aaffc2 100644 (file)
@@ -2,6 +2,20 @@
 
 require_once("boot.php");
 
+/*
+ * This file was at one time responsible for doing all deliveries, but this caused
+ * big problems on shared hosting systems, where the process might get killed by the 
+ * hosting provider and nothing would get delivered. 
+ * It now only delivers one message under certain cases, and invokes a queued
+ * delivery mechanism (include/deliver.php) to deliver individual contacts at 
+ * controlled intervals.
+ * This has a much better chance of surviving random processes getting killed
+ * by the hosting provider. 
+ * A lot of this code is duplicated in include/deliver.php until we have time to go back
+ * and re-structure the delivery procedure based on the obstacles that have been thrown at 
+ * us by hosting providers. 
+ */
+
 function notifier_run($argv, $argc){
        global $a, $db;
 
@@ -594,7 +608,8 @@ function notifier_run($argv, $argc){
                                                diaspora_send_relay($target_item,$owner,$contact);
                                                break;
                                        }               
-                                       elseif($top_level) {
+                                       elseif(($top_level) && (! $walltowall)) {
+                                               // currently no workable solution for sending walltowall
                                                diaspora_send_status($target_item,$owner,$contact);
                                                break;
                                        }