Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
922 B

  1. <?php
  2. use \Friendica\Core\Config;
  3. function directory_run(&$argv, &$argc){
  4. $dir = get_config('system', 'directory');
  5. if (!strlen($dir)) {
  6. return;
  7. }
  8. if ($argc < 2) {
  9. directory_update_all();
  10. return;
  11. }
  12. $dir .= "/submit";
  13. $arr = array('url' => $argv[1]);
  14. call_hooks('globaldir_update', $arr);
  15. logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
  16. if (strlen($arr['url'])) {
  17. fetch_url($dir . '?url=' . bin2hex($arr['url']));
  18. }
  19. return;
  20. }
  21. function directory_update_all() {
  22. $r = q("SELECT `url` FROM `contact`
  23. INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid`
  24. INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
  25. WHERE `contact`.`self` AND `profile`.`net-publish` AND `profile`.`is-default` AND
  26. NOT `user`.`account_expired` AND `user`.`verified`");
  27. if (dbm::is_result($r)) {
  28. foreach ($r AS $user) {
  29. proc_run(PRIORITY_LOW, 'include/directory.php', $user['url']);
  30. }
  31. }
  32. }