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.
 
 
 
 
 
 

52 lines
1.1 KiB

  1. <?php
  2. /**
  3. * @file include/spool_post.php
  4. * @brief Posts items that wer spooled because they couldn't be posted.
  5. */
  6. use \Friendica\Core\Config;
  7. require_once("boot.php");
  8. require_once("include/items.php");
  9. function spool_post_run($argv, $argc) {
  10. global $a, $db;
  11. if (is_null($a)) {
  12. $a = new App;
  13. }
  14. if (is_null($db)) {
  15. @include(".htconfig.php");
  16. require_once("include/dba.php");
  17. $db = new dba($db_host, $db_user, $db_pass, $db_data);
  18. unset($db_host, $db_user, $db_pass, $db_data);
  19. }
  20. Config::load();
  21. $path = get_spoolpath();
  22. if (is_writable($path)){
  23. if ($dh = opendir($path)) {
  24. while (($file = readdir($dh)) !== false) {
  25. $fullfile = $path."/".$file;
  26. if (filetype($fullfile) != "file") {
  27. continue;
  28. }
  29. $arr = json_decode(file_get_contents($fullfile), true);
  30. $result = item_store($arr);
  31. logger("Spool file ".$file." stored: ".$result, LOGGER_DEBUG);
  32. unlink($fullfile);
  33. }
  34. closedir($dh);
  35. }
  36. }
  37. }
  38. if (array_search(__file__, get_included_files()) === 0) {
  39. spool_post_run($_SERVER["argv"], $_SERVER["argc"]);
  40. killme();
  41. }
  42. ?>