|
Moodle
2.2.1
http://www.collinsharper.com
|
Go to the source code of this file.
Namespaces | |
| namespace | core |
Functions | |
| xmldb_main_upgrade ($oldversion) | |
| xmldb_main_upgrade | ( | $ | oldversion | ) |
stdClass $CFG stdClass $USER moodle_database $DB core_renderer $OUTPUT
| int | $oldversion |
upgrade supported only from 1.9.x ///
Define table upgrade_log to be created
Adding fields to table upgrade_log
Adding keys to table upgrade_log
Adding indexes to table upgrade_log
Create table for upgrade_log
Main savepoint reached
Define table log_queries to be created
Adding fields to table log_queries
Adding keys to table log_queries
Conditionally launch create table for log_queries
Main savepoint reached
Define index contextid-lowerboundary (not unique) to be dropped form grade_letters
Launch drop index contextid-lowerboundary
Define index contextid-lowerboundary-letter (unique) to be added to grade_letters
Launch add index contextid-lowerboundary-letter
Main savepoint reached
Fix minor problem caused by MDL-5482.
Under MySQL and Postgres... detect old NULL contents and change them by correct empty string. MDL-14859
Define index idnumber (not unique) to be dropped form user
Launch drop index idnumber
Changing precision of field idnumber on table user to (255)
Launch change of precision for field idnumber
Launch add index idnumber again
Main savepoint reached
Main savepoint reached
Define table portfolio_instance to be created
Adding fields to table portfolio_instance
Adding keys to table portfolio_instance
Conditionally launch create table for portfolio_instance
Define table portfolio_instance_config to be created
Adding fields to table portfolio_instance_config
Adding keys to table portfolio_instance_config
Adding indexes to table portfolio_instance_config
Conditionally launch create table for portfolio_instance_config
Define table portfolio_instance_user to be created
Adding fields to table portfolio_instance_user
Adding keys to table portfolio_instance_user
Conditionally launch create table for portfolio_instance_user
Main savepoint reached
Create the database tables for message_processors
delete old and create new fields
fields to rename
new message fields
fields to rename
new message fields
new table
Define field enablecompletion to be added to course
Launch add field enablecompletion
Define field completion to be added to course_modules
Launch add field completion
Define field completiongradeitemnumber to be added to course_modules
Launch add field completiongradeitemnumber
Define field completionview to be added to course_modules
Launch add field completionview
Define field completionexpected to be added to course_modules
Launch add field completionexpected
Define table course_modules_completion to be created
Adding fields to table course_modules_completion
Adding keys to table course_modules_completion
Adding indexes to table course_modules_completion
Launch create table for course_modules_completion
Main savepoint reached
Define table portfolio_log to be created
Adding fields to table portfolio_log
Adding keys to table portfolio_log
Conditionally launch create table for portfolio_log
Main savepoint reached
Drop old table that might exist for some people
Define table message_providers to be created
Adding fields to table message_providers
Adding keys to table message_providers
Adding indexes to table message_providers
Create table for message_providers
Define table files to be created
Adding fields to table files
Adding keys to table files
Adding indexes to table files
Conditionally launch create table for files
Main savepoint reached
move all course, backup and other files to new filepool based storage
Main savepoint reached
move all course, backup and other files to new filepool based storage
Main savepoint reached
Main savepoint reached
Define table portfolio_tempdata to be created
Adding fields to table portfolio_tempdata
Adding keys to table portfolio_tempdata
Conditionally launch create table for portfolio_tempdata
Main savepoint reached
Changing the type of all the columns that the question bank uses to store grades to be NUMBER(12, 7).
all 1.9 sites and fresh installs must already be unicode, not needed anymore
Main savepoint reached
Define table repository to be dropped
Conditionally launch drop table for repository
Define table repository to be created
Adding fields to table repository
Adding keys to table repository
Conditionally launch create table for repository
Define table repository_instances to be created
Adding fields to table repository_instances
Adding keys to table repository_instances
Conditionally launch create table for repository_instances
Define table repository_instance_config to be created
Adding fields to table repository_instance_config
Adding keys to table repository_instance_config
Conditionally launch create table for repository_instance_config
Main savepoint reached
Add a new column to the question sessions table to record whether a question has been flagged.
Define field flagged to be added to question_sessions
Conditionally launch add field flagged
Main savepoint reached
Changing precision of field parent_type on table mnet_rpc to (20)
Launch change of precision for field parent_type
Main savepoint reached
Main savepoint reached
Main savepoint reached
Drop the deprecated teacher, teachers, student and students columns from the course table.
Conditionally launch drop field teacher
Conditionally launch drop field teacher
Conditionally launch drop field teacher
Conditionally launch drop field teacher
Main savepoint reached
Add a unique index to the role.name column.
Define index name (unique) to be added to role
Conditionally launch add index name
Main savepoint reached
Add a unique index to the role.shortname column.
Define index shortname (unique) to be added to role
Conditionally launch add index shortname
Main savepoint reached
Changing precision of field shortname on table course_request to (100)
Before changing the field, drop dependent indexes Define index shortname (not unique) to be dropped form course_request
Conditionally launch drop index shortname
Launch change of precision for field shortname
After changing the field, recreate dependent indexes Define index shortname (not unique) to be added to course_request
Conditionally launch add index shortname
Main savepoint reached
Changing precision of field shortname on table mnet_enrol_course to (100)
Launch change of precision for field shortname
Main savepoint reached
Define field availablefrom to be added to course_modules
Conditionally launch add field availablefrom
Define field availableuntil to be added to course_modules
Conditionally launch add field availableuntil
Define field showavailability to be added to course_modules
Conditionally launch add field showavailability
Define table course_modules_availability to be created
Adding fields to table course_modules_availability
Adding keys to table course_modules_availability
Conditionally launch create table for course_modules_availability
Changes to modinfo mean we need to rebuild course cache
Main savepoint reached
clean up config table a bit
Main savepoint reached
Define field originalquestion to be dropped from question_states
Conditionally launch drop field originalquestion
Main savepoint reached
Changing precision of field ip on table log to (45)
Launch change of precision for field ip
Main savepoint reached
Changing precision of field lastip on table user to (45)
Launch change of precision for field lastip
Main savepoint reached
Changing precision of field ip_address on table mnet_host to (45)
Launch change of precision for field ip_address
Main savepoint reached
Changing precision of field ip on table mnet_log to (45)
Launch change of precision for field ip
Main savepoint reached
Changing nullability of field configdata on table block_instance to null
Launch change of nullability for field configdata
Main savepoint reached
Remove unused settings
Main savepoint reached
Migrate backup settings to core plugin config table
Define table to be dropped
Launch drop table for old backup config
Main savepoint reached
Define table config_log to be created
Adding fields to table config_log
Adding keys to table config_log
Adding indexes to table config_log
Launch create table for config_log
Main savepoint reached
Define table sessions2 to be dropped
Conditionally launch drop table for sessions
Define table sessions to be dropped
Conditionally launch drop table for sessions
Define table sessions to be created
Adding fields to table sessions
Adding keys to table sessions
Adding indexes to table sessions
Launch create table for sessions
Main savepoint reached
Main savepoint reached
Add default sort order for question types.
MDL-18132 replace the use a new Role allow switch settings page, instead of $CFG->allowuserswitchrolestheycantassign
First create the new table.
Adding fields to table role_allow_switch
Adding keys to table role_allow_switch
Adding indexes to table role_allow_switch
Conditionally launch create table for role_allow_switch
Main savepoint reached
Copy from role_allow_assign into the new table.
Unset the config variable used in 1.9.
Main savepoint reached
Define table filter_active to be created
Adding fields to table filter_active
Adding keys to table filter_active
Adding indexes to table filter_active
Conditionally launch create table for filter_active
Main savepoint reached
Define table filter_config to be created
Adding fields to table filter_config
Adding keys to table filter_config
Adding indexes to table filter_config
Conditionally launch create table for filter_config
Main savepoint reached
Transfer current settings from $CFG->textfilters
Main savepoint reached
Ensure that $CFG->stringfilters is set.
Main savepoint reached
To ensure the UI remains consistent with no behaviour change, any 'until' date in an activity condition should have 1 second subtracted (to go from 0:00 on the following day to 23:59 on the previous one).
Main savepoint reached
Deleting orphaned messages from deleted users.
Detect deleted users with messages sent(useridfrom) and not read
Main savepoint reached
Dropping all enums/check contraints from core. MDL-18577
Changing list of values (enum) of field stattype on table stats_daily to none
Launch change of list of values for field stattype
Changing list of values (enum) of field stattype on table stats_weekly to none
Launch change of list of values for field stattype
Changing list of values (enum) of field stattype on table stats_monthly to none
Launch change of list of values for field stattype
Changing list of values (enum) of field publishstate on table post to none
Launch change of list of values for field publishstate
Main savepoint reached
Site front page blocks need to be moved due to page name change.
Main savepoint reached
Define table block_instance to be renamed to block_instances
Launch rename table for block_instance
Main savepoint reached
Define table block_instance to be renamed to block_instance_old
Launch rename table for block_instance
Main savepoint reached
Define table block_instance_old to be created
Adding fields to table block_instance_old
Adding keys to table block_instance_old
Adding indexes to table block_instance_old
Conditionally launch create table for block_instance_old
Main savepoint reached
Copy current blocks data from block_instances to block_instance_old
Define field multiple to be dropped from block
Conditionally launch drop field multiple
Main savepoint reached
Rename field weight on table block_instances to defaultweight
Rename field position on table block_instances to defaultregion
Main savepoint reached
Changing precision of field defaultregion on table block_instances to (16)
Launch change of precision for field defaultregion
Main savepoint reached
Change regions to the new notation
Main savepoint reached
Define key blockname (unique) to be added to block
Launch add key blockname
Main savepoint reached
Define field blockname to be added to block_instances
Define field contextid to be added to block_instances
Define field showinsubcontexts to be added to block_instances
Define field subpagepattern to be added to block_instances
Main savepoint reached
Fill in blockname from blockid
Set showinsubcontexts = 0 for all rows.
Main savepoint reached
Rename field pagetype on table block_instances to pagetypepattern
Launch rename field pagetype
Main savepoint reached
fill in contextid and subpage, and update pagetypepattern from pagetype and pageid
site-index
course-view
admin
my-index
tag-index
blog-view
mod-xxx-view
Main savepoint reached
fill in any missing contextids with a dummy value, so we can add the not-null constraint.
Main savepoint reached
Arrived here, any block_instances record without blockname is one orphan block coming from 1.9. Just delete them. MDL-22503
Changing nullability of field blockname on table block_instances to not null
Changing nullability of field contextid on table block_instances to not null
Changing nullability of field showinsubcontexts on table block_instances to not null
Main savepoint reached
Add exiting sticky blocks.
Main savepoint reached
Define table block_positions to be created
Adding fields to table block_positions
Adding keys to table block_positions
Adding indexes to table block_positions
Conditionally launch create table for block_positions
Main savepoint reached
And block instances with visible = 0, copy that information to block_positions
Main savepoint reached
Define field blockid to be dropped from block_instances
Before dropping the field, drop dependent indexes
Launch drop index blockid
Define field pageid to be dropped from block_instances
Before dropping the field, drop dependent indexes
Launch drop index pageid
Define field visible to be dropped from block_instances
Main savepoint reached
Let's check the status of mandatory mnet_host records, fixing them and moving "orphan" users to default localhost record. MDL-16879
Main savepoint reached
migrate editor settings
Main savepoint reached
Repeat 2009050607 upgrade step, which Petr commented out because of XMLDB stupidity, so lots of people will have missed.
Changing precision of field defaultregion on table block_instances to (16)
Launch change of precision for field defaultregion
Main savepoint reached
unset old config
set new config
unset old config
set new config
Rename field contextid on table block_instances to parentcontextid
Launch rename field parentcontextid
Main savepoint reached
Define field summaryformat to be added to post
Conditionally launch add field summaryformat
Main savepoint reached
Define table comments to be created
Adding fields to table comments
Adding keys to table comments
Conditionally launch create table for comments
Main savepoint reached
This upgrade is to set up the new navigation blocks that have been developed as part of Moodle 2.0 Now I [Sam Hemelryk] hit a conundrum while exploring how to go about this as not only do we want to install the new blocks but we also want to set up default instances of them, and at the same time remove instances of the blocks that were/will-be outmoded by the two new navigation blocks. After talking it through with Tim Hunt http://moodle.org/mod/cvsadmin/view.php?conversationid=3112 we decided that the best way to go about this was to put the bulk of the upgrade operation into core upgrade `here` but to let the plugins block still install the blocks. This leaves one hairy end in that we will create block_instances within the DB before the blocks themselves are created within the DB
Define table external_functions to be created
Adding fields to table external_functions
Adding keys to table external_functions
Adding indexes to table external_functions
Launch create table for external_functions
Main savepoint reached
Define table external_services to be created
Adding fields to table external_services
Adding keys to table external_services
Adding indexes to table external_services
Launch create table for external_services
Main savepoint reached
Define table external_services_functions to be created
Adding fields to table external_services_functions
Adding keys to table external_services_functions
Launch create table for external_services_functions
Main savepoint reached
Define table external_services_users to be created
Adding fields to table external_services_users
Adding keys to table external_services_users
Launch create table for external_services_users
Main savepoint reached
Define table external_tokens to be created
Adding fields to table external_tokens
Adding keys to table external_tokens
Launch create table for external_tokens
Main savepoint reached
Define table blog_association to be created
Adding fields to table blog_association
Adding keys to table blog_association
Conditionally launch create table for blog_association
Define table blog_external to be created
Adding fields to table blog_external
Adding keys to table blog_external
Conditionally launch create table for blog_external
Main savepoint reached
Main savepoint reached
Define table mnet_remote_rpc to be created
Adding fields to table mnet_remote_rpc
Adding keys to table mnet_remote_rpc
Conditionally launch create table for mnet_remote_rpc
Define table mnet_remote_service2rpc to be created
Adding fields to table mnet_remote_service2rpc
Adding keys to table mnet_remote_service2rpc
Adding indexes to table mnet_remote_service2rpc
Conditionally launch create table for mnet_remote_service2rpc
Rename field function_name on table mnet_rpc to functionname
Launch rename field function_name
Rename field xmlrpc_path on table mnet_rpc to xmlrpcpath
Launch rename field xmlrpc_path
Main savepoint reached
Define field plugintype to be added to mnet_remote_rpc
Conditionally launch add field plugintype
Define field pluginname to be added to mnet_remote_rpc
Conditionally launch add field pluginname
Main savepoint reached
Define field enabled to be added to mnet_remote_rpc
Conditionally launch add field enabled
Main savepoint reached
MDL-17863. Increase the portno column length on mnet_host to handle any port number
Changing precision of field portno on table mnet_host to (5)
Launch change of precision for field portno
Define field timecreated to be added to user
Launch add field timecreated
Changes to modinfo mean we need to rebuild course cache
Define table license to be created
Adding fields to table license
Adding keys to table license
Conditionally launch create table for license
set site default license
Main savepoint reached
New table for storing which roles can be assigned in which contexts.
Define table role_context_levels to be created
Adding fields to table role_context_levels
Adding keys to table role_context_levels
Conditionally launch create table for role_context_levels
Main savepoint reached
Define table backup_controllers to be created
Adding fields to table backup_controllers
Adding keys to table backup_controllers
Adding indexes to table backup_controllers
Conditionally launch create table for backup_controllers
Define table backup_ids_template to be created
Adding fields to table backup_ids_template
Adding keys to table backup_ids_template
Adding indexes to table backup_ids_template
Conditionally launch create table for backup_controllers
Main savepoint reached
Adding fields to table rating
Adding keys to table rating
Adding indexes to table rating
Create table for ratings
Define index typeitem_ix (not unique) to be dropped form backup_controllers
Conditionally launch drop index typeitem_ix
Changing precision of field type on table backup_controllers to (10)
Launch change of precision for field type
Define index typeitem_ix (not unique) to be added to backup_controllers
Conditionally launch add index typeitem_ix
Main savepoint reached
Add course completion tables Define table course_completion_aggr_methd to be created
Adding fields to table course_completion_aggr_methd
Adding keys to table course_completion_aggr_methd
Adding indexes to table course_completion_aggr_methd
Conditionally launch create table for course_completion_aggr_methd
Define table course_completion_criteria to be created
Adding fields to table course_completion_criteria
Adding keys to table course_completion_criteria
Adding indexes to table course_completion_criteria
Conditionally launch create table for course_completion_criteria
Define table course_completion_crit_compl to be created
Adding fields to table course_completion_crit_compl
Adding keys to table course_completion_crit_compl
Adding indexes to table course_completion_crit_compl
Conditionally launch create table for course_completion_crit_compl
Define table course_completion_notify to be created
Adding fields to table course_completion_notify
Adding keys to table course_completion_notify
Adding indexes to table course_completion_notify
Conditionally launch create table for course_completion_notify
Define table course_completions to be created
Adding fields to table course_completions
Adding keys to table course_completions
Adding indexes to table course_completions
Conditionally launch create table for course_completions
Add cols to course table Define field enablecompletion to be added to course
Conditionally launch add field enablecompletion
Define field completionstartonenrol to be added to course
Conditionally launch add field completionstartonenrol
Define field completionnotify to be added to course
Conditionally launch add field completionnotify
Define table registration_hubs to be created
Adding fields to table registration_hubs
Adding keys to table registration_hubs
Conditionally launch create table for registration_hubs
Main savepoint reached
Define table backup_logs to be created
Adding fields to table backup_logs
Adding keys to table backup_logs
Adding indexes to table backup_logs
Conditionally launch create table for backup_logs
Drop some old backup tables, not used anymore
Define table backup_files to be dropped
Conditionally launch drop table for backup_files
Define table backup_ids to be dropped
Conditionally launch drop table for backup_ids
Main savepoint reached
Define table my_pages to be created
Adding fields to table my_pages
Adding keys to table my_pages
Adding indexes to table my_pages
Conditionally launch create table for my_pages
Add two lines of data into this new table. These are the default pages.
This bit is a "illegal" hack, unfortunately, but there is not a better way to install default blocks right now, since the upgrade function need to be called after core AND plugins upgrade, and there is no such hook yet. Sigh.
Main savepoint reached
Fix a bad table name that existed for a few days in HEAD
Define table course_published to be created
Adding fields to table course_published
Adding keys to table course_published
Conditionally launch create table for course_published
Main savepoint reached
Delete the blocks completely. All the contexts, instances etc were cleaned up above in 2009082800
Main savepoint reached
Define field status to be added to course_published
Conditionally launch add field status
Define field timechecked to be added to course_published
Conditionally launch add field timechecked
Main savepoint reached
Define field summaryformat to be added to course sections table
Conditionally launch add field summaryformat
Main savepoint reached
Changes to modinfo mean we need to rebuild course cache
Define field sortorder to be added to files
Conditionally launch add field sortorder
Main savepoint reached
Define field huburl to be dropped from course_published
Conditionally launch drop field huburl
Define field huburl to be added to course_published
Conditionally launch add field huburl
Main savepoint reached
Define field operation to be added to backup_controllers
Conditionally launch add field operation
Main savepoint reached
Define field suspended to be added to user
Conditionally launch add field suspended
Main savepoint reached
Define field newitemid to be added to backup_ids_template
Conditionally launch add field newitemid
Define field info to be added to backup_ids_template
Conditionally launch add field info
Main savepoint reached
Before changing the field, drop dependent indexes Define index shortname (not unique) to be dropped form course_request
Conditionally launch drop index shortname
Changing precision of field city on table user to (120)
Launch change of precision for field city
Conditionally launch add index typeitem_ix
Main savepoint reached
Define field generalfeedbackformat to be added to question
Conditionally launch add field generalfeedbackformat
Upgrading the text formats in some question types depends on the questiontextformat field, but the question type upgrade only runs after the code below has messed around with the questiontextformat value. Therefore, we need to create a new column to store the old value. The column should be dropped in Moodle 2.1. Define field oldquestiontextformat to be added to question
Conditionally launch add field oldquestiontextformat
Define field infoformat to be added to question_categories
Conditionally launch add field infoformat
Define field answerformat to be added to question_answers
Conditionally launch add field answerformat
Define field feedbackformat to be added to question_answers
Conditionally launch add field feedbackformat
Define field manualcommentformat to be added to question_sessions
Conditionally launch add field manualcommentformat
Main savepoint reached
updating question image
Definition at line 55 of file upgrade.php.

