update_feeds.php 925 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/php4
  2. <?php
  3. // this script is probably run not from your httpd-user, so cache
  4. // directory defined in config.php won't be accessible
  5. define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache-cli');
  6. define('DISABLE_SESSIONS', true);
  7. require_once "sanity_check.php";
  8. require_once "config.php";
  9. require_once "db.php";
  10. require_once "db-prefs.php";
  11. require_once "functions.php";
  12. require_once "magpierss/rss_fetch.inc";
  13. $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
  14. if (!$link) {
  15. if (DB_TYPE == "mysql") {
  16. print mysql_error();
  17. }
  18. // PG seems to display its own errors just fine by default.
  19. return;
  20. }
  21. if (DB_TYPE == "pgsql") {
  22. pg_query("set client_encoding = 'utf-8'");
  23. }
  24. $result = db_query($link, "SELECT id FROM ttrss_users");
  25. while ($line = db_fetch_assoc($result)) {
  26. $user_id = $line["id"];
  27. update_all_feeds($link, false, $user_id, true);
  28. }
  29. db_close($link);
  30. ?>