Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDl-29189 course Increased the shortname field length so that it is m…

…ore usable now that it is consistently formatted
  • Loading branch information...
commit efd9c8e5b61d1a1ee409e266a58545e3e03bc913 1 parent 8ebbb06
@samhemelryk samhemelryk authored
Showing with 30 additions and 3 deletions.
  1. +2 −2 lib/db/install.xml
  2. +27 −0 lib/db/upgrade.php
  3. +1 −1  version.php
View
4 lib/db/install.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20110821" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20110907" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@@ -73,7 +73,7 @@
<FIELD NAME="category" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="sortorder"/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="category" NEXT="fullname"/>
<FIELD NAME="fullname" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" PREVIOUS="sortorder" NEXT="shortname"/>
- <FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="fullname" NEXT="idnumber"/>
+ <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="fullname" NEXT="idnumber"/>
<FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="shortname" NEXT="summary"/>
<FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="idnumber" NEXT="summaryformat"/>
<FIELD NAME="summaryformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="summary" NEXT="format"/>
View
27 lib/db/upgrade.php
@@ -6696,6 +6696,33 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2011083100.02);
}
+ if ($oldversion < 2011090800) {
+ // Increase the length of the of the course shortname field as it is now going
+ // to be consistently filtered and 100 characters if practically useless for
+ // things like the multilang filter.
+
+ $table = new xmldb_table('course');
+ $field = new xmldb_field('shortname', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'fullname');
+ $index = new xmldb_index('shortname', XMLDB_INDEX_NOTUNIQUE, array('shortname'));
+
+ // First check the shortname field exists... pretty heavy mod if it doesnt!
+ if ($dbman->field_exists($table, $field)) {
+ // Conditionally launch drop index shortname, this is required to happen
+ // before we can edit the field.
+ if ($dbman->index_exists($table, $index)) {
+ $dbman->drop_index($table, $index);
+ }
+
+ // Launch change of precision for field shortname
+ $dbman->change_field_precision($table, $field);
+ // Add the index back to the table now that we're finished our mods
+ $dbman->add_index($table, $index);
+ }
+
+ // Main savepoint reached
+ upgrade_main_savepoint(true, 2011090800);
+ }
+
return true;
}
View
2  version.php
@@ -31,7 +31,7 @@
-$version = 2011090700.00; // YYYYMMDD = weekly release date of this DEV branch
+$version = 2011090800.00; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes
Please sign in to comment.
Something went wrong with that request. Please try again.