Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: Upgrading to Moodle 2.0.

Upgrading to Moodle 2.0: Difference between revisions

From MoodleDocs
 
(34 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Moodle 2.0}}When upgrading to Moodle 2.0, you must have Moodle 1.9 or later. if you are using an earlier version of Moodle (eg 1.8.x) then you need to upgrade to Moodle 1.9.x first.
{{Installing Moodle}}
When upgrading to Moodle 2.0, you must have Moodle 1.9 or later. if you are using an earlier version of Moodle (eg 1.8.x) then you need to upgrade to Moodle 1.9.x first.


We advise that you test the upgrade first on a COPY of your production site, to make sure it works as you expect.  
'''We advise that you test the upgrade first on a COPY of your production site, to make sure it works as you expect. Moodle 2.0 is a substantial upgrade and may require more planning and testing than you have become accustomed to in prior upgrades. Please read this page carefully before proceeding.'''




Line 18: Line 19:
** Opera 9 or later
** Opera 9 or later
** MS Internet Explorer 7 or later (Even [http://googleenterprise.blogspot.com/2010/01/modern-browsers-for-modern-applications.html Google does not support IE6 any more])
** MS Internet Explorer 7 or later (Even [http://googleenterprise.blogspot.com/2010/01/modern-browsers-for-modern-applications.html Google does not support IE6 any more])
==Moodle 2.0 Planning==
Moodle 2.0 is substantially different to the versions that went before it. You should expect much more planning and testing to be involved in upgrading to 2.0. It is highly likely not to be as straightforward as upgrades through earlier versions. Please read this document carefully and follow the advice. Please ask in the forums if you are not sure of anything. Don't try to upgrade your huge 1.9 production site over a weekend with no prior testing.
If you want to "just try it", fine, but please do it on a test '''copy''' of your production site.
If your users and admins have become accustomed to Moodle 1.9 you should note that there are some changes in the user interface. Again, it is a very good idea to upgrade a copy of your site and establish how you will be affected by the changes and what training and support your users may require (if any).
Lastly, consider not upgrading at all. It might be a good time to start with a completely fresh install of Moodle 2.0 and migrate your courses over (note that restoring 1.9 course backups into Moodle 2 will not be available until Moodle 2.1 is released).


==Before upgrading please... ==
==Before upgrading please... ==
Line 23: Line 34:
'''NOTE''': The upgrade process will irreversibly modify the contents of your database '''and''' your moodledata file storage area. If something goes wrong you '''cannot''' go back. It is vital that you take good backups of both moodledata and the database in case you have problems with the upgrade. If you are not sure how see [[Site backup]] or ask in the moodle.org forums (explaining what your operating system is).   
'''NOTE''': The upgrade process will irreversibly modify the contents of your database '''and''' your moodledata file storage area. If something goes wrong you '''cannot''' go back. It is vital that you take good backups of both moodledata and the database in case you have problems with the upgrade. If you are not sure how see [[Site backup]] or ask in the moodle.org forums (explaining what your operating system is).   


* It's a good idea to read the [[dev:Latest release notes]] and the [[dev:Moodle 2.0 release notes]]
* Always check your site to make sure it meets all system requirements for 2.0 in ''Administration > Server > [[Environment]]''
* Always check your site to make sure it meets all system requirements for 2.0 in ''Administration > Server > [[Environment]]''
* '''Do a full database backup!'''
* '''Do a full database backup!'''
* '''Do a full moodledata backup'''
* '''Do a full moodledata backup'''
* '''Check your backups carefully'''
* '''Check your backups carefully'''
* You must be running version 1.9 and it's probably a good idea to upgrade to the '''latest''' 1.9 if you have not done so already.
* Remember to purge PHP cache if using any PHP accelerator
* Remember to purge PHP cache if using any PHP accelerator
'''Any kind of 1.9 code in your installation will most likely stop the upgrade from completing. Don't try it!'''


==A word about optional plugins and themes==
==A word about optional plugins and themes==
Line 33: Line 48:
If you have added optional or customised plugins (whether your own custom developments or from the plugins and modules database) or are using a non-core theme you must note that these will '''not''' work in Moodle 2.0+. While some plugins have been modified to work in Moodle 2.0+ at the time of writing most have not. The themes system is completely different in 2.0+ and all custom themes will require a complete rewrite.  
If you have added optional or customised plugins (whether your own custom developments or from the plugins and modules database) or are using a non-core theme you must note that these will '''not''' work in Moodle 2.0+. While some plugins have been modified to work in Moodle 2.0+ at the time of writing most have not. The themes system is completely different in 2.0+ and all custom themes will require a complete rewrite.  


Do not try to include any (old 1.9) optional plugins and themes in your Moodle 2.0 - it won't work. You should check to see if a 2.0 version is available. If not, you can safely ignore the message that the code is missing for the plugin during the upgrade. You will loose the functionality but the database tables will be retained (dormant) in case a 2.0 version of the plugin is produced in the future.
Do not try to include any (old 1.9) optional plugins and themes (or '''any''' 1.9 code) in your Moodle 2.0 - it won't work. You should check to see if a 2.0 version is available. If not, you can safely ignore the message that the code is missing for the plugin during the upgrade. You will lose the functionality but the database tables will be retained (dormant) in case a 2.0 version of the plugin is produced in the future.
 
== Required changes in database privileges ==
 
Moodle 2.x now uses temporary database tables, especially for backup and restore purpose. Make sure that the database account defined in config.php is allowed to create these temporary tables in its database. For MySQL, this is controlled by CREATE TEMPORARY TABLES privilege and you may need to grant that explicitly. In other database systems, your account probably has this permission already.


==Checking database schema - old sites==
==Checking database schema - old sites==


If your 1.9 Moodle site has been upgraded through many prior versions it is quite likely that there will be some problems with the database schema (compared to a fresh 1.9 installation). This may cause the upgrade to fail. It is a very good idea to check and correct the database schema before upgrading. See [[Verify Database Schema]]
This section is particularly relevant if you experience database errors during the upgrade.
 
If your 1.9 Moodle site has been upgraded through many prior versions (typically if it first existed prior to version 1.7) it is quite likely that there will be some problems with the database schema (compared to a fresh 1.9 installation). This may cause the upgrade to fail. If your site started life prior to Moodle 1.9 it is a very good idea to check and correct the database schema before upgrading. See [[Verify Database Schema]]. You should also run the database integrity checks in the XMLDB editor, see the 'See also' for a link to extra scripts to check for other discrepancies.


==Now upgrade==
==Now upgrade==
Line 43: Line 64:
Once you have satisfied the requirements for Moodle 2.0, follow the instructions on the [[Upgrading|upgrading]] page.
Once you have satisfied the requirements for Moodle 2.0, follow the instructions on the [[Upgrading|upgrading]] page.


Moodle 2.0 supports running the [[CLI|upgrade from the command line]], rather than through a web browser. This is likely to be more reliable, particularly for large sites.
On Linux servers, Moodle 2.0 supports running the [[CLI|upgrade from the command line]], rather than through a web browser. This is likely to be more reliable, particularly for large sites.


Note, if you get a strange error about 'handling of PHP float numbers', please see [[Installation_FAQ#Moodle_claims_PHP_float_handling_is_not_compatible|this FAQ entry]].
==If it doesn't work==


== Verify the upgrade (optional) ==
If the upgrade fails for any reason, it is imperative that you completely restore the 1.9 site from your backups before trying again. This particularly applies to moodledata. A likely result of not doing this is your files being lost in 2.x
If you wish to confirm that the database definitions in the upgraded database match the definitions of a new, clean install (which they should) you might like to look at [[Verify Database Schema]].
 
==After upgrade==
 
The config.php file from your 1.9 installation should work fine but if you take a look at config-dist.php that came with Moodle 2.0 there are more/different options available (e.g. database drivers and settings). It's a good idea to map your old config.php settings to a new one based on the 2.0 config-dist.php.
 
Don't forget to transfer any password salt values in your old config.php (otherwise nobody will be able to login).
 
Update your php commandline cron jobs to point to the admin/cli/cron.php.
 
In versions 1.x, you could execute admin/cron.php either from command line or via the web. Since Moodle 2.0, the admin/cli/cron.php script can ''only'' be run via the command line.


== Known and Discovered Issues ==
== Known and Discovered Issues ==
Many people are concerned that their install/upgrade is reporting the php extension '''intl''' is not installed or available. The intl.dll file is available in later releases of PHP but many hosts may not have a later release. To remedy this problem, discuss with your host the issue you are having and inform them that the problem is easy fixed by either upgrading their php to a newer version or to download the intl.dll and copy it to the php/ext folder. Add to the php.ini file the line:
  extension=php_intl.dll
in the ''Dynamic Extensions'' section of the file.  The problem should then be resolved.


Moodle 2.0 also requires the use of the PHP zip extension. For most installs this is not an issue, but for some, all it needs is for the line:
* If you get an error about 'handling of PHP float numbers', please see the [[Installation_FAQ|'Moodle claims PHP float handling is not compatible' FAQ]].
  extension=php_zip.dll
* You now need some additional PHP modules installed (e.g. intl and the zip extension). If you do not have these, installation them depends entirely on how your PHP was first installed and your operating system.
in the ''Dynamic Extensions'' section to be uncommented.
 
==Converting courses from 1.9 to 2.0==
At present the usual way to do this is via a 1.9 to 2.0 upgrade as described above. It is not possible to import 1.9 (or earlier) backup files into 2.0, though this feature is now available in 2.1.
 
===Two convertors===
#Conversion thingy http://www.conversionthingy.net/Default.aspx Notes: [http://www.moodlenews.com/2011/conversionthingy2-update-convert-moodle-backups-from-1-9-to-2-0/ Blog Post from Moodlenews]
#Moodle in schools convertor http://www.moodleinschools.org.nz/forum/topics/4730


==See also==
==See also==


*[[Moodle 2.0 release notes]]
*[[dev:Moodle 2.0 release notes]]
 
*[[:Category:Moodle 2.0]]


[[Category:Installation]]
Using Moodle forum discussions:
*[http://moodle.org/mod/forum/discuss.php?d=166289 Discussion about fixing 1.9 database schema]
*[http://moodle.org/mod/forum/discuss.php?d=167997 DDL sql execution error when upgrading from 1.9.10+ to 2.0.1+]


[[de:Auf Moodle 2.0 aktualisieren]]
[[de:Auf Moodle 2.0 aktualisieren]]
[[fr:Mise à jour à Moodle 2.0]]
[[fr:Mise à jour à Moodle 2.0]]

Latest revision as of 21:18, 2 October 2012

When upgrading to Moodle 2.0, you must have Moodle 1.9 or later. if you are using an earlier version of Moodle (eg 1.8.x) then you need to upgrade to Moodle 1.9.x first.

We advise that you test the upgrade first on a COPY of your production site, to make sure it works as you expect. Moodle 2.0 is a substantial upgrade and may require more planning and testing than you have become accustomed to in prior upgrades. Please read this page carefully before proceeding.


System requirements

  • PHP must be 5.2.8 or later although the latest 5.3.x is better if you have a choice.
  • Databases should be one of the following:
    • MySQL 5.0.25 or later (InnoDB storage engine highly recommended)
    • PostgreSQL 8.3 or later
    • Oracle 10.2 or later
    • MS SQL 2005 or later
  • Any standards-supporting browser from the past few years, for example:

Moodle 2.0 Planning

Moodle 2.0 is substantially different to the versions that went before it. You should expect much more planning and testing to be involved in upgrading to 2.0. It is highly likely not to be as straightforward as upgrades through earlier versions. Please read this document carefully and follow the advice. Please ask in the forums if you are not sure of anything. Don't try to upgrade your huge 1.9 production site over a weekend with no prior testing.

If you want to "just try it", fine, but please do it on a test copy of your production site.

If your users and admins have become accustomed to Moodle 1.9 you should note that there are some changes in the user interface. Again, it is a very good idea to upgrade a copy of your site and establish how you will be affected by the changes and what training and support your users may require (if any).

Lastly, consider not upgrading at all. It might be a good time to start with a completely fresh install of Moodle 2.0 and migrate your courses over (note that restoring 1.9 course backups into Moodle 2 will not be available until Moodle 2.1 is released).

Before upgrading please...

NOTE: The upgrade process will irreversibly modify the contents of your database and your moodledata file storage area. If something goes wrong you cannot go back. It is vital that you take good backups of both moodledata and the database in case you have problems with the upgrade. If you are not sure how see Site backup or ask in the moodle.org forums (explaining what your operating system is).

  • It's a good idea to read the dev:Latest release notes and the dev:Moodle 2.0 release notes
  • Always check your site to make sure it meets all system requirements for 2.0 in Administration > Server > Environment
  • Do a full database backup!
  • Do a full moodledata backup
  • Check your backups carefully
  • You must be running version 1.9 and it's probably a good idea to upgrade to the latest 1.9 if you have not done so already.
  • Remember to purge PHP cache if using any PHP accelerator

Any kind of 1.9 code in your installation will most likely stop the upgrade from completing. Don't try it!

A word about optional plugins and themes

If you have added optional or customised plugins (whether your own custom developments or from the plugins and modules database) or are using a non-core theme you must note that these will not work in Moodle 2.0+. While some plugins have been modified to work in Moodle 2.0+ at the time of writing most have not. The themes system is completely different in 2.0+ and all custom themes will require a complete rewrite.

Do not try to include any (old 1.9) optional plugins and themes (or any 1.9 code) in your Moodle 2.0 - it won't work. You should check to see if a 2.0 version is available. If not, you can safely ignore the message that the code is missing for the plugin during the upgrade. You will lose the functionality but the database tables will be retained (dormant) in case a 2.0 version of the plugin is produced in the future.

Required changes in database privileges

Moodle 2.x now uses temporary database tables, especially for backup and restore purpose. Make sure that the database account defined in config.php is allowed to create these temporary tables in its database. For MySQL, this is controlled by CREATE TEMPORARY TABLES privilege and you may need to grant that explicitly. In other database systems, your account probably has this permission already.

Checking database schema - old sites

This section is particularly relevant if you experience database errors during the upgrade.

If your 1.9 Moodle site has been upgraded through many prior versions (typically if it first existed prior to version 1.7) it is quite likely that there will be some problems with the database schema (compared to a fresh 1.9 installation). This may cause the upgrade to fail. If your site started life prior to Moodle 1.9 it is a very good idea to check and correct the database schema before upgrading. See Verify Database Schema. You should also run the database integrity checks in the XMLDB editor, see the 'See also' for a link to extra scripts to check for other discrepancies.

Now upgrade

Once you have satisfied the requirements for Moodle 2.0, follow the instructions on the upgrading page.

On Linux servers, Moodle 2.0 supports running the upgrade from the command line, rather than through a web browser. This is likely to be more reliable, particularly for large sites.

If it doesn't work

If the upgrade fails for any reason, it is imperative that you completely restore the 1.9 site from your backups before trying again. This particularly applies to moodledata. A likely result of not doing this is your files being lost in 2.x

After upgrade

The config.php file from your 1.9 installation should work fine but if you take a look at config-dist.php that came with Moodle 2.0 there are more/different options available (e.g. database drivers and settings). It's a good idea to map your old config.php settings to a new one based on the 2.0 config-dist.php.

Don't forget to transfer any password salt values in your old config.php (otherwise nobody will be able to login).

Update your php commandline cron jobs to point to the admin/cli/cron.php.

In versions 1.x, you could execute admin/cron.php either from command line or via the web. Since Moodle 2.0, the admin/cli/cron.php script can only be run via the command line.

Known and Discovered Issues

  • If you get an error about 'handling of PHP float numbers', please see the 'Moodle claims PHP float handling is not compatible' FAQ.
  • You now need some additional PHP modules installed (e.g. intl and the zip extension). If you do not have these, installation them depends entirely on how your PHP was first installed and your operating system.

Converting courses from 1.9 to 2.0

At present the usual way to do this is via a 1.9 to 2.0 upgrade as described above. It is not possible to import 1.9 (or earlier) backup files into 2.0, though this feature is now available in 2.1.

Two convertors

  1. Conversion thingy http://www.conversionthingy.net/Default.aspx Notes: Blog Post from Moodlenews
  2. Moodle in schools convertor http://www.moodleinschools.org.nz/forum/topics/4730

See also

Using Moodle forum discussions: