scrape.php not working properly and exit with error because using module_invoke() function with only DRUPAL_BOOTSTRAP_DATABASE bootstrap, but this function is not available yet.

We can do DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE, but this resolution eats more resources.

I think it is better to move bt_tracker_scrape() to bt_common.inc (or maybe directly to scrape.php?)
Patch attached.

Additionally, I move some code from bt_torrent_cron() to bt_tracker_cron() because we need scrape local tracker only if it enabled.

And I split bt_tracker_scrape() in two parts:
One part goes to bt_common.inc and names scrape()
Second part goes to bt_tracker/bt_tracker.module and names bt_tracker_scrape_local()

I think this split is needed because we must retrieve seed/leech/downloaded data from "bt_torrents" table and not from to minimize load (4 SELECTs vs 1 SELECT). And bt_tracker_scrape_local() will be used to retrieve data from local tracker only.

In this patch I remove using of 'bt_tracker_scrape_scope' variable.
New variable "bt_last_stats" is now using to store last scrape time for local tracker.
I found unused (but defined on admin form) variable "bt_tracker_stats_interval" and use it in my patch.

Sorry for my bad English :)

Comments

hapydoyzer’s picture

Assigned: Unassigned » hapydoyzer
Status: Needs review » Needs work

This issue is NOT fixed in latest CVS (currently commit #211946) as I can see looking throw code.

Try to retrieve some statistic information from scrape.php and you see the error message.

Patch is NOT for current CVS version now. I will update it later.

liquixis’s picture

> Patch is NOT for current CVS version now. I will update it later.
Не обязательно, я могу ручками вхерачить ;)
Главное разобраться действительно ли это лучший способ это реализовать. А посему предлагаю списаться по мылу и по русски, что бы облегчить взаимопонимание...