]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into 1702-detect-server
authorMichael <heluecht@pirati.ca>
Fri, 17 Mar 2017 15:53:19 +0000 (15:53 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 17 Mar 2017 15:53:19 +0000 (15:53 +0000)
Conflicts:
include/discover_poco.php

1  2 
include/cron.php
include/discover_poco.php
mod/admin.php

Simple merge
index 91cc0b6083a123622fad7c68514be6a68e643798,0384483a40dd54e6fc89f6d4e37f39240ef150a7..8e392f67d3ddc06c918c8f635bd8a033be9ad488
@@@ -2,43 -2,12 +2,21 @@@
  
  use \Friendica\Core\Config;
  
- require_once("boot.php");
- require_once("include/socgraph.php");
+ require_once('include/socgraph.php');
+ require_once('include/datetime.php');
  
  function discover_poco_run(&$argv, &$argc){
-       global $a, $db;
-       if(is_null($a)) {
-               $a = new App;
-       }
-       if(is_null($db)) {
-           @include(".htconfig.php");
-       require_once("include/dba.php");
-           $db = new dba($db_host, $db_user, $db_pass, $db_data);
-       unset($db_host, $db_user, $db_pass, $db_data);
-       };
-       require_once('include/session.php');
-       require_once('include/datetime.php');
-       Config::load();
-       // Don't check this stuff if the function is called by the poller
-       if (App::callstack() != "poller_run")
-               if ($a->maxload_reached())
-                       return;
  
-       if(($argc > 2) && ($argv[1] == "dirsearch")) {
 +      /*
 +      This function can be called in these ways:
 +      - dirsearch <search pattern>: Searches for "search pattern" in the directory. "search pattern" is url encoded.
 +      - checkcontact: Updates gcontact entries
 +      - suggestions: Discover other servers for their contacts.
 +      - server <poco url>: Searches for the poco server list. "poco url" is base64 encoded.
 +      - update_server: Frequently check the first 250 servers for vitality.
 +      */
 +
+       if (($argc > 2) && ($argv[1] == "dirsearch")) {
                $search = urldecode($argv[2]);
                $mode = 1;
        } elseif(($argc == 2) && ($argv[1] == "checkcontact")) {
        } elseif ($argc == 1) {
                $search = "";
                $mode = 0;
 -      } else
 +      } else {
                die("Unknown or missing parameter ".$argv[1]."\n");
 +      }
  
-       // Don't check this stuff if the function is called by the poller
-       if (App::callstack() != "poller_run")
-               if (App::is_already_running('discover_poco'.$mode.urlencode($search), 'include/discover_poco.php', 1140))
-                       return;
-       $a->set_baseurl(get_config('system','url'));
-       load_hooks();
        logger('start '.$search);
  
 -      if ($mode==3)
 +      if ($mode == 5) {
 +              update_server();
 +      } elseif ($mode == 4) {
 +              $server_url = base64_decode($argv[2]);
 +              if ($server_url == "") {
 +                      return;
 +              }
 +              $server_url = filter_var($server_url, FILTER_SANITIZE_URL);
 +              if (substr(normalise_link($server_url), 0, 7) != "http://") {
 +                      return;
 +              }
 +              $result = "Checking server ".$server_url." - ";
 +              $ret = poco_check_server($server_url);
 +              if ($ret) {
 +                      $result .= "success";
 +              } else {
 +                      $result .= "failed";
 +              }
 +              logger($result, LOGGER_DEBUG);
 +      } elseif ($mode == 3) {
                update_suggestions();
 -      elseif (($mode == 2) AND get_config('system','poco_completion'))
 +      } elseif (($mode == 2) AND get_config('system','poco_completion')) {
                discover_users();
 -      elseif (($mode == 1) AND ($search != "") and get_config('system','poco_local_search')) {
 +      elseif (($mode == 1) AND ($search != "") and get_config('system','poco_local_search')) {
                discover_directory($search);
                gs_search_user($search);
        } elseif (($mode == 0) AND ($search == "") and (get_config('system','poco_discovery') > 0)) {
diff --cc mod/admin.php
Simple merge