After upgrading from 3.5.1 to 3.7.1 cron is not working

Re: After upgrading from 3.5.1 to 3.7.1 cron is not working

by Leon Stringer -
Number of replies: 1
Picture of Core developers Picture of Particularly helpful Moodlers

The error is saying that the database INSERT statement is inserting a different number of values to the number of columns but the INSERT statement is explicitly stating 10 columns and 10 values.

Is that the full error message? The tenth column (i.e. index 9 in the array) should terminate with a single quote (').

Check the Environment report and see if there are any warnings or errors.

Is the PHP version that cron.php is being run with the expected version? It's possible that there are two different versions installed with different settings. For the command you are using for cron, run php with --version to check this.

Check MariaDB's log to see if that reports anything that coincides with these issues. On my system this is in /var/log/mariadb/mariadb.log but it may be somewhere else on yours.

If there's a time when the site is quiet, preferably with no one using it, you could use MySQL general logging to see the exact INSERT statement and response from MariaDB. You can then try that statement manually as a test. Because there are 10 columns and 10 values this error shouldn't occur and this may help identify the problem.

I think the collation utf8mb4_unicode_ci is recommended regardless of the language is use.

In reply to Leon Stringer

Re: After upgrading from 3.5.1 to 3.7.1 cron is not working

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
What Leon says... that insert statement isn't valid.

Which is very odd.

Next step is to turn up Debugging to full and get a better trace so that we know exactly where this is happening in the Moodle code.