catalyst / moodle-tool_crawler

A moodle link crawling robot, find broken, slow and oversized links
https://moodle.org/plugins/tool_crawler
10 stars 18 forks source link

Adhoc task fails if config->crawlstart does not correspond to a record in the crawler_history table #165

Open cameron1729 opened 2 years ago

cameron1729 commented 2 years ago

The tool_crawler_crawl function uses the plugin setting crawlstart (from the mdl_config_plugins table) to find a record in mdl_tool_crawler_history. It is possible that there can be no such record with this value in mdl_tool_crawler history.

The record from the history table is attempted to be loaded here: https://github.com/catalyst/moodle-tool_crawler/blob/MOODLE_310_STABLE/lib.php#L75

If it isn't found, no error is raised. Then later an attempt to write to the DB is made here: https://github.com/catalyst/moodle-tool_crawler/blob/MOODLE_310_STABLE/lib.php#L96 but it fails since we have no ID.