mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-17846 moved blocks code from /blocks/db/* to core
This commit is contained in:
parent
27bd819be5
commit
ab2eb65c88
10 changed files with 73 additions and 253 deletions
|
@ -1,60 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="blocks/db" VERSION="20070813" COMMENT="XMLDB file for Moodle block tables"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
<TABLES>
|
||||
<TABLE NAME="block" COMMENT="to store installed blocks" NEXT="block_instance">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="name"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="version"/>
|
||||
<FIELD NAME="version" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="cron"/>
|
||||
<FIELD NAME="cron" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="version" NEXT="lastcron"/>
|
||||
<FIELD NAME="lastcron" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="cron" NEXT="visible"/>
|
||||
<FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="lastcron" NEXT="multiple"/>
|
||||
<FIELD NAME="multiple" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="visible"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
|
||||
</KEYS>
|
||||
</TABLE>
|
||||
<TABLE NAME="block_instance" COMMENT="to store block instances in pages" PREVIOUS="block" NEXT="block_pinned">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="blockid"/>
|
||||
<FIELD NAME="blockid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="pageid"/>
|
||||
<FIELD NAME="pageid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="blockid" NEXT="pagetype"/>
|
||||
<FIELD NAME="pagetype" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="pageid" NEXT="position"/>
|
||||
<FIELD NAME="position" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="pagetype" NEXT="weight"/>
|
||||
<FIELD NAME="weight" TYPE="int" LENGTH="3" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="position" NEXT="visible"/>
|
||||
<FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="weight" NEXT="configdata"/>
|
||||
<FIELD NAME="configdata" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="visible"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="blockid"/>
|
||||
<KEY NAME="blockid" TYPE="foreign" FIELDS="blockid" REFTABLE="block" REFFIELDS="id" PREVIOUS="primary"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="pageid" UNIQUE="false" FIELDS="pageid" NEXT="pagetype"/>
|
||||
<INDEX NAME="pagetype" UNIQUE="false" FIELDS="pagetype" PREVIOUS="pageid"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
<TABLE NAME="block_pinned" COMMENT="to pin blocks" PREVIOUS="block_instance">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="blockid"/>
|
||||
<FIELD NAME="blockid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="pagetype"/>
|
||||
<FIELD NAME="pagetype" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="blockid" NEXT="position"/>
|
||||
<FIELD NAME="position" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="pagetype" NEXT="weight"/>
|
||||
<FIELD NAME="weight" TYPE="int" LENGTH="3" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="position" NEXT="visible"/>
|
||||
<FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="weight" NEXT="configdata"/>
|
||||
<FIELD NAME="configdata" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="visible"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="blockid"/>
|
||||
<KEY NAME="blockid" TYPE="foreign" FIELDS="blockid" REFTABLE="block" REFFIELDS="id" PREVIOUS="primary"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="pagetype" UNIQUE="false" FIELDS="pagetype"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
|
@ -1,55 +0,0 @@
|
|||
<?php //$Id$
|
||||
|
||||
// This file keeps track of upgrades to
|
||||
// the blocks system
|
||||
//
|
||||
// Sometimes, changes between versions involve
|
||||
// alterations to database structures and other
|
||||
// major things that may break installations.
|
||||
//
|
||||
// The upgrade function in this file will attempt
|
||||
// to perform all the necessary actions to upgrade
|
||||
// your older installtion to the current version.
|
||||
//
|
||||
// If there's something it cannot do itself, it
|
||||
// will tell you what you need to do.
|
||||
//
|
||||
// The commands in here will all be database-neutral,
|
||||
// using the methods of database_manager class
|
||||
//
|
||||
// Please do not forget to use upgrade_set_timeout()
|
||||
// before any action that may take longer time to finish.
|
||||
|
||||
function xmldb_blocks_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
|
||||
/// }
|
||||
|
||||
if ($result && $oldversion < 2007081300) {
|
||||
|
||||
/// Changing nullability of field configdata on table block_instance to null
|
||||
$table = new xmldb_table('block_instance');
|
||||
$field = new xmldb_field('configdata');
|
||||
$field->set_attributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'visible');
|
||||
|
||||
/// Launch change of nullability for field configdata
|
||||
$result = $result && $dbman->change_field_notnull($table, $field);
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
|
@ -1,9 +0,0 @@
|
|||
<?PHP //$Id$
|
||||
// This file defines the current version of the
|
||||
// blocks code that is being used. This can be
|
||||
// compared against the values stored in the
|
||||
// database (blocks_version) to determine whether upgrades should
|
||||
// be performed (see db/backup_*.php)
|
||||
|
||||
$blocks_version = 2007081300; // The current version is a date (YYYYMMDDXX)
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue