Skip to content

Commit

Permalink
Adding extra param fields to the user_info_field table to allow field…
Browse files Browse the repository at this point in the history
… type

plugins to store data. Plus a description field.
  • Loading branch information
ikawhero committed Oct 26, 2006
1 parent 33a6f9a commit 74807b4
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
14 changes: 10 additions & 4 deletions lib/db/install.xml
Expand Up @@ -969,13 +969,19 @@
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="field name" PREVIOUS="id" NEXT="datatype"/>
<FIELD NAME="datatype" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Type of data held in this field" PREVIOUS="name" NEXT="categoryid"/>
<FIELD NAME="categoryid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="id from category table" PREVIOUS="datatype" NEXT="sortorder"/>
<FIELD NAME="datatype" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Type of data held in this field" PREVIOUS="name" NEXT="description"/>
<FIELD NAME="description" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="Description of field" PREVIOUS="datatype" NEXT="categoryid"/>
<FIELD NAME="categoryid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="id from category table" PREVIOUS="description" NEXT="sortorder"/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="order within the category" PREVIOUS="categoryid" NEXT="required"/>
<FIELD NAME="required" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Field required" PREVIOUS="sortorder" NEXT="locked"/>
<FIELD NAME="locked" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Field locked" PREVIOUS="required" NEXT="visible"/>
<FIELD NAME="visible" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Visibility: private, public, hidden" PREVIOUS="locked" NEXT="defaultdata"/>
<FIELD NAME="defaultdata" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="Default value for this field" PREVIOUS="visible"/>
<FIELD NAME="defaultdata" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="Default value for this field" PREVIOUS="visible" NEXT="param1"/>
<FIELD NAME="param1" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="General parameter field" PREVIOUS="defaultdata" NEXT="param2"/>
<FIELD NAME="param2" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="General parameter field" PREVIOUS="param1" NEXT="param3"/>
<FIELD NAME="param3" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="General parameter field" PREVIOUS="param2" NEXT="param4"/>
<FIELD NAME="param4" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="General parameter field" PREVIOUS="param2" NEXT="param5"/>
<FIELD NAME="param5" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="General parameter field" PREVIOUS="param4"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me"/>
Expand Down Expand Up @@ -1025,4 +1031,4 @@
</SENTENCES>
</STATEMENT>
</STATEMENTS>
</XMLDB>
</XMLDB>
28 changes: 28 additions & 0 deletions lib/db/upgrade.php
Expand Up @@ -55,8 +55,36 @@ function xmldb_main_upgrade($oldversion=0) {
set_field('modules', 'visible', 0, 'name', 'lams'); // Disable it by default
}
}

if ($result && $oldversion < 2006102600) {

/// Define fields to be added to user_info_field
$table = new XMLDBTable('user_info_field');
$field = new XMLDBField('description');
$field->setAttributes(XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, null, 'categoryid');
$field1 = new XMLDBField('param1');
$field1->setAttributes(XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, null, 'defaultdata');
$field2 = new XMLDBField('param2');
$field2->setAttributes(XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, null, 'param1');
$field3 = new XMLDBField('param3');
$field3->setAttributes(XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, null, 'param2');
$field4 = new XMLDBField('param4');
$field4->setAttributes(XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, null, 'param3');
$field5 = new XMLDBField('param5');
$field5->setAttributes(XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, null, 'param4');

/// Launch add fields
$result = $result && add_field($table, $field);
$result = $result && add_field($table, $field1);
$result = $result && add_field($table, $field2);
$result = $result && add_field($table, $field3);
$result = $result && add_field($table, $field4);
$result = $result && add_field($table, $field5);
}


return $result;

}

?>
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)

$version = 2006102400; // YYYYMMDD = date
$version = 2006102600; // YYYYMMDD = date
// XY = increments within a single day

$release = '1.8 dev'; // Human-friendly version name
Expand Down

0 comments on commit 74807b4

Please sign in to comment.