[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/db/ -> upgradelib.php (summary)

Upgrade helper functions This file is used for special upgrade functions - for example groups and gradebook. These functions must use SQL and database related functions only- no other Moodle API, because it might depend on db structures that are not yet present during upgrade. (Do not use functions from accesslib.php, grades classes or group functions at all!)

Copyright: 2007 Petr Skoda (http://skodak.org)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 532 lines (22 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 8 functions

  upgrade_mysql_get_supported_tables()
  upgrade_mysql_fix_unsigned_and_lob_columns()
  upgrade_mssql_nvarcharmax()
  upgrade_mssql_varbinarymax()
  upgrade_course_modules_sequences()
  upgrade_availability_item()
  upgrade_group_members_only()
  upgrade_mimetypes()

Functions
Functions that are not part of a class:

upgrade_mysql_get_supported_tables()   X-Ref
Returns all non-view and non-temp tables with sane names.
Prints list of non-supported tables using $OUTPUT->notification()

return: array

upgrade_mysql_fix_unsigned_and_lob_columns()   X-Ref
Remove all signed numbers from current database and change
text fields to long texts - mysql only.


upgrade_mssql_nvarcharmax()   X-Ref
Migrate NTEXT to NVARCHAR(MAX).


upgrade_mssql_varbinarymax()   X-Ref
Migrate IMAGE to VARBINARY(MAX).


upgrade_course_modules_sequences()   X-Ref
This upgrade script fixes the mismatches between DB fields course_modules.section
and course_sections.sequence. It makes sure that each module is included
in the sequence of at least one section.
Note that this script is different from admin/cli/fix_course_sortorder.php
in the following ways:
1. It does not fix the cases when module appears several times in section(s) sequence(s) -
it will be done automatically on the next viewing of the course.
2. It does not remove non-existing modules from section sequences - administrator
has to run the CLI script to do it.
3. When this script finds an orphaned module it adds it to the section but makes hidden
where CLI script does not change the visiblity specified in the course_modules table.


upgrade_availability_item($groupmembersonly, $groupingid,$availablefrom, $availableuntil, $showavailability,array $availrecs, array $fieldrecs)   X-Ref
Updates a single item (course module or course section) to transfer the
availability settings from the old to the new format.

Note: We do not convert groupmembersonly for modules at present. If we did,
$groupmembersonly would be set to the groupmembersonly option for the
module. Since we don't, it will be set to 0 for modules, and 1 for sections
if they have a grouping.

param: int $groupmembersonly 1 if activity has groupmembersonly option
param: int $groupingid Grouping id (0 = none)
param: int $availablefrom Available from time (0 = none)
param: int $availableuntil Available until time (0 = none)
param: int $showavailability Show availability (1) or hide activity entirely
param: array $availrecs Records from course_modules/sections_availability
param: array $fieldrecs Records from course_modules/sections_avail_fields

upgrade_group_members_only($groupingid, $availability)   X-Ref
Using data for a single course-module that has groupmembersonly enabled,
returns the new availability value that incorporates the correct
groupmembersonly option.

Included as a function so that it can be shared between upgrade and restore,
and unit-tested.

param: int $groupingid Grouping id for the course-module (0 if none)
param: string $availability Availability JSON data for the module (null if none)
return: string New value for availability for the module

upgrade_mimetypes($filetypes)   X-Ref
Updates the mime-types for files that exist in the database, based on their
file extension.

param: array $filetypes Array with file extension as the key, and mimetype as the value



Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1