Merge branch 'w28_MDL-8249_m24_roletranslations' of git://github.com/skodak/moodle

Conflicts:
	lib/db/upgrade.php
	version.php
This commit is contained in:
Dan Poltawski 2012-07-10 09:43:23 +08:00
commit e1980f8bb9
37 changed files with 631 additions and 422 deletions

View file

@ -243,14 +243,14 @@ function xmldb_main_install() {
// Install the roles system.
$managerrole = create_role(get_string('manager', 'role'), 'manager', get_string('managerdescription', 'role'), 'manager');
$coursecreatorrole = create_role(get_string('coursecreators'), 'coursecreator', get_string('coursecreatorsdescription'), 'coursecreator');
$editteacherrole = create_role(get_string('defaultcourseteacher'), 'editingteacher', get_string('defaultcourseteacherdescription'), 'editingteacher');
$noneditteacherrole = create_role(get_string('noneditingteacher'), 'teacher', get_string('noneditingteacherdescription'), 'teacher');
$studentrole = create_role(get_string('defaultcoursestudent'), 'student', get_string('defaultcoursestudentdescription'), 'student');
$guestrole = create_role(get_string('guest'), 'guest', get_string('guestdescription'), 'guest');
$userrole = create_role(get_string('authenticateduser'), 'user', get_string('authenticateduserdescription'), 'user');
$frontpagerole = create_role(get_string('frontpageuser', 'role'), 'frontpage', get_string('frontpageuserdescription', 'role'), 'frontpage');
$managerrole = create_role('', 'manager', '', 'manager');
$coursecreatorrole = create_role('', 'coursecreator', '', 'coursecreator');
$editteacherrole = create_role('', 'editingteacher', '', 'editingteacher');
$noneditteacherrole = create_role('', 'teacher', '', 'teacher');
$studentrole = create_role('', 'student', '', 'student');
$guestrole = create_role('', 'guest', '', 'guest');
$userrole = create_role('', 'user', '', 'user');
$frontpagerole = create_role('', 'frontpage', '', 'frontpage');
// Now is the correct moment to install capabilities - after creation of legacy roles, but before assigning of roles
update_capabilities('moodle');

View file

@ -1018,9 +1018,9 @@
<TABLE NAME="role" COMMENT="moodle roles" PREVIOUS="post" NEXT="context">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="shortname"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" COMMENT="Empty names are automatically localised" NEXT="shortname"/>
<FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="name" NEXT="description"/>
<FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false" PREVIOUS="shortname" NEXT="sortorder"/>
<FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false" PREVIOUS="shortname" COMMENT="Empty descriptions may be automatically localised" NEXT="sortorder"/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="description" NEXT="archetype"/>
<FIELD NAME="archetype" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" COMMENT="Role archetype is used during install and role reset, marks admin role and helps in site settings" PREVIOUS="sortorder"/>
</FIELDS>
@ -1028,9 +1028,8 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="sortorder" UNIQUE="true" FIELDS="sortorder" NEXT="name"/>
<INDEX NAME="name" UNIQUE="true" FIELDS="name" COMMENT="Enforces the constraint that role names should be unique." PREVIOUS="sortorder" NEXT="shortname"/>
<INDEX NAME="shortname" UNIQUE="true" FIELDS="shortname" COMMENT="Enforces the constraint that role shortnames must be unique." PREVIOUS="name"/>
<INDEX NAME="sortorder" UNIQUE="true" FIELDS="sortorder" NEXT="shortname"/>
<INDEX NAME="shortname" UNIQUE="true" FIELDS="shortname" COMMENT="Enforces the constraint that role shortnames must be unique." PREVIOUS="sortorder"/>
</INDEXES>
</TABLE>
<TABLE NAME="context" COMMENT="one of these must be set" PREVIOUS="role" NEXT="context_temp">

View file

@ -1015,5 +1015,21 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2012062500.09);
}
if ($oldversion < 2012062500.10) {
// Define index name (unique) to be dropped form role
$table = new xmldb_table('role');
$index = new xmldb_index('name', XMLDB_INDEX_UNIQUE, array('name'));
// Conditionally launch drop index name
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012062500.10);
}
return true;
}