Skip to content

Commit

Permalink
Increase length of City field MDL-19629 - longest place name in NZ is…
Browse files Browse the repository at this point in the history
… Taumata­whakatangihanga­koauau­o­tamatea­turi­pukakapiki­maunga­horo­nuku­pokai­whenua­kitanatahu which doesn't fit in 20 chars, I figure 100 chars should be enough
  • Loading branch information
danmarsden committed Jul 8, 2010
1 parent 7851bd3 commit ba0c097
Show file tree
Hide file tree
Showing 11 changed files with 395 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@
<FIELD NAME="institution" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" PREVIOUS="phone2" NEXT="department"/>
<FIELD NAME="department" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" PREVIOUS="institution" NEXT="address"/>
<FIELD NAME="address" TYPE="char" LENGTH="70" NOTNULL="true" SEQUENCE="false" PREVIOUS="department" NEXT="city"/>
<FIELD NAME="city" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" PREVIOUS="address" NEXT="country"/>
<FIELD NAME="city" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="address" NEXT="country"/>
<FIELD NAME="country" TYPE="char" LENGTH="2" NOTNULL="true" SEQUENCE="false" PREVIOUS="city" NEXT="lang"/>
<FIELD NAME="lang" TYPE="char" LENGTH="30" NOTNULL="true" DEFAULT="en" SEQUENCE="false" PREVIOUS="country" NEXT="theme"/>
<FIELD NAME="theme" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" PREVIOUS="lang" NEXT="timezone"/>
Expand Down
22 changes: 22 additions & 0 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4687,6 +4687,28 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2010070604);
}

if ($oldversion < 2010070701) {
/// Before changing the field, drop dependent indexes
/// Define index shortname (not unique) to be dropped form course_request
$table = new xmldb_table('user');
$index = new xmldb_index('city', XMLDB_INDEX_NOTUNIQUE, array('city'));
/// Conditionally launch drop index shortname
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}
/// Changing precision of field city on table user to (100)
$field = new xmldb_field('city', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null, 'address');

/// Launch change of precision for field city
$dbman->change_field_precision($table, $field);

/// Conditionally launch add index typeitem_ix
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
/// Main savepoint reached
upgrade_main_savepoint(true, 2010070701);
}

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3391,7 +3391,7 @@ function truncate_userinfo($info) {
'institution' => 40,
'department' => 30,
'address' => 70,
'city' => 20,
'city' => 100,
'country' => 2,
'url' => 255,
);
Expand Down
2 changes: 1 addition & 1 deletion login/signup_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function definition() {
$mform->setType('lastname', PARAM_TEXT);
$mform->addRule('lastname', get_string('missinglastname'), 'required', null, 'server');

$mform->addElement('text', 'city', get_string('city'), 'maxlength="20" size="20"');
$mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="20"');
$mform->setType('city', PARAM_TEXT);
$mform->addRule('city', get_string('missingcity'), 'required', null, 'server');

Expand Down
16 changes: 16 additions & 0 deletions repository/mahara/db/access.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

$capabilities = array(

'repository/mahara:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'user' => CAP_ALLOW,
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
)
)
);
20 changes: 20 additions & 0 deletions repository/mahara/db/upgrade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

function xmldb_repository_mahara_upgrade($oldversion) {

global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.

/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }

return $result;
}
Loading

0 comments on commit ba0c097

Please sign in to comment.