]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #1426 from annando/1503-term-search
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Thu, 12 Mar 2015 06:15:05 +0000 (07:15 +0100)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Thu, 12 Mar 2015 06:15:05 +0000 (07:15 +0100)
The index for the term search is now massively improved

1  2 
boot.php

diff --combined boot.php
index 05284dce4335314e21946b87a432ff2e85b04046,c44465b10cabddf783c15e8073654140e41617bb..5a5437175ef26a9cdd26d541b41be75b23a6096a
+++ b/boot.php
@@@ -18,7 -18,7 +18,7 @@@ define ( 'FRIENDICA_PLATFORM',     'Fri
  define ( 'FRIENDICA_CODENAME',     'Ginger');
  define ( 'FRIENDICA_VERSION',      '3.3.3' );
  define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
- define ( 'DB_UPDATE_VERSION',      1181      );
+ define ( 'DB_UPDATE_VERSION',      1182      );
  define ( 'EOL',                    "<br />\r\n"     );
  define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
  
@@@ -1196,24 -1196,35 +1196,24 @@@ if(! function_exists('check_plugins')) 
        }
  }
  
 -function get_guid($size=16) {
 -      $exists = true; // assume by default that we don't have a unique guid
 -      do {
 -              $prefix = "";
 -              while (strlen($prefix) < ($size - 13))
 -                      $prefix .= mt_rand();
 -
 -              $s = substr(uniqid($prefix), -$size);
 -
 -              $r = q("select id from guid where guid = '%s' limit 1", dbesc($s));
 -              if(! count($r))
 -                      $exists = false;
 -      } while($exists);
 -      q("insert into guid (guid) values ('%s') ", dbesc($s));
 -      return $s;
 -}
 +function get_guid($size=16, $prefix = "") {
 +
 +      if ($prefix == "") {
 +              $a = get_app();
 +              $prefix = hash("crc32", $a->get_hostname());
 +      }
  
 -/*function get_guid($size=16) {
 -      $exists = true; // assume by default that we don't have a unique guid
 -      do {
 -              $s = random_string($size);
 -              $r = q("select id from guid where guid = '%s' limit 1", dbesc($s));
 -              if(! count($r))
 -                      $exists = false;
 -      } while($exists);
 -      q("insert into guid ( guid ) values ( '%s' ) ", dbesc($s));
 -      return $s;
 -}*/
 +      while (strlen($prefix) < ($size - 13))
 +              $prefix .= mt_rand();
  
 +      if ($size >= 24) {
 +              $prefix = substr($prefix, 0, $size - 22);
 +              return(str_replace(".", "", uniqid($prefix, true)));
 +      } else {
 +              $prefix = substr($prefix, 0, $size - 13);
 +              return(uniqid($prefix));
 +      }
 +}
  
  // wrapper for adding a login box. If $register == true provide a registration
  // link. This will most always depend on the value of $a->config['register_policy'].