Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by Angeles Sanchez -
Number of replies: 14
First forgive my bad English ...

 I wanted to try the new Moodl three upgrading from my previous Moodle 2.9.3 release. When checking the plugins tells me he's right, but by giving Update database shows me the following error and then we can not continue:

 Fatal error: Class 'question_graded_automatically' not found in question.php on line 37

 I purged the cache and checked the permissions ... 

Does anyone have any solution? Yes

Average of ratings: Useful (2)
In reply to Angeles Sanchez

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by Bas van Kollenburg -

Did you do a fresh upload, no overwrite?

In reply to Bas van Kollenburg

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by Angeles Sanchez -
Thanks for answering.
If I made a fresh upload, leaving only the config.php file.
In reply to Angeles Sanchez

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by Salvador Banderas Rovira -

OK, I tried the following (no success):

  • Upgraded directly the "moodle" directory via Git.
  • Renamed the "moodle" directory and downloaded it again via Git.
  • Renamed the "moodle" directory and downloaded it again via .tgz package.

Upgrading process always gets stuck at table "qtype_multianswer" and the same error:

PHP Fatal error: Class 'question_graded_automatically' not found in /var/www/html/moodle/question/type/multichoice/question.php on line 37

I tried "git status", as Tim suggested in the tracker, but everything seemed OK, so the files are the right ones:

On branch MOODLE_30_STABLE

Your branch is up-to-date with 'origin/MOODLE_30_STABLE'.

nothing to commit, working directory clean

My previous version is 2.9.3 also, upgraded last week from 2.6.x with no problems.

As I am trying this in a test server, I'm gonna tweak some core files so that they give me more information about what's going on.

In reply to Angeles Sanchez

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by Salvador Banderas Rovira -

I tried one last thing and I got it to upgrade: upgrading via CLI.

As www-data:

/usr/bin/php /var/www/html/moodle/admin/cli/upgrade.php

It just worked. No errors. No warnings. Nothing.

Any ideas why upgrading via browser seems to be failing for some of us (strangely all Spanish speakers)?

Average of ratings: Useful (2)
In reply to Salvador Banderas Rovira

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by Angeles Sanchez -
Thank Salvador, for your answers. I also keep investigating ... If I get something I'll put it in the forum. : )
 My English is bad , prefer the Spanish ...
In reply to Salvador Banderas Rovira

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by Angeles Sanchez -
I tried installing again from git with the latest stable copy of Moodle 3.
In the end I finished the installation without problem, following the instructions and deleting the following line:

require_once($CFG->dirroot . '/question/type/multianswer/questiontype.php');

in the file: question/type/multianswer/db/upgrade.php



Thank you ; )


In reply to Angeles Sanchez

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by David Monllaó -

Thanks for commenting, good to know. Can you please confirm if you are using memcached or any particular cache stores configuration?

PD: Soy de Tarragona smile

In reply to Angeles Sanchez

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by Emanuelis Norbutas -

I can confirm the error when upgrading 2.9.3 -> 3.0 via browser:

[17-Nov-2015 22:24:30 Europe/Vilnius] PHP Fatal error:  Class 'question_graded_automatically' not found in /var/www/moodle/moodle/question/type/multichoice/question.php on line 37


Upgrading via CLI went fine without errors.


Average of ratings: Useful (1)
In reply to Angeles Sanchez

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by David Monllaó -

Hey, many thanks for reporting this.

Can you please try applying https://github.com/dmonllao/moodle/compare/MDL-52162_30~...MDL-52162_30 patch or simply removing require_once($CFG->dirroot . '/question/type/multianswer/questiontype.php'); from question/type/multianswer/db/upgrade.php file?

Also can you confirm if you are using memcached, mongodb or any non-default cache store?

Thanks in advance

In reply to David Monllaó

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by Angeles Sanchez -
After seeing :
https://github.com/dmonllao/moodle/compare/MDL-52162_30~...MDL-52162_30

I simply removed:

require_once($CFG->dirroot . '/question/type/multianswer/questiontype.php');

from question/type/multianswer/db/upgrade.php file

I have not used memcached or mongodb , only the default cache store .
A greeting
In reply to Angeles Sanchez

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by David Monllaó -

The provided solution is being integrated and Marina found a way to reproduce using unavailable cache stores, but we need to know why your web upgrades are broken if you are using the default cache stores configuration. The fatal error class should be included when purging questiondata cache definition, by default this definition is mapped to the default application cache, which is a cachestore_file type.

Angeles, Bas or Salvador, any information you could provide us about your $CFG->dataroot (where the caches config is stored) or about $CFG options you are setting in your config.php (like $CFG->altcacheconfigpath...) would be appreciated. If you could add the following two lines in your config.php (before the require_once to setup.php) that would probably output extra information that we could use to find the root cause of the problem.


$CFG->debug = E_ALL;
$CFG->debugdisplay = 1;  


Thanks in advance

Average of ratings: Useful (1)
In reply to David Monllaó

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by Angeles Sanchez -
I enabled debugging in config.php but no error is shown .
All we have had this error had the Spanish language. Is he related to the elimination of Spanish language package was removed from moodle 2.6?

- In fact I upgraded from 2.4 to 2.6 first and to avoid the error of the solution used to add:
" ... index.php ? lang = es " .

- Later upgraded to 2.9 , I change the language of the admin and proceeded to upgrade to Moodle 3. That's when he gave me the error.

If you can not have a relationship , I do not understand programming ....: )

PD. Por cierto, David, soy de Granada. Mi inglés es pésimo, pero al ser el foro inglés...
Usé este foro porque cuando he abierto un tema en el foro español, las respuestas tardan bastante más.
In reply to Angeles Sanchez

Re: Fatal Error Upgrading Moodle 2.9.3 to Moodle 3

by David Monllaó -

Thanks for the reply Angeles,

Sorry, I probably didn't express well what I meant. We are interested in knowing why your upgrade process triggered that error; before that fatal error, Moodle probably triggered other errors, but these other errors are only displayed in your browser when you have these 2 lines in your config.php, so I was asking if you could please run again the upgrade process, setting these 2 lines in your config.php before starting the upgrade from 2.9 to 3.0, and without applying the patch that fixes the issue. The idea is to reproduce the same fatal error you got plus other "debugging" messages, we need these "possible" debugging messages to know why is failing for you. If you don't want to paste sensitive info in here and it is fine for you, feel free to send it to davidm@moodle.com.


Reply in Spanish:

Ningun problema, yo tambien soy desastrillo en ingles smile Hasta ahora solo hemos podido reproducir tu error con una configuracion diferente a la tuya, y necesitamos saber mas para poder identificar bien el problema porque durante estos meses hemos actualizado muchas veces usando el navegador y no habiamos detectado este problema, si lo identificamos podremos ayudar a otra gente que seguramente le pasara lo mismo. Te pedia si podrias volver a actualizar de 2.9 a 3.0 (no en produccion claro) sin el parche que soluciona el problema, para reproducir el mismo fatal error que veias, pero anadiendo esas dos lineas a tu config.php (antes del require_once al fichero setup.php que esta al final) antes de ejecutar el upgrade. Si no puedes pegar aqui informacion sensible por ser un sitio publico puedes enviarme a mi lo que sea a davidm@moodle.com