catalyst / moodle-tool_webanalytics

A Moodle admin tool adding Web Analytics to your Moodle site.
https://moodle.org/plugins/tool_webanalytics
7 stars 10 forks source link

Error reading from database #22

Closed agogo123 closed 4 years ago

agogo123 commented 4 years ago

Hello,

I've recently downloaded this tool and found myself stuck with the error "Scheduled task failed: Link crawler robot (tool_crawler\task\crawl_task),Error reading from database". My environment runs moodle on Windows Server 2012 R2 with the database server being SQL Server 2012 R2.

I've put my moodle into developer debugger mode and found that there is a SQL error that is specific to SQL Server.

Here is the information: Link crawler robot Execute scheduled task: Link crawler robot (tool_crawler\task\crawl_task) ... started 15:05:27. Current memory use 6.4MB. ... used 3 dbqueries ... used 0.057562828063965 seconds Scheduled task failed: Link crawler robot (tool_crawler\task\crawl_task),Error reading from database Debug info: SQLState: 42000
Error Code: 102
Message: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Incorrect syntax near 'LIMIT'.

SELECT * FROM mdl_tool_crawler_url WHERE lastcrawled IS NULL OR lastcrawled < needscrawl ORDER BY needscrawl ASC, id ASC LIMIT 1

[array ( )] Backtrace:

For SQL Server, the SQL should be:

SELECT top 1 * FROM mdl_tool_crawler_url WHERE lastcrawled IS NULL OR lastcrawled < needscrawl ORDER BY needscrawl ASC, id ASC

dmitriim commented 4 years ago

Seems like you messed with the plugin @agogo123 Please log your bug in https://github.com/catalyst/moodle-tool_crawler

agogo123 commented 4 years ago

dmitriim, I didn't play around with the plugin. I looked into the code to understand why it wasn't working for me. Has this plugin ever worked with a SQL Server DB?