[ Index ]

PHP Cross Reference of Unnamed Project

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: 529 lines (22 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 11 functions

  upgrade_mysql_get_supported_tables()
  upgrade_group_members_only()
  upgrade_mimetypes()
  upgrade_extra_credit_weightoverride()
  upgrade_calculated_grade_items()
  upgrade_course_tags()
  make_default_scale()
  make_competence_scale()
  upgrade_course_letter_boundary()
  upgrade_letter_boundary_needs_freeze()
  upgrade_standardise_score()

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_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

upgrade_extra_credit_weightoverride($onlycourseid = 0)   X-Ref
Marks all courses with changes in extra credit weight calculation

Used during upgrade and in course restore process

This upgrade script is needed because we changed the algorithm for calculating the automatic weights of extra
credit items and want to prevent changes in the existing student grades.

param: int $onlycourseid

upgrade_calculated_grade_items($courseid = null)   X-Ref
Marks all courses that require calculated grade items be updated.

Used during upgrade and in course restore process.

This upgrade script is needed because the calculated grade items were stuck with a maximum of 100 and could be changed.
This flags the courses that are affected and the grade book is frozen to retain grade integrity.

param: int $courseid Specify a course ID to run this script on just one course.

upgrade_course_tags()   X-Ref
This upgrade script merges all tag instances pointing to the same course tag

User id is no longer used for those tag instances

make_default_scale()   X-Ref
This function creates a default separated/connected scale
so there's something in the database.  The locations of
strings and files is a bit odd, but this is because we
need to maintain backward compatibility with many different
existing language translations and older sites.

return: void

make_competence_scale()   X-Ref
Create another default scale.

param: int $oldversion
return: bool always true

upgrade_course_letter_boundary($courseid = null)   X-Ref
Marks all courses that require rounded grade items be updated.

Used during upgrade and in course restore process.

This upgrade script is needed because it has been decided that if a grade is rounded up, and it will changed a letter
grade or satisfy a course completion grade criteria, then it should be set as so, and the letter will be awarded and or
the course completion grade will be awarded.

param: int $courseid Specify a course ID to run this script on just one course.

upgrade_letter_boundary_needs_freeze($context)   X-Ref
Checks the letter boundary of the provided context to see if it needs freezing.
Each letter boundary is tested to see if receiving that boundary number will
result in achieving the cosponsoring letter.

param: object $context Context object
return: bool if the letter boundary for this context should be frozen.

upgrade_standardise_score($rawgrade, $sourcemin, $sourcemax, $targetmin, $targetmax)   X-Ref
Given a float value situated between a source minimum and a source maximum, converts it to the
corresponding value situated between a target minimum and a target maximum. Thanks to Darlene
for the formula :-)

param: float $rawgrade
param: float $sourcemin
param: float $sourcemax
param: float $targetmin
param: float $targetmax
return: float Converted value



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1